fortrangoingonforty/facsimile / bdabc52

Browse files

oh god. i didn't think i touched this much shit. ummm fixes? no. platform things, linux build things yes!

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
bdabc524a465117a6db71b17002d8d11b4c8a74c
Parents
8703688
Tree
82dda0d

11 changed files

StatusFile+-
M src/commands/command_handler_module.f90 24 28
M src/fortress/fortress_navigator_module.f90 6 7
M src/fortress/ui/fortress_display_module.f90 2 2
M src/fortress/ui/welcome_menu_module.f90 4 4
M src/terminal/input_handler_module.f90 1 0
M src/terminal/renderer_module.f90 4 6
M src/ui/save_prompt_module.f90 1 1
M src/ui/unified_search_module.f90 1 7
M src/workspace/backup_module.f90 7 7
M src/workspace/config_module.f90 0 1
M src/workspace/workspace_module.f90 4 4
src/commands/command_handler_module.f90modified
@@ -213,12 +213,12 @@ contains
213213
             if (size(editor%cursors) > 1) then
214214
                 ! Move all cursors
215215
                 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)
217217
                 end do
218218
                 ! Remove duplicate cursors that ended up at same position
219219
                 call deduplicate_cursors(editor)
220220
             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)
222222
             end if
223223
             call sync_editor_to_pane(editor)
224224
             call update_viewport(editor)
@@ -985,10 +985,9 @@ contains
985985
         last_action_was_edit = is_edit_action
986986
     end subroutine handle_key_command
987987
 
988
-    subroutine move_cursor_up(cursor, buffer, line_count)
988
+    subroutine move_cursor_up(cursor, buffer)
989989
         type(cursor_t), intent(inout) :: cursor
990990
         type(buffer_t), intent(in) :: buffer
991
-        integer, intent(in) :: line_count
992991
         character(len=:), allocatable :: current_line, target_line
993992
 
994993
         cursor%has_selection = .false.  ! Clear selection
@@ -3026,11 +3025,6 @@ contains
30263025
         found_col = 0
30273026
         line_count = buffer_get_line_count(buffer)
30283027
 
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
-
30343028
         ! Search from current position to end
30353029
         do current_line = start_line, line_count
30363030
             line = buffer_get_line(buffer, current_line)
@@ -3046,6 +3040,7 @@ contains
30463040
                 pos = index(line(search_col:), pattern)
30473041
             else
30483042
                 search_line = to_lower(line(search_col:))
3043
+                search_pattern = to_lower(pattern)
30493044
                 pos = index(search_line, search_pattern)
30503045
                 if (allocated(search_line)) deallocate(search_line)
30513046
             end if
@@ -3072,6 +3067,7 @@ contains
30723067
                         pos = index(line(1:start_col-1), pattern)
30733068
                     else
30743069
                         search_line = to_lower(line(1:start_col-1))
3070
+                        search_pattern = to_lower(pattern)
30753071
                         pos = index(search_line, search_pattern)
30763072
                         if (allocated(search_line)) deallocate(search_line)
30773073
                     end if
@@ -3083,6 +3079,7 @@ contains
30833079
                     pos = index(line, pattern)
30843080
                 else
30853081
                     search_line = to_lower(line)
3082
+                    search_pattern = to_lower(pattern)
30863083
                     pos = index(search_line, search_pattern)
30873084
                     if (allocated(search_line)) deallocate(search_line)
30883085
                 end if
@@ -3867,22 +3864,22 @@ contains
38673864
         end if
38683865
     end subroutine delete_range
38693866
 
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
38863883
 
38873884
     ! Handle input when in fuss mode
38883885
     subroutine handle_fuss_input(key_str, editor, buffer)
@@ -4597,7 +4594,7 @@ contains
45974594
 
45984595
                     ! Check for dirty buffers and prompt to save
45994596
                     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)
46014598
                     end if
46024599
 
46034600
                     ! If user didn't cancel, perform the switch
@@ -4627,11 +4624,10 @@ contains
46274624
     end subroutine handle_fortress_navigator
46284625
 
46294626
     !> 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)
46314628
         use save_prompt_module, only: save_prompt, save_prompt_result_t
46324629
         use text_buffer_module, only: buffer_save_file
46334630
         type(editor_state_t), intent(inout) :: editor
4634
-        type(buffer_t), intent(inout) :: buffer
46354631
         logical, intent(inout) :: should_continue
46364632
         type(save_prompt_result_t) :: prompt_result
