stop scanning from start of file on every App.draw

[?]
Jul 8, 2022, 4:51 AM
LFMI3D7D236VAARLPOF3OKWMFVL7KSCVEUBNGJKVOE75ST3AKZSQC

Dependencies

  • [2] YGCT2D2O start loading settings as applicable
  • [3] H3ECRBXF bugfix: clicking on empty lines
  • [4] U7M4M2F7 bugfix: don't rely on Screen_bottom1 while scrolling
  • [5] SQLVYKVJ rename
  • [6] DHCLUDCW .
  • [7] EDY3RQUL gracefully handle a non-existent filename at the commandline
  • [8] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [9] U2TKUOID bugfix: undo drawing creation
  • [10] NQKFQSZE undo creating new drawings
  • [11] PX7DDEMO autosave slightly less aggressively
  • [12] DAENUOGV eliminate assumptions that line length == size in bytes
  • [13] MGOQ5XAV start uppercasing globals
  • [14] QU7NHFOV show cursor
  • [15] 3TFEAQSW start using some globals
  • [16] IRV65LZP fold variables for screen dimensions into the app framework
  • [17] CVGE3SIG I feel confident now that page-down is working.
  • [18] S5VCAFKY couple of tests for cursor down
  • [19] OYXDYPGS get rid of debug variables
  • [20] LUNH47XX make text and drawings the same width
  • [21] Y6FTGOHJ simpler
  • [22] ZZ2B5RPQ extract variables for drawing padding
  • [23] XVR2O5PI change text cursor shape
  • [24] M6TH7VSZ rip out notion of Line_width
  • [25] QKAMUWSB another bugfix in scrolling while inserting text
  • [26] 4J2WLDRM indent
  • [27] OTIBCAUJ love2d scaffold
  • [28] DLQMM265 scroll past first page
  • [29] VJ3ODCHR assert for a bug I saw a while ago but can no longer reproduce
  • [30] 4NDYV4WD fix 2 bugs in line selection
  • [31] ESETRNLB bugfix: printing the first part of a line at the bottom made it seem non-wrapping
  • [32] 2POFQQLW keep cursor on screen when pressing 'down'
  • [33] Z4XRNDTR find text
  • [34] XX7G2FFJ intermingle freehand line drawings with text
  • [35] B3IWYWSR delete another arg that can be deduced
  • [36] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [37] HOSPP2AN crisp font rendering
  • [38] 7IKRRESB longer names for indices in long loops
  • [39] 6J3NXBYG affordance to adjust width for word wrap
  • [40] LAW2O3NW extract variable Margin_left
  • [41] 4C375P53 this is a bit clearer
  • [42] YPHKZVWM extract a new variable
  • [43] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [44] UWNHC4AA redo y computations
  • [45] 5DOC2CBM extract a function
  • [46] YTSPVDZH first successful pagedown test, first bug found by test
  • [47] RTDYYP4H bugfix: text past cursor was rendered red on wrapped lines
  • [48] AVQ5MC5D finish uppercasing all globals
  • [49] YJGADSGK delete unused arg

