more clearly skip prints before screen top

[?]
Jul 20, 2022, 1:53 PM
HALS7E5UGKCP3DFY456F7Z3Y6WNGIABOCV2SHT34D5ZAGNCPV5PQC

Dependencies

  • [2] MXA3RZYK deduce left/right from state where possible
  • [3] S2MISTTM add state arg to a few functions
  • [4] JY4VK7L2 rename
  • [5] RTDYYP4H bugfix: text past cursor was rendered red on wrapped lines
  • [6] LERERVPH keep one screen line of overlap on pagedown
  • [7] 2ZRC7FUL .
  • [8] 3TFEAQSW start using some globals
  • [9] Z4XRNDTR find text
  • [10] 4CXVIEBS add args to some functions
  • [11] 4KC7I3E2 make colors easier to edit
  • [12] WLHI7KD3 new globals: draw partial screen line up top
  • [13] MGT5FTJ3 first stab at supporting wrapping in cursor up
  • [14] 537TQ2QN some more logging
  • [15] LF7BWEG4 group all editor globals
  • [16] FHSZYAZ2 more precise search highlighting
  • [17] 5DOTWNVM right margin
  • [18] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [19] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [20] A2NV3WVO scrolling with up arrow
  • [21] AYE2VEGJ extract a couple of methods
  • [22] XVR2O5PI change text cursor shape
  • [23] DHI6IJCN selecting text and deleting selections
  • [24] OYXDYPGS get rid of debug variables
  • [25] IMEJA43L snapshot
  • [26] XNFTJHC4 split keyboard handling between Text and Drawing
  • [27] JRGTJ2IW quite the frustrating bugfix
  • [28] 5DOC2CBM extract a function
  • [29] ESETRNLB bugfix: printing the first part of a line at the bottom made it seem non-wrapping
  • [30] PR4KIAZD first stab at equally hacky cursor down support
  • [31] ULKLJBN6 couple of renames
  • [32] HOSPP2AN crisp font rendering
  • [33] MDXGMZU2 disable all debug prints
  • [34] CVGE3SIG I feel confident now that page-down is working.
  • [35] QYIFOHW3 first test!
  • [36] LAW2O3NW extract variable Margin_left
  • [37] M6TH7VSZ rip out notion of Line_width
  • [38] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [39] GK47BBCY start passing left/right margins everywhere
  • [40] X3F7ECSL add state arg to some functions
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 34
    [3.334][2.209:301](),[2.301][3.1:74](),[3.417][3.1:74](),[3.2255][3.1:74](),[3.2151][3.1:74](),[3.74][3.335:405]()
    if x + frag_width > State.right then
    assert(x > State.left) -- no overfull lines
    -- update y only after drawing the first screen line of screen top
    if Text.lt1(State.screen_top1, {line=line_index, pos=pos}) then
    [3.334]
    [3.405]
    if Text.lt1({line=line_index, pos=pos}, State.screen_top1) then
    -- render nothing
    --? print('skipping', frag)
    else
    if x + frag_width > State.right then
    assert(x > State.left) -- no overfull lines
  • edit in text.lua at line 47
    [3.648]
    [3.119]
    x = State.left
  • edit in text.lua at line 49
    [3.129][2.302:323](),[3.179][3.2198:2206](),[2.323][3.2198:2206](),[3.433][3.2198:2206](),[3.2278][3.2198:2206](),[3.2198][3.2198:2206](),[3.2206][3.498:560](),[3.560][3.387:427](),[3.705][3.387:427](),[3.54650][3.387:427](),[3.152][3.387:427](),[3.427][3.561:629]()
    x = State.left
    end
    --? print('checking to draw', pos, State.screen_top1.pos)
    -- don't draw text above screen top
    if Text.le1(State.screen_top1, {line=line_index, pos=pos}) then
  • replacement in text.lua at line 55
    [3.110][3.260:268](),[3.334][3.260:268](),[3.260][3.260:268](),[3.268][3.2254:2288](),[3.2254][3.2254:2288](),[3.2288][3.666:1099](),[3.1099][3.28:62](),[3.55294][3.28:62](),[3.113][3.28:62](),[3.62][3.1100:1162]()
    end
    -- render cursor if necessary
    if line_index == State.cursor1.line then
    if pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos then
    if State.search_term then
    if State.lines[State.cursor1.line].data:sub(State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)-1) == State.search_term then
    local lo_px = Text.draw_highlight(line, x,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))
    App.color(Text_color)
    love.graphics.print(State.search_term, x+lo_px,y)
    [3.334]
    [3.530]
    -- render cursor if necessary
    if line_index == State.cursor1.line then
    if pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos then
    if State.search_term then
    if State.lines[State.cursor1.line].data:sub(State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)-1) == State.search_term then
    local lo_px = Text.draw_highlight(line, x,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))
    App.color(Text_color)
    love.graphics.print(State.search_term, x+lo_px,y)
    end
    else
    Text.draw_cursor(State, x+Text.x(frag, State.cursor1.pos-pos+1), y)
  • edit in text.lua at line 67
    [3.544][3.544:557](),[3.557][3.1163:1241]()
    else
    Text.draw_cursor(State, x+Text.x(frag, State.cursor1.pos-pos+1), y)
  • edit in text.lua at line 69
    [3.2604]
    [3.2604]
    x = x + frag_width
  • edit in text.lua at line 71
    [3.2612][3.2612:2635]()
    x = x + frag_width