bugfix: where cursor is drawn

[?]
Jul 20, 2022, 4:11 PM
VSBSWTE4IVQDRXLPQ7VTDIIEBEF7GMGRBHZ2IA73ZR6B2KZWI5JAC

Dependencies

  • [2] KURLAXXI clean up some prints
  • [3] 5XQ4Y7NU reorg manual tests doc
  • [4] GL4Q5WCV keep text from overflowing right margin
  • [5] EKKFWP4D bugfix: couple of margin-relative computations
  • [6] IMEJA43L snapshot
  • [7] ULKLJBN6 couple of renames
  • [8] JFFUF5AL override mouse state lookups in tests
  • [9] WAR3HXHT test both ways of selecting text with mouse
  • [10] RMKMPFT5 fix a corner case when selecting text
  • [11] APYPFFS3 call edit rather than App callbacks in tests
  • [12] BULPIBEG beginnings of a module for the text editor
  • [13] JLU2RMC4 allow Text.nearest_pos_less_than to return 0
  • [14] LNUHQOGH start passing in Editor_state explicitly
  • [15] UHB4GARJ left/right margin -> left/right coordinates
  • [16] H3ECRBXF bugfix: clicking on empty lines
  • [17] 356GY7IQ unify two similar functions
  • [18] LF7BWEG4 group all editor globals
  • [19] LXTTOB33 extract a couple of files
  • [*] MXA3RZYK deduce left/right from state where possible
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in text_tests.lua at line 288
    [4.957][4.2:109]()
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_with_mouse_takes_margins_into_account/cursor:pos')
    [4.957]
    [4.1064]
    check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_takes_margins_into_account/cursor:pos')
  • replacement in text_tests.lua at line 378
    [4.1942][4.110:207]()
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_with_mouse_on_wrapping_line/cursor:pos')
    [4.1942]
    [4.2039]
    check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_on_wrapping_line/cursor:pos')
  • replacement in text_tests.lua at line 398
    [4.3041][4.208:332]()
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_with_mouse_on_wrapping_line_takes_margins_into_account/cursor:pos')
    [4.3041]
    [4.3165]
    check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_on_wrapping_line_takes_margins_into_account/cursor:pos')
  • replacement in text_tests.lua at line 837
    [4.19632][4.333:420]()
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_move_cursor_using_mouse/cursor:pos')
    [4.19632]
    [4.19719]
    check_eq(Editor_state.cursor1.pos, 2, 'F - test_move_cursor_using_mouse/cursor:pos')
  • replacement in text_tests.lua at line 858
    [4.20562][4.421:514]()
    check_eq(Editor_state.selection1.pos, 1, 'F - test_select_text_using_mouse/selection:pos')
    [4.20562]
    [4.20655]
    check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos')
  • replacement in text_tests.lua at line 883
    [4.21674][4.515:618]()
    check_eq(Editor_state.selection1.pos, 1, 'F - test_select_text_using_mouse_and_shift/selection:pos')
    [4.21674]
    [4.21777]
    check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse_and_shift/selection:pos')
  • replacement in text_tests.lua at line 914
    [4.23026][4.619:733]()
    check_eq(Editor_state.selection1.pos, 1, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:pos')
    [4.23026]
    [4.23140]
    check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:pos')
  • replacement in text_tests.lua at line 916
    [4.23250][4.734:842]()
    check_eq(Editor_state.cursor1.pos, 1, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
    [4.23250]
    [4.6250]
    check_eq(Editor_state.cursor1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
  • replacement in text_tests.lua at line 1132
    [4.28919][4.843:949]()
    check_eq(Editor_state.cursor1.pos, 6, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:pos')
    [4.28919]
    [4.8650]
    check_eq(Editor_state.cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:pos')
  • replacement in text_tests.lua at line 1696
    [4.1178][4.1178:1291]()
    check_eq(Editor_state.cursor1.pos, 25, 'F - test_position_cursor_on_recently_edited_wrapping_line/cursor:pos')
    [4.1178]
    [4.33305]
    check_eq(Editor_state.cursor1.pos, 26, 'F - test_position_cursor_on_recently_edited_wrapping_line/cursor:pos')
  • replacement in text.lua at line 806
    [4.7300][4.1293:1327]()
    local max_x = Text.x(line, len)
    [4.7300]
    [4.7344]
    local max_x = Text.x_after(line, len)
  • replacement in text.lua at line 813
    [4.7496][4.1328:1412]()
    local currxmin = Text.x(line, curr+1)
    local currxmax = Text.x(line, curr+2)
    [4.7496]
    [2.673]
    local currxmin = Text.x_after(line, curr+1)
    local currxmax = Text.x_after(line, curr+2)
  • replacement in text.lua at line 831
    [4.3662][4.1413:1437]()
    function Text.x(s, pos)
    [4.3662]
    [4.3692]
    function Text.x_after(s, pos)
  • edit in text.lua at line 839
    [4.7881]
    [21.3394]
    function Text.x(s, pos)
    local offset = Text.offset(s, pos)
    local s_before = s:sub(1, offset-1)
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return App.width(text_before)
    end
  • edit in Manual_tests.md at line 11
    [3.168]
    [3.168]
    * How the screen looks. Our tests use a level of indirection to check text and
    graphics printed to screen, but not the precise pixels they translate to.
    - where exactly the cursor is drawn to highlight a given character