bugfix #2 in search UI

akkartik
Oct 29, 2024, 11:04 PM
4FTOQOPZLSWHIQ45X6BTMJ5RXP6NIOOYYYRBCXVMDADSTSJD4P6AC

Dependencies

  • [2] O7YTBRQY bugfix: restart search on backspace
  • [3] T6A5SZGB bugfix: restart search on backspace
  • [4] G54H3YG2 get rid of all bifold text
  • [5] 5ZA3BRNY add state arg to a few functions
  • [6] KKMFQDR4 editing source code from within the app
  • [7] 2L5MEZV3 experiment: new edit namespace
  • [8] LF7BWEG4 group all editor globals
  • [9] LNUHQOGH start passing in Editor_state explicitly
  • [*] LXTTOB33 extract a couple of files
  • [*] MSOQI3A5 bugfix: check before cursor on same line
  • [*] AMOPICKV bugfix: check after cursor on same line when searching upwards

Change contents

  • edit in text_tests.lua at line 2083
    [2.271]
    [2.271]
    Editor_state.screen_top1 = {line=1, pos=1}
    edit.draw(Editor_state)
    -- search for empty string
    edit.run_after_keychord(Editor_state, 'C-f', 'f')
    edit.run_after_keychord(Editor_state, 'down', 'down')
    -- no crash
    end
    function test_search_downwards_from_final_pos_of_line()
    App.screen.init{width=120, height=60}
    Editor_state = edit.initialize_test_state()
    Editor_state.lines = load_array{'abc', 'def', 'ghi'}
    Text.redraw_all(Editor_state)
    Editor_state.cursor1 = {line=1, pos=3}
  • edit in source_text_tests.lua at line 2083
    [2.768]
    [2.768]
    Editor_state.screen_top1 = {line=1, pos=1}
    edit.draw(Editor_state)
    -- search for empty string
    edit.run_after_keychord(Editor_state, 'C-f', 'f')
    edit.run_after_keychord(Editor_state, 'down', 'down')
    -- no crash
    end
    function test_search_downwards_from_final_pos_of_line()
    App.screen.init{width=120, height=60}
    Editor_state = edit.initialize_test_state()
    Editor_state.lines = load_array{'abc', 'def', 'ghi'}
    Text.redraw_all(Editor_state)
    Editor_state.cursor1 = {line=1, pos=3}
  • replacement in source_edit.lua at line 435
    [3.158906][2.1974:2049](),[2.2049][3.159057:159087](),[3.7269][3.159057:159087](),[3.159057][3.159057:159087]()
    edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
    Text.search_next(State)
    [3.158906]
    [3.159087]
    if #State.search_term > 0 then
    edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
    Text.search_next(State)
    end
  • replacement in source_edit.lua at line 440
    [3.159117][3.159117:159151]()
    Text.search_previous(State)
    [3.159117]
    [3.159151]
    if #State.search_term > 0 then
    Text.search_previous(State)
    end
  • edit in search.lua at line 20
    [3.39]
    [12.721]
    assert(#State.search_term > 0)
  • edit in search.lua at line 75
    [3.1072]
    [13.761]
    assert(#State.search_term > 0)
  • replacement in edit.lua at line 429
    [3.11621][2.2890:2965](),[2.2965][3.2118:2148](),[3.7537][3.2118:2148]()
    edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
    Text.search_next(State)
    [3.11621]
    [3.11680]
    if #State.search_term > 0 then
    edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
    Text.search_next(State)
    end
  • replacement in edit.lua at line 434
    [3.11710][3.2149:2183]()
    Text.search_previous(State)
    [3.11710]
    [3.11739]
    if #State.search_term > 0 then
    Text.search_previous(State)
    end