handle wrapping lines

[?]
Jun 3, 2023, 5:43 PM
YFW4MNNPY452RIUIGW6NO7WAUWPBXXOKOJJBNZGU727PUBZFATSAC

Dependencies

  • [2] 6RYLD5ON change how we handle clicks above top margin
  • [3] LNUHQOGH start passing in Editor_state explicitly
  • [4] 2L5MEZV3 experiment: new edit namespace
  • [*] LXTTOB33 extract a couple of files
  • [*] WAR3HXHT test both ways of selecting text with mouse

Change contents

  • edit in text_tests.lua at line 850
    [7.543]
    [7.543]
    function test_select_text_using_mouse_starting_above_text_wrapping_line()
    -- first screen line starts in the middle of a line
    App.screen.init{width=50, height=60}
    Editor_state = edit.initialize_test_state()
    Editor_state.lines = load_array{'abc', 'defgh', 'xyz'}
    Text.redraw_all(Editor_state)
    Editor_state.cursor1 = {line=2, pos=5}
    Editor_state.screen_top1 = {line=2, pos=3}
    Editor_state.screen_bottom1 = {}
    -- press mouse above first line of text
    edit.run_after_mouse_press(Editor_state, Editor_state.left+8,5, 1)
    -- selection is at screen top
    check(Editor_state.selection1.line ~= nil, 'selection:line-not-nil')
    check_eq(Editor_state.selection1.line, 2, 'selection:line')
    check_eq(Editor_state.selection1.pos, 3, 'selection:pos')
    end
  • replacement in edit.lua at line 235
    [2.1226][2.1226:1257]()
    line=1,
    pos=1,
    [2.1226]
    [2.1257]
    line=State.screen_top1.line,
    pos=State.screen_top1.pos,