46374633
         integer :: i, save_status
src/fortress/fortress_navigator_module.f90modified
@@ -100,7 +100,7 @@ contains
100100
             if (need_redraw) then
101101
                 call draw_fortress_interface(rows, cols, current_dir, &
102102
                                              current_files, current_is_dir, current_is_exec, current_count, &
103
-                                             parent_files, parent_is_dir, parent_is_exec, parent_count, &
103
+                                             parent_files, parent_is_dir, parent_count, &
104104
                                              selected, parent_selected, scroll_offset, parent_scroll_offset, first_draw)
105105
 
106106
                 ! Update tracking variables
@@ -125,7 +125,7 @@ contains
125125
                     ! Check if arrow key or standalone ESC
126126
                     if (check_arrow_key(key)) then
127127
                         call handle_arrow_key(key, selected, current_dir, temp_dir, current_files, &
128
-                                             current_is_dir, current_count, parent_selected, rows - 4, running)
128
+                                             current_is_dir, current_count)
129129
                     else
130130
                         ! Standalone ESC - quit
131131
                         cancelled = .true.
@@ -181,7 +181,7 @@ contains
181181
     subroutine adjust_scroll(sel, offset, visible_height)
182182
         integer, intent(in) :: sel, visible_height
183183
         integer, intent(inout) :: offset
184
-        integer :: margin, center_pos
184
+        integer :: margin
185185
 
186186
         ! Add a margin to avoid selection being at the very edge
187187
         margin = 3
@@ -225,14 +225,13 @@ contains
225225
     end function check_arrow_key
226226
 
227227
     !> Handle arrow key navigation
228
-    subroutine handle_arrow_key(key, sel, curr_dir, temp_dir, files, is_dir, file_count, par_sel, vis_h, running)
228
+    subroutine handle_arrow_key(key, sel, curr_dir, temp_dir, files, is_dir, file_count)
229229
         character(len=1), intent(in) :: key
230
-        integer, intent(inout) :: sel, par_sel
230
+        integer, intent(inout) :: sel
231231
         character(len=MAX_PATH), intent(inout) :: curr_dir, temp_dir
232232
         character(len=*), dimension(*), intent(in) :: files
233233
         logical, dimension(*), intent(in) :: is_dir
234
-        integer, intent(in) :: file_count, vis_h
235
-        logical, intent(inout) :: running
234
+        integer, intent(in) :: file_count
236235
 
237236
         select case (key)
238237
             case ('A')  ! Up arrow
src/fortress/ui/fortress_display_module.f90modified
@@ -22,14 +22,14 @@ module fortress_display_module
2222
 contains
2323
 
2424
     subroutine draw_fortress_interface(r, c, current_dir, current_files, current_is_dir, current_is_exec, &
25
-                                       current_count, parent_files, parent_is_dir, parent_is_exec, parent_count, &
25
+                                       current_count, parent_files, parent_is_dir, parent_count, &
2626
                                        selected, parent_selected, scroll_offset, parent_scroll_offset, first_draw)
2727
         integer, intent(in) :: r, c, current_count, parent_count, selected, parent_selected
2828
         integer, intent(in) :: scroll_offset, parent_scroll_offset
2929
         character(len=*), intent(in) :: current_dir
3030
         character(len=*), dimension(*), intent(in) :: current_files, parent_files
3131
         logical, dimension(*), intent(in) :: current_is_dir, parent_is_dir
32
-        logical, dimension(*), intent(in) :: current_is_exec, parent_is_exec
32
+        logical, dimension(*), intent(in) :: current_is_exec
3333
         logical, intent(in), optional :: first_draw
3434
         integer :: left_w, i, j, parent_idx, current_idx, vis_h
3535
         character(len=256) :: parent_name, current_name
src/fortress/ui/welcome_menu_module.f90modified
@@ -47,7 +47,7 @@ contains
4747
         do
4848
             ! Render menu
4949
             call render_welcome_menu(favorites, fav_count, recents, rec_count, &
50
-                showing_favorites, selected_index, scroll_offset, rows, cols)
50
+                showing_favorites, selected_index, scroll_offset, rows)
5151
 
5252
             ! Get input
5353
             call get_key_input(key_input, status)
@@ -139,12 +139,12 @@ contains
139139
 
140140
     !> Render the welcome menu
