more precise scroll on paste

[?]
Jun 10, 2022, 9:12 PM
T7IWZFL4NGMHUKNBXVXMC32AO4GC63WJDAOVOL6M6HIPANPNRCMAC

Dependencies

  • [2] SR7L4QPZ revert previous commit
  • [3] VC2CU2GG faster paste
  • [4] NQWWTGXR switch undo/redo to ctrl- hotkeys
  • [5] 5ZFHMYQI .
  • [6] SN2QONLI autosave on cut/paste
  • [7] Z4XRNDTR find text
  • [8] WIDXZBNW experiment: extremely precise scrolling on paste
  • [9] LS55YKGW switch copy/paste to ctrl- hotkeys
  • [10] 65XHTZEK regression: couldn't do many drawing operations because line.y was reset
  • [11] IRCKL6VN extract scrolling logic out of insert_at_cursor
  • [12] BTKAW76L rename
  • [13] 3TDOZESE extract scrolling logic out of insert_return
  • [*] OTIBCAUJ love2d scaffold
  • [*] DHCLUDCW .
  • [*] YPHKZVWM extract a new variable
  • [*] XX7G2FFJ intermingle freehand line drawings with text

Change contents

  • edit in main.lua at line 209
    [16.46]
    [17.1479]
    Cursor_y = -1
  • edit in main.lua at line 251
    [18.1302]
    [15.410]
    end
    if Cursor_y == -1 then
    Cursor_y = App.screen.height
  • edit in main.lua at line 434
    [4.582][4.582:620](),[4.620][3.8:125]()
    local num_newlines = 0 -- hack 1
    --? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
  • edit in main.lua at line 438
    [4.242][4.753:791](),[4.753][4.753:791]()
    num_newlines = num_newlines+1
  • edit in main.lua at line 446
    [3.309][3.309:434]()
    --? print('=>', Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
  • edit in main.lua at line 447
    [4.646][2.8:895]()
    -- 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()
    end