make a function oblivious to line data structure

[?]
Jul 17, 2022, 4:21 PM
EM276IH3NFWRAVNH4MLH43KOEXPZSX4K35CNVRSI3NGZHHUZQPBQC

Dependencies

  • [2] ODLKHO7B switch to line index in a function
  • [3] UV4EWOLY add args to some functions
  • [4] QCPXQ2E3 add state arg to a few functions
  • [5] MXA3RZYK deduce left/right from state where possible
  • [6] CPZGQT72 go through and fix similar issues
  • [7] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [8] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [9] IWYLK45K clicking to the right of a line within line width
  • [10] LF7BWEG4 group all editor globals
  • [11] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 702
    [2.481][3.3928:4056](),[3.3040][3.3928:4056](),[3.578][3.3928:4056]()
    return y < line.starty + State.line_height*(#line.screen_line_starting_pos - Text.screen_line_index(line, line.startpos) + 1)
    [2.481]
    [3.95]
    return y < line.starty + State.line_height*(#line.screen_line_starting_pos - Text.screen_line_index(line.screen_line_starting_pos, line.startpos) + 1)
  • replacement in text.lua at line 714
    [3.1306][3.1306:1384]()
    local start_screen_line_index = Text.screen_line_index(line, line.startpos)
    [3.1306]
    [3.1384]
    local start_screen_line_index = Text.screen_line_index(line.screen_line_starting_pos, line.startpos)
  • replacement in text.lua at line 752
    [3.1654][3.1654:1798]()
    function Text.screen_line_index(line, pos)
    for i = #line.screen_line_starting_pos,1,-1 do
    if line.screen_line_starting_pos[i] <= pos then
    [3.1654]
    [3.1798]
    function Text.screen_line_index(screen_line_starting_pos, pos)
    for i = #screen_line_starting_pos,1,-1 do
    if screen_line_starting_pos[i] <= pos then