experiment: extremely precise scrolling on paste

[?]
Jun 10, 2022, 8:59 PM
WIDXZBNW4CCOGWHCQSICXRPSZ4MB24OJZLEC3RO3UTEZKEFUZBSQC

Dependencies

Change contents

  • edit in main.lua at line 431
    [5.620]
    [5.620]
    local draw_fn = App.draw
    App.draw = nil -- disable temporarily
  • edit in main.lua at line 437
    [5.753]
    [3.120]
    draw_fn()
  • edit in main.lua at line 445
    [5.41]
    [4.943]
    draw_fn()
  • edit in main.lua at line 452
    [5.859][5.859:1171](),[5.1171][5.237:282](),[5.282][5.1281:1766](),[5.1281][5.1281:1766](),[5.1766][5.283:328]()
    end
    -- hack 1: if we have too many newlines we definitely need to scroll
    for i=before_line,Cursor1.line do
    Lines[i].screen_line_starting_pos = nil
    Text.populate_screen_line_starting_pos(i)
    end
    if Cursor1.line-Screen_top1.line+1 + num_newlines > App.screen.height/Line_height then
    Text.snap_cursor_to_bottom_of_screen()
    end
    -- hack 2: if we have too much text wrapping we definitely need to scroll
    local clipboard_text = App.newText(love.graphics.getFont(), clipboard_data)
    local clipboard_width = App.width(clipboard_text)
    --? print(Cursor_y, Cursor_y*Line_width, Cursor_y*Line_width+Cursor_x, Cursor_y*Line_width+Cursor_x+clipboard_width, Line_width*App.screen.height/Line_height)
    if Cursor_y*Line_width+Cursor_x + clipboard_width > Line_width*App.screen.height/Line_height then
    Text.snap_cursor_to_bottom_of_screen()
  • edit in main.lua at line 453
    [5.646]
    [2.43]
    App.draw = draw_fn