click to the left of a line

[?]
Jul 29, 2022, 9:38 PM
5BMR5HRT7GN5L4XB4ISP4JJP3ONZESHEEQBCTQE4EVEDL7MBSDGAC

Dependencies

  • [2] EKKFWP4D bugfix: couple of margin-relative computations
  • [3] TGHAJBES use line cache for drawings as well
  • [4] ODLKHO7B switch to line index in a function
  • [5] DAENUOGV eliminate assumptions that line length == size in bytes
  • [6] EMRPLZPW drop an arg from a function
  • [7] T57DTBX6 add args to some functions
  • [8] LF7BWEG4 group all editor globals
  • [9] 76AIXR7H bugfix
  • [10] IMEJA43L snapshot
  • [11] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [12] 52ZZ5TIE switch to line index in a function
  • [13] LAW2O3NW extract variable Margin_left
  • [14] VSA3FN7X .
  • [15] MXA3RZYK deduce left/right from state where possible
  • [16] CCYSVZA2 bugfix: BSOD in #4.
  • [17] 4KC7I3E2 make colors easier to edit
  • [18] ILOA5BYF separate data structure for each line's cache data
  • [19] CTJ3IZGS add args to some functions
  • [20] QCPXQ2E3 add state arg to a few functions
  • [21] IWYLK45K clicking to the right of a line within line width
  • [22] BULPIBEG beginnings of a module for the text editor
  • [23] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [24] 2L5MEZV3 experiment: new edit namespace
  • [25] UHB4GARJ left/right margin -> left/right coordinates
  • [26] 242L3OQX bugfix: ensure Cursor_line is always on a text line
  • [27] LNUHQOGH start passing in Editor_state explicitly
  • [*] LXTTOB33 extract a couple of files
  • [*] H3ECRBXF bugfix: clicking on empty lines
  • [*] FS2ITYYH record a known issue
  • [*] ZRKTXF4Q tweak to Readme
  • [*] IDGP4BJZ new known issue with drawings

Change contents

  • edit in text_tests.lua at line 272
    [30.7]
    [2.165]
    function test_click_with_mouse_to_left_of_line()
    io.write('\ntest_click_with_mouse_to_left_of_line')
    -- display a line with the cursor in the middle
    App.screen.init{width=50, height=80}
    Editor_state = edit.initialize_test_state()
    Editor_state.lines = load_array{'abc'}
    Text.redraw_all(Editor_state)
    Editor_state.cursor1 = {line=1, pos=3}
    Editor_state.screen_top1 = {line=1, pos=1}
    Editor_state.screen_bottom1 = {}
    -- click to the left of the line
    edit.draw(Editor_state)
    edit.run_after_mouse_click(Editor_state, Editor_state.left-4,Editor_state.top+5, 1)
    -- cursor moves to start of line
    check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_to_left_of_line/cursor:line')
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_with_mouse_to_left_of_line/cursor:pos')
    check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse_to_left_of_line/selection is empty to avoid perturbing future edits')
    end
  • edit in text.lua at line 694
    [4.5316][4.2925:2967](),[4.1085][4.2925:2967]()
    if x < State.left then return false end
  • replacement in text.lua at line 761
    [4.199][4.517:534](),[4.718][4.517:534](),[4.7154][4.517:534](),[4.517][4.517:534]()
    if x == 0 then
    [4.718]
    [4.534]
    if x < left then
  • edit in edit.lua at line 134
    [4.1023][4.2728:2826]()
    --? print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
  • replacement in edit.lua at line 135
    [3.1895][4.2826:2879](),[4.8418][4.2826:2879](),[4.2826][4.2826:2879]()
    assert(Text.le1(State.screen_top1, State.cursor1))
    [3.1895]
    [4.2879]
    if not Text.le1(State.screen_top1, State.cursor1) then
    print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
    assert(false)
    end
  • edit in README.md at line 65
    [32.135]
    [33.203]
    * Long wrapping lines can't yet distinguish between the cursor at end of one
    screen line and start of the next, so clicking the mouse to position the
    cursor can very occasionally do the wrong thing.