move some code

[?]
May 29, 2022, 5:42 AM
AMSESRTH4T7EIEMXEFPMZFC55QAOVSWAN2XOQUUEB5ECHRDZUAYQC

Dependencies

  • [2] 4RUI5X52 a few tests for pageup, and a bugfix
  • [3] LERERVPH keep one screen line of overlap on pagedown
  • [4] ZPUQSPQP extract a few methods
  • [5] IRV65LZP fold variables for screen dimensions into the app framework
  • [6] VCMS2CWT bugfix: escape key to hide online help
  • [7] U7M4M2F7 bugfix: don't rely on Screen_bottom1 while scrolling
  • [8] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [9] BYG5CEMV support for naming points
  • [10] MDXGMZU2 disable all debug prints
  • [11] 252M2QMD forgot to move this special case out
  • [12] KJKKASHZ reduce ambitions a bit: page up/down need not start screen from the middle of a line
  • [13] 242L3OQX bugfix: ensure Cursor_line is always on a text line
  • [14] YTSPVDZH first successful pagedown test, first bug found by test
  • [15] DLQMM265 scroll past first page
  • [16] DXT4QTAH a few more integer coordinates
  • [17] XNFTJHC4 split keyboard handling between Text and Drawing
  • [18] CVGE3SIG I feel confident now that page-down is working.
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] OTIBCAUJ love2d scaffold

Change contents

  • edit in text.lua at line 995
    [4.77]
    [4.77]
    elseif chord == 'pageup' then
    -- duplicate some logic from love.draw
    local top2 = Text.to2(Screen_top1)
    --? print(App.screen.height)
    local y = App.screen.height - math.floor(15*Zoom)
    while y >= 15 do
    --? print(y, top2.line)
    if Screen_top1.line == 1 and Screen_top1.pos == 1 then break end
    if Lines[Screen_top1.line].mode == 'text' then
    y = y - math.floor(15*Zoom)
    elseif Lines[Screen_top1.line].mode == 'drawing' then
    y = y - 20 - Drawing.pixels(Lines[Screen_top1.line].h)
    end
    top2 = Text.previous_screen_line(top2)
    end
    Screen_top1 = Text.to1(top2)
    Cursor1.line = Screen_top1.line
    Cursor1.pos = Screen_top1.pos
    Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
    --? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)
    elseif chord == 'pagedown' then
    Screen_top1.line = Screen_bottom1.line
    Screen_top1.pos = Screen_bottom1.pos
    --? print('setting top to', Screen_top1.line, Screen_top1.pos)
    Cursor1.line = Screen_top1.line
    Cursor1.pos = Screen_top1.pos
    Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
    --? print('top now', Screen_top1.line)
  • edit in main.lua at line 233
    [5.941][5.1593:1627](),[5.1593][5.1593:1627](),[5.2544][5.9490:9533](),[5.1627][5.9490:9533](),[5.9533][5.521:562](),[5.562][3.2403:2470](),[5.562][5.9557:9627](),[5.1083][5.9557:9627](),[5.1635][5.9557:9627](),[3.2470][5.9557:9627](),[5.9557][5.9557:9627](),[5.845][5.939:1020](),[5.9627][5.939:1020](),[5.1721][5.939:1020](),[5.1020][5.1636:1679](),[5.1020][5.1721:1796](),[5.1123][5.1721:1796](),[5.1679][5.1721:1796](),[5.1721][5.1721:1796](),[5.1796][2.4240:4700](),[2.4700][5.2033:2043](),[5.9789][5.2033:2043](),[5.2033][5.2033:2043](),[5.2043][2.4701:4746](),[2.4746][5.2087:2095](),[5.9836][5.2087:2095](),[5.2087][5.2087:2095](),[5.2095][2.4747:4780](),[2.4780][5.9905:9941](),[5.163][5.9905:9941](),[5.9941][2.4781:4815](),[2.4815][5.1099:1180](),[5.9941][5.1099:1180](),[5.2194][5.1099:1180](),[5.1180][2.4816:4892]()
    elseif chord == 'pagedown' then
    Screen_top1.line = Screen_bottom1.line
    Screen_top1.pos = Screen_bottom1.pos
    --? print('setting top to', Screen_top1.line, Screen_top1.pos)
    Cursor1.line = Screen_top1.line
    Cursor1.pos = Screen_top1.pos
    Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
    --? print('top now', Screen_top1.line)
    elseif chord == 'pageup' then
    -- duplicate some logic from love.draw
    local top2 = Text.to2(Screen_top1)
    --? print(App.screen.height)
    local y = App.screen.height - math.floor(15*Zoom)
    while y >= 15 do
    --? print(y, top2.line)
    if Screen_top1.line == 1 and Screen_top1.pos == 1 then break end
    if Lines[Screen_top1.line].mode == 'text' then
    y = y - math.floor(15*Zoom)
    elseif Lines[Screen_top1.line].mode == 'drawing' then
    y = y - 20 - Drawing.pixels(Lines[Screen_top1.line].h)
    end
    top2 = Text.previous_screen_line(top2)
    end
    Screen_top1 = Text.to1(top2)
    Cursor1.line = Screen_top1.line
    Cursor1.pos = Screen_top1.pos
    Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
    --? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)