@@ -213,12 +213,12 @@ contains |
| 213 | 213 | if (size(editor%cursors) > 1) then |
| 214 | 214 | ! Move all cursors |
| 215 | 215 | do i = 1, size(editor%cursors) |
| 216 | | - call move_cursor_up(editor%cursors(i), buffer, line_count) |
| 216 | + call move_cursor_up(editor%cursors(i), buffer) |
| 217 | 217 | end do |
| 218 | 218 | ! Remove duplicate cursors that ended up at same position |
| 219 | 219 | call deduplicate_cursors(editor) |
| 220 | 220 | else |
| 221 | | - call move_cursor_up(editor%cursors(editor%active_cursor), buffer, line_count) |
| 221 | + call move_cursor_up(editor%cursors(editor%active_cursor), buffer) |
| 222 | 222 | end if |
| 223 | 223 | call sync_editor_to_pane(editor) |
| 224 | 224 | call update_viewport(editor) |
@@ -985,10 +985,9 @@ contains |
| 985 | 985 | last_action_was_edit = is_edit_action |
| 986 | 986 | end subroutine handle_key_command |
| 987 | 987 | |
| 988 | | - subroutine move_cursor_up(cursor, buffer, line_count) |
| 988 | + subroutine move_cursor_up(cursor, buffer) |
| 989 | 989 | type(cursor_t), intent(inout) :: cursor |
| 990 | 990 | type(buffer_t), intent(in) :: buffer |
| 991 | | - integer, intent(in) :: line_count |
| 992 | 991 | character(len=:), allocatable :: current_line, target_line |
| 993 | 992 | |
| 994 | 993 | cursor%has_selection = .false. ! Clear selection |
@@ -3026,11 +3025,6 @@ contains |
| 3026 | 3025 | found_col = 0 |
| 3027 | 3026 | line_count = buffer_get_line_count(buffer) |
| 3028 | 3027 | |
| 3029 | | - ! Prepare pattern for case-insensitive search if needed |
| 3030 | | - if (.not. match_case_sensitive) then |
| 3031 | | - search_pattern = to_lower(pattern) |
| 3032 | | - end if |
| 3033 | | - |
| 3034 | 3028 | ! Search from current position to end |
| 3035 | 3029 | do current_line = start_line, line_count |
| 3036 | 3030 | line = buffer_get_line(buffer, current_line) |
@@ -3046,6 +3040,7 @@ contains |
| 3046 | 3040 | pos = index(line(search_col:), pattern) |
| 3047 | 3041 | else |
| 3048 | 3042 | search_line = to_lower(line(search_col:)) |
| 3043 | + search_pattern = to_lower(pattern) |
| 3049 | 3044 | pos = index(search_line, search_pattern) |
| 3050 | 3045 | if (allocated(search_line)) deallocate(search_line) |
| 3051 | 3046 | end if |
@@ -3072,6 +3067,7 @@ contains |
| 3072 | 3067 | pos = index(line(1:start_col-1), pattern) |
| 3073 | 3068 | else |
| 3074 | 3069 | search_line = to_lower(line(1:start_col-1)) |
| 3070 | + search_pattern = to_lower(pattern) |
| 3075 | 3071 | pos = index(search_line, search_pattern) |
| 3076 | 3072 | if (allocated(search_line)) deallocate(search_line) |
| 3077 | 3073 | end if |
@@ -3083,6 +3079,7 @@ contains |
| 3083 | 3079 | pos = index(line, pattern) |
| 3084 | 3080 | else |
| 3085 | 3081 | search_line = to_lower(line) |
| 3082 | + search_pattern = to_lower(pattern) |
| 3086 | 3083 | pos = index(search_line, search_pattern) |
| 3087 | 3084 | if (allocated(search_line)) deallocate(search_line) |
| 3088 | 3085 | end if |
@@ -3867,22 +3864,22 @@ contains |
| 3867 | 3864 | end if |
| 3868 | 3865 | end subroutine delete_range |
| 3869 | 3866 | |
| 3870 | | - subroutine insert_char_at(buffer, line_num, col, ch) |
| 3871 | | - type(buffer_t), intent(inout) :: buffer |
| 3872 | | - integer, intent(in) :: line_num, col |
| 3873 | | - character, intent(in) :: ch |
| 3874 | | - integer :: pos |
| 3875 | | - |
| 3876 | | - ! Calculate buffer position |
| 3877 | | - pos = get_line_start_pos(buffer, line_num) + col - 1 |
| 3878 | | - |
| 3879 | | - ! Move gap to insertion point |
| 3880 | | - call buffer_move_gap(buffer, pos) |
| 3881 | | - |
| 3882 | | - ! Insert character |
| 3883 | | - buffer%data(buffer%gap_start:buffer%gap_start) = ch |
| 3884 | | - buffer%gap_start = buffer%gap_start + 1 |
| 3885 | | - end subroutine insert_char_at |
| 3867 | + ! UNUSED: subroutine insert_char_at(buffer, line_num, col, ch) |
| 3868 | + ! UNUSED: type(buffer_t), intent(inout) :: buffer |
| 3869 | + ! UNUSED: integer, intent(in) :: line_num, col |
| 3870 | + ! UNUSED: character, intent(in) :: ch |
| 3871 | + ! UNUSED: integer :: pos |
| 3872 | + ! UNUSED: |
| 3873 | + ! UNUSED: ! Calculate buffer position |
| 3874 | + ! UNUSED: pos = get_line_start_pos(buffer, line_num) + col - 1 |
| 3875 | + ! UNUSED: |
| 3876 | + ! UNUSED: ! Move gap to insertion point |
| 3877 | + ! UNUSED: call buffer_move_gap(buffer, pos) |
| 3878 | + ! UNUSED: |
| 3879 | + ! UNUSED: ! Insert character |
| 3880 | + ! UNUSED: buffer%data(buffer%gap_start:buffer%gap_start) = ch |
| 3881 | + ! UNUSED: buffer%gap_start = buffer%gap_start + 1 |
| 3882 | + ! UNUSED: end subroutine insert_char_at |
| 3886 | 3883 | |
| 3887 | 3884 | ! Handle input when in fuss mode |
| 3888 | 3885 | subroutine handle_fuss_input(key_str, editor, buffer) |
@@ -4597,7 +4594,7 @@ contains |
| 4597 | 4594 | |
| 4598 | 4595 | ! Check for dirty buffers and prompt to save |
| 4599 | 4596 | if (allocated(editor%tabs)) then |
| 4600 | | - call handle_dirty_buffers_before_switch(editor, buffer, should_switch) |
| 4597 | + call handle_dirty_buffers_before_switch(editor, should_switch) |
| 4601 | 4598 | end if |
| 4602 | 4599 | |
| 4603 | 4600 | ! If user didn't cancel, perform the switch |
@@ -4627,11 +4624,10 @@ contains |
| 4627 | 4624 | end subroutine handle_fortress_navigator |
| 4628 | 4625 | |
| 4629 | 4626 | !> Handle dirty buffers before workspace switch |
| 4630 | | - subroutine handle_dirty_buffers_before_switch(editor, buffer, should_continue) |
| 4627 | + subroutine handle_dirty_buffers_before_switch(editor, should_continue) |
| 4631 | 4628 | use save_prompt_module, only: save_prompt, save_prompt_result_t |
| 4632 | 4629 | use text_buffer_module, only: buffer_save_file |
| 4633 | 4630 | type(editor_state_t), intent(inout) :: editor |
| 4634 | | - type(buffer_t), intent(inout) :: buffer |
| 4635 | 4631 | logical, intent(inout) :: should_continue |
| 4636 | 4632 | type(save_prompt_result_t) :: prompt_result |
| 4637 | 4633 | integer :: i, save_status |