bugfix: search highlight straddling screen lines

[?]
Jul 31, 2023, 4:15 PM
BMGHJX7GIX535K2DU7ZT4EP2O6MYS7QVING22AAJABUY53K2PLFAC

Dependencies

  • [2] IM7UEBMK bugfix: highlight search patterns on the right line
  • [3] UBA2ZUCP remove a duplicate print to screen
  • [4] IAWCZRFU extract a variable
  • [5] Z4XRNDTR find text
  • [6] KKMFQDR4 editing source code from within the app
  • [7] TWXPV2AC hoist and duplicate a conditional
  • [8] ZPQI5UL3 bugfix: never use utf8 pos in string.sub
  • [9] GZ5WULJV switch source side to new screen-line-based render
  • [10] CQWVUCXZ bugfix: syntax highlighting in source editor
  • [11] ZE7LVQNE improve a comment
  • [12] SDEY7LFJ rename a variable
  • [13] I64IPGJX avoid saving fragments in lines
  • [14] HALS7E5U more clearly skip prints before screen top
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 33
    [4.38][2.4:86](),[2.86][4.3:237](),[4.121][4.3:237](),[4.458][4.3:237](),[4.237][4.4:75](),[4.75][3.36:125](),[3.125][4.838:854](),[4.961][4.838:854](),[4.838][4.838:854]()
    if pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos then
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
    local hi = State.cursor1.pos+utf8.len(State.search_term)
    Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)
    end
    [4.38]
    [4.122]
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
    local save_selection = State.selection1
    State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}
    local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)
    Text.draw_highlight(State, line, State.left,y, pos, lo,hi)
    State.selection1 = save_selection
  • replacement in source_text.lua at line 50
    [4.271][2.576:658](),[4.354][4.242:476](),[2.658][4.242:476](),[4.88448][4.242:476](),[4.476][4.183:254](),[4.254][3.266:355](),[3.355][4.88835:88851](),[4.1760][4.88835:88851](),[4.88835][4.88835:88851]()
    if pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos then
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
    local hi = State.cursor1.pos+utf8.len(State.search_term)
    Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)
    end
    [4.271]
    [4.355]
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
    local save_selection = State.selection1
    State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}
    local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)
    Text.draw_highlight(State, line, State.left,y, pos, lo,hi)
    State.selection1 = save_selection