141141
     subroutine render_welcome_menu(favorites, fav_count, recents, rec_count, &
142
-                                   showing_favorites, selected_index, scroll_offset, rows, cols)
142
+                                   showing_favorites, selected_index, scroll_offset, rows)
143143
         type(favorite_t), intent(in) :: favorites(:)
144144
         type(recent_t), intent(in) :: recents(:)
145145
         integer, intent(in) :: fav_count, rec_count
146146
         logical, intent(in) :: showing_favorites
147
-        integer, intent(in) :: selected_index, scroll_offset, rows, cols
147
+        integer, intent(in) :: selected_index, scroll_offset, rows
148148
         character(len=512) :: line
149149
         integer :: i, display_row, visible_height, item_count
150150
         character(len=64) :: title
@@ -262,7 +262,7 @@ contains
262262
     function directory_exists(path) result(exists)
263263
         character(len=*), intent(in) :: path
264264
         logical :: exists
265
-        integer :: unit, ios
265
+        integer :: ios
266266
 
267267
         ! Try to open directory (will fail if doesn't exist)
268268
         call execute_command_line('test -d "' // trim(path) // '"', wait=.true., exitstat=ios)
src/terminal/input_handler_module.f90modified
@@ -555,6 +555,7 @@ contains
555555
 
556556
         buffer = ''
557557
         i = 1
558
+        is_release = .false.
558559
 
559560
         ! Read until 'M' (press) or 'm' (release)
560561
         do
src/terminal/renderer_module.f90modified
@@ -130,7 +130,7 @@ contains
130130
         if (size(editor%tabs) > 0 .and. editor%active_tab_index > 0 .and. &
131131
             editor%active_tab_index <= size(editor%tabs)) then
132132
             if (allocated(editor%tabs(editor%active_tab_index)%panes)) then
133
-                call render_all_panes(buffer, editor)
133
+                call render_all_panes(editor)
134134
                 ! Render status bar after panes
135135
                 call render_status_bar(editor, buffer, match_mode_active, match_case_sens)
136136
                 ! Position cursor for panes
@@ -673,7 +673,7 @@ contains
673673
         call render_vertical_separator(separator_col, 2, editor%screen_rows - 1)
674674
 
675675
         ! Render editor in right pane (check for multiple panes)
676
-        call render_editor_area_with_tree(buffer, editor, editor_start_col, editor_width)
676
+        call render_editor_area_with_tree(editor, editor_start_col, editor_width)
677677
 
678678
         ! Render status bar (full width)
679679
         call render_status_bar(editor, buffer, match_mode_active, match_case_sens)
@@ -700,9 +700,8 @@ contains
700700
         end do
701701
     end subroutine render_vertical_separator
702702
 
703
-    subroutine render_editor_area_with_tree(buffer, editor, start_col, width)
703
+    subroutine render_editor_area_with_tree(editor, start_col, width)
704704
         use editor_state_module, only: pane_t
705
-        type(buffer_t), intent(in) :: buffer
706705
         type(editor_state_t), intent(inout) :: editor
707706
         integer, intent(in) :: start_col, width
708707
         type(pane_t) :: pane
@@ -834,9 +833,8 @@ contains
834833
         end do
835834
     end subroutine render_editor_pane
836835
 
837
-    subroutine render_all_panes(buffer, editor)
836
+    subroutine render_all_panes(editor)
838837
         use editor_state_module, only: pane_t
839
-        type(buffer_t), intent(in) :: buffer
840838
         type(editor_state_t), intent(inout) :: editor
841839
         type(pane_t) :: pane
842840
         integer :: i, tab_idx, n_panes, active_pane_idx
src/ui/save_prompt_module.f90modified
@@ -21,7 +21,7 @@ contains
2121
         character(len=*), intent(in) :: filename
2222
         type(save_prompt_result_t), intent(out) :: result
2323
         integer, intent(in), optional :: current_index, total_count
24
-        character(len=512) :: prompt_text, basename, progress_text
24
+        character(len=512) :: prompt_text, basename
2525
         character(len=32) :: key_input
2626
         integer :: status, i, slash_pos
2727
         logical :: show_all_option
src/ui/unified_search_module.f90modified
@@ -51,10 +51,7 @@ contains
5151
         character(len=256) :: find_buffer, replace_buffer
5252
         character(len=256) :: prompt
5353
         integer :: find_pos, replace_pos, ch
54
-        logical :: found, in_alt_sequence
55
-        integer :: found_line, found_col
56
-        logical :: use_pane_buf
57
-        integer :: tab_i, pane_i
54
+        logical :: in_alt_sequence
5855
 
5956
         ! Initialize
6057
         find_buffer = ''
@@ -364,7 +361,6 @@ contains
364361
         character(len=*), intent(in) :: pattern
365362
         logical :: found
366363
         integer :: found_line, found_col
367
-        character(len=256) :: debug_msg
368364
 
369365
         ! Compile regex if in regex mode
370366
         if (use_regex) then
@@ -482,8 +478,6 @@ contains
482478
         type(editor_state_t), intent(inout) :: editor
483479
         type(buffer_t), intent(inout) :: buffer
484480
         integer :: match_len
485
-        character(len=256) :: debug_msg
486
-        character(len=:), allocatable :: line
487481
         integer :: tab_i, pane_i
488482
 
489483
         if (.not. allocated(current_search_pattern)) return
src/workspace/backup_module.f90modified
@@ -27,7 +27,7 @@ contains
2727
         logical, intent(out) :: success
2828
         character(len=MAX_PATH_LEN) :: backup_dir, backup_file, basename
2929
         character(len=MAX_PATH_LEN) :: src_file, timestamp_str
30
-        integer :: unit_src, unit_dst, ios, slash_pos, i
30
+        integer :: unit_src, unit_dst, ios, i
3131
         character(len=1024) :: line
3232
 
3333
         success = .false.
@@ -99,7 +99,7 @@ contains
9999
         type(backup_info_t), allocatable, intent(out) :: backups(:)
100100
         integer, intent(out) :: count
101101
         character(len=MAX_PATH_LEN) :: metadata_file, line
102
-        integer :: unit, ios, i
102
+        integer :: unit, ios
103103
 
104104
         count = 0
105105
         allocate(backups(MAX_BACKUPS))
@@ -125,8 +125,8 @@ contains
125125
     end subroutine backup_list
126126
 
127127
     !> Restore a backup file
128
-    subroutine backup_restore(workspace_path, backup_file, original_file, success)
129
-        character(len=*), intent(in) :: workspace_path, backup_file, original_file
128
+    subroutine backup_restore(backup_file, original_file, success)
129
+        character(len=*), intent(in) :: backup_file, original_file
130130
         logical, intent(out) :: success
131131
         integer :: unit_src, unit_dst, ios
132132
         character(len=1024) :: line
@@ -155,13 +155,13 @@ contains
155155
         close(unit_dst)
156156
 
157157
         ! Delete the backup after successful restore
158
-        call backup_delete(workspace_path, backup_file)
158
+        call backup_delete(backup_file)
159159
         success = .true.
160160
     end subroutine backup_restore
161161
 
162162
     !> Delete a backup file
163
-    subroutine backup_delete(workspace_path, backup_file)
164
-        character(len=*), intent(in) :: workspace_path, backup_file
163
+    subroutine backup_delete(backup_file)
164
+        character(len=*), intent(in) :: backup_file
165165
         integer :: unit, ios
166166
 
167167
         ! Delete using Fortran file operations (avoids execute_command_line issues)
src/workspace/config_module.f90modified
@@ -18,7 +18,6 @@ contains
1818
         character(len=:), allocatable, intent(out) :: config_path
1919
         character(len=MAX_PATH_LEN) :: home_dir, xdg_config_home
2020
         integer :: unit, ios
21
-        logical :: xdg_exists
2221
 
2322
         ! Try XDG_CONFIG_HOME environment variable
2423
         call get_environment_variable('XDG_CONFIG_HOME', xdg_config_home)
src/workspace/workspace_module.f90modified
@@ -11,10 +11,10 @@ module workspace_module
1111
 
1212
     ! Interface to C getpid function
1313
     interface
14
-        function getpid() bind(c, name="getpid")
14
+        function c_getpid() bind(c, name="getpid")
1515
             use iso_c_binding, only: c_int
16
-            integer(c_int) :: getpid
17
-        end function getpid
16
+            integer(c_int) :: c_getpid
17
+        end function c_getpid
1818
     end interface
1919
 
2020
     public :: workspace_exists, workspace_init, workspace_load, workspace_save
@@ -89,7 +89,7 @@ contains
8989
         integer :: unit, ios, pid
9090
 
9191
         ! Get process ID for unique temp file (avoid race conditions)
92
-        pid = getpid()
92
+        pid = c_getpid()
9393
         write(pid_str, '(I0)') pid
9494
         temp_file = '/tmp/.fac_realpath_' // trim(pid_str)
9595