Change contents

  • replacement in main.lua at line 235
    [4.18][4.2:44](),[4.81][4.2:44](),[4.2017][4.2:44](),[4.2296][4.2:44](),[4.58][4.2:44]()
    for line_index,line in ipairs(Lines) do
    [4.81]
    [4.82]
    for line_index = Screen_top1.line,#Lines do
    local line = Lines[line_index]
  • replacement in main.lua at line 239
    [4.4220][4.2951:2970](),[4.404][4.2951:2970](),[4.404][4.9247:9329](),[4.1036][4.9247:9329](),[4.2970][4.9247:9329](),[4.223][4.9247:9329](),[4.9329][4.705:759](),[4.705][4.705:759](),[4.759][3.558:608](),[3.608][4.275:305](),[4.38][4.275:305](),[4.38][4.759:890](),[4.305][4.759:890](),[4.759][4.759:890](),[4.890][4.155:230](),[4.67][4.890:1011](),[4.230][4.890:1011](),[4.638][4.890:1011](),[4.890][4.890:1011](),[4.1011][4.9330:9443](),[4.9443][4.1121:1148](),[4.1121][4.1121:1148](),[4.1148][4.242:281](),[4.281][4.284:394](),[4.284][4.284:394]()
    --? print('a')
    if line_index >= Screen_top1.line then
    Screen_bottom1.line = line_index
    if line.mode == 'text' and line.data == '' then
    line.starty = y
    line.startpos = 1
    -- insert new drawing
    button('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0},
    icon = icon.insert_drawing,
    onpress1 = function()
    Drawing.before = snapshot(line_index-1, line_index)
    table.insert(Lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
    if Cursor1.line >= line_index then
    Cursor1.line = Cursor1.line+1
    end
    schedule_save()
    record_undo_event({before=Drawing.before, after=snapshot(line_index-1, line_index+1)})
    [4.4220]
    [4.306]
    Screen_bottom1.line = line_index
    if line.mode == 'text' and line.data == '' then
    line.starty = y
    line.startpos = 1
    -- insert new drawing
    button('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0},
    icon = icon.insert_drawing,
    onpress1 = function()
    Drawing.before = snapshot(line_index-1, line_index)
    table.insert(Lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
    if Cursor1.line >= line_index then
    Cursor1.line = Cursor1.line+1
  • replacement in main.lua at line 252
    [4.331][4.331:342](),[4.342][4.7:132](),[4.1175][4.7:132](),[4.119][4.1377:1391](),[4.132][4.1377:1391](),[4.280][4.1377:1391](),[4.299][4.1377:1391](),[4.2819][4.1377:1391](),[4.1377][4.1377:1391](),[4.1391][4.133:145](),[4.145][4.1209:1254](),[4.1391][4.1209:1254](),[4.1254][4.4221:4249](),[4.1391][4.4221:4249](),[4.55][4.1391:1432](),[4.89][4.1391:1432](),[4.4249][4.1391:1432](),[4.1391][4.1391:1432](),[4.1432][4.454:488](),[4.488][4.118:137](),[4.118][4.118:137](),[4.137][4.3:30](),[4.1469][4.3:30](),[4.30][4.489:553](),[4.30][4.1499:1510](),[4.193][4.1499:1510](),[4.553][4.1499:1510](),[4.1499][4.1499:1510](),[4.153][4.2050:2189]()
    })
    if Search_term == nil then
    if line_index == Cursor1.line then
    Text.draw_cursor(Margin_left, y)
    end
    end
    Screen_bottom1.pos = Screen_top1.pos
    y = y + Line_height
    elseif line.mode == 'drawing' then
    y = y+Drawing_padding_top
    line.y = y
    Drawing.draw(line)
    y = y + Drawing.pixels(line.h) + Drawing_padding_bottom
    else
    line.starty = y
    line.startpos = 1
    if line_index == Screen_top1.line then
    line.startpos = Screen_top1.pos
    [4.331]
    [4.2189]
    schedule_save()
    record_undo_event({before=Drawing.before, after=snapshot(line_index-1, line_index+1)})
    end
    })
    if Search_term == nil then
    if line_index == Cursor1.line then
    Text.draw_cursor(Margin_left, y)
  • replacement in main.lua at line 260
    [4.2201][2.1219:1265](),[2.1265][4.1931:1991](),[4.2201][4.1931:1991](),[4.1991][4.4250:4278](),[4.407][4.4250:4278](),[4.4278][4.154:183](),[4.108][4.154:183]()
    --? print('text.draw', y, line_index)
    y, Screen_bottom1.pos = Text.draw(line, line_index)
    y = y + Line_height
    --? print('=> y', y)
    [4.2201]
    [4.1574]
    end
    Screen_bottom1.pos = Screen_top1.pos
    y = y + Line_height
    elseif line.mode == 'drawing' then
    y = y+Drawing_padding_top
    line.y = y
    Drawing.draw(line)
    y = y + Drawing.pixels(line.h) + Drawing_padding_bottom
    else
    line.starty = y
    line.startpos = 1
    if line_index == Screen_top1.line then
    line.startpos = Screen_top1.pos
  • edit in main.lua at line 274
    [4.1584]
    [4.1294]
    --? print('text.draw', y, line_index)
    y, Screen_bottom1.pos = Text.draw(line, line_index)
    y = y + Line_height
    --? print('=> y', y)