fortrangoingonforty/fortress / bbb26d1

Browse files

updates, ctrl-d to deseect

Authored by espadonne
SHA
bbb26d184f5d9052c4b108efd2d56fee8382b138
Parents
827121f
Tree
ae1d05c

3 changed files

StatusFile+-
A .SRCINFO.template 23 0
M app/main.f90 9 7
M src/ui/display.f90 5 5
.SRCINFO.templateadded
@@ -0,0 +1,23 @@
1
+# This is a TEMPLATE for .SRCINFO
2
+# The actual .SRCINFO must be generated on Linux with:
3
+#   makepkg --printsrcinfo > .SRCINFO
4
+#
5
+# This file is for reference only and should NOT be committed to AUR.
6
+
7
+pkgbase = fortress
8
+	pkgdesc = A command-line file explorer written in modern Fortran with cd-on-exit
9
+	pkgver = 0.1.0
10
+	pkgrel = 1
11
+	url = https://github.com/FortranGoingOnForty/fortress
12
+	install = fortress.install
13
+	arch = x86_64
14
+	arch = aarch64
15
+	license = MIT
16
+	makedepends = fpm
17
+	makedepends = gcc-fortran
18
+	depends = glibc
19
+	depends = gcc-libs
20
+	source = fortress-0.1.0.tar.gz::https://github.com/FortranGoingOnForty/fortress/archive/v0.1.0.tar.gz
21
+	sha256sums = SKIP
22
+
23
+pkgname = fortress
app/main.f90modified
@@ -64,7 +64,7 @@ program fortress
64
     ! Detect terminal type once for consistent padding throughout
64
     ! Detect terminal type once for consistent padding throughout
65
     call get_environment_variable("TERM_PROGRAM", term_program)
65
     call get_environment_variable("TERM_PROGRAM", term_program)
66
     if (index(term_program, "WezTerm") > 0 .or. index(term_program, "ghostty") > 0) then
66
     if (index(term_program, "WezTerm") > 0 .or. index(term_program, "ghostty") > 0) then
67
-        top_padding = 2  ! WezTerm/Ghostty need 2 lines to prevent top cutoff
67
+        top_padding = 1  ! WezTerm/Ghostty: 1 line padding (minimal but keeps FORTRESS visible)
68
     else if (index(term_program, "Apple_Terminal") > 0 .or. index(term_program, "iTerm") > 0) then
68
     else if (index(term_program, "Apple_Terminal") > 0 .or. index(term_program, "iTerm") > 0) then
69
         top_padding = 2  ! Terminal.app and iTerm2 need 2 lines
69
         top_padding = 2  ! Terminal.app and iTerm2 need 2 lines
70
     else
70
     else
@@ -76,7 +76,8 @@ program fortress
76
     call hide_cursor()  ! Hide cursor for cleaner display
76
     call hide_cursor()  ! Hide cursor for cleaner display
77
 
77
 
78
     ! Clear screen and position at home
78
     ! Clear screen and position at home
79
-    write(output_unit, '(a)', advance='no') CLEAR
79
+    write(output_unit, '(a)', advance='no') ESC // "[H"   ! Move to home (1,1)
80
+    write(output_unit, '(a)', advance='no') ESC // "[J"   ! Clear from cursor to end
80
     flush(output_unit)
81
     flush(output_unit)
81
 
82
 
82
     ! Initialize selection array to false
83
     ! Initialize selection array to false
@@ -127,10 +128,10 @@ program fortress
127
                                      favorite_dirs, favorite_count, parent_is_favorite)
128
                                      favorite_dirs, favorite_count, parent_is_favorite)
128
 
129
 
129
         ! Get terminal size and calculate visible height accounting for padding and 2-line header
130
         ! Get terminal size and calculate visible height accounting for padding and 2-line header
130
-        ! Layout: top_padding + header(2 lines) + vis_h + footer(1 line) = rows
131
+        ! Layout: top_padding + header(2 lines) + vis_h + footer(1 line) + buffer = rows
131
-        ! So: vis_h = rows - top_padding - 3
132
+        ! Subtract 1 extra to prevent any scrolling: vis_h = rows - top_padding - 4
132
         call get_term_size(rows, cols)
133
         call get_term_size(rows, cols)
133
-        visible_height = rows - top_padding - 3
134
+        visible_height = rows - top_padding - 4
134
 
135
 
135
         ! Handle navigation signals from previous iteration
136
         ! Handle navigation signals from previous iteration
136
         if (selected == -1) then
137
         if (selected == -1) then
@@ -179,8 +180,9 @@ program fortress
179
             parent_scroll_offset = max(0, min(parent_scroll_offset, max(0, parent_count - visible_height)))
180
             parent_scroll_offset = max(0, min(parent_scroll_offset, max(0, parent_count - visible_height)))
180
         end if
181
         end if
181
 
182
 
182
-        ! Draw - use CLEAR which does move home + clear in one operation
183
+        ! Draw - position at 1,1 then clear from cursor to end (prevents scrollback)
183
-        write(output_unit, '(a)', advance='no') CLEAR
184
+        write(output_unit, '(a)', advance='no') ESC // "[H"   ! Move to home (1,1)
185
+        write(output_unit, '(a)', advance='no') ESC // "[J"   ! Clear from cursor to end of screen
184
         flush(output_unit)
186
         flush(output_unit)
185
         call draw_interface(rows, cols, top_padding, current_dir, current_files, current_is_dir, current_is_exec, &
187
         call draw_interface(rows, cols, top_padding, current_dir, current_files, current_is_dir, current_is_exec, &
186
                            current_is_staged, current_is_unstaged, current_is_untracked, current_has_incoming, &
188
                            current_is_staged, current_is_unstaged, current_is_untracked, current_has_incoming, &
src/ui/display.f90modified
@@ -42,11 +42,11 @@ contains
42
         character(len=20) :: color_code
42
         character(len=20) :: color_code
43
 
43
 
44
         left_w = c * 3 / 10
44
         left_w = c * 3 / 10
45
-        vis_h = r - top_padding - 3  ! Visible height: rows - (top_padding + header(2) + footer(1))
45
+        vis_h = r - top_padding - 4  ! Visible height with buffer to prevent scrolling
46
 
46
 
47
         ! Add blank lines at top as padding for terminals that need it
47
         ! Add blank lines at top as padding for terminals that need it
48
         do i = 1, top_padding
48
         do i = 1, top_padding
49
-            write(output_unit, '(a)') ""
49
+            write(output_unit, '()')  ! Write blank line with explicit format
50
         end do
50
         end do
51
 
51
 
52
         ! Header - Line 1: Always show path
52
         ! Header - Line 1: Always show path
@@ -78,8 +78,8 @@ contains
78
             ! Show git repo info when no other status
78
             ! Show git repo info when no other status
79
             write(output_unit, '(a)') DIM // trim(repo_name) // ":" // trim(branch_name) // RESET
79
             write(output_unit, '(a)') DIM // trim(repo_name) // ":" // trim(branch_name) // RESET
80
         else
80
         else
81
-            ! Empty status line to maintain consistent spacing - write a space not empty string
81
+            ! Empty status line to maintain consistent 2-line header
82
-            write(output_unit, '(a)') " "
82
+            write(output_unit, '()')
83
         end if
83
         end if
84
 
84
 
85
         ! Files (render based on scroll offsets)
85
         ! Files (render based on scroll offsets)
@@ -231,7 +231,7 @@ contains
231
             write(output_unit, '(a)') DIM // "↑↓:next/prev dir →:enter dir ←:parent ~:home /:root v:move here q:cancel" // RESET
231
             write(output_unit, '(a)') DIM // "↑↓:next/prev dir →:enter dir ←:parent ~:home /:root v:move here q:cancel" // RESET
232
         else if (selection_count > 0) then
232
         else if (selection_count > 0) then
233
             ! Selection mode footer - show multi-select help
233
             ! Selection mode footer - show multi-select help
234
-            write(output_unit, '(a)') DIM // "ESC:exit Space:toggle Shift+↑↓:block y:copy x:cut p:paste r:delete | " // RESET // &
234
+            write(output_unit, '(a)') DIM // "Ctrl-D:deselect Space:toggle Shift+↑↓:block y:copy x:cut p:paste r:delete | " // RESET // &
235
                                      DIM // "→:enter ←:back ~:home /:root c:cd q:quit" // RESET
235
                                      DIM // "→:enter ←:back ~:home /:root c:cd q:quit" // RESET
236
         else if (in_git_repo) then
236
         else if (in_git_repo) then
237
             write(output_unit, '(a)') DIM // "Space:select Shift+↑↓:block | ↑↓:nav →:enter ←:back ~:home /:root s:search 8:favorites *:star o:open n:rename r:remove v:move y:copy x:cut p:paste .:hidden a:add u:unstage m:commit d:diff f:fetch l:pull h:push c:cd q:quit" // RESET
237
             write(output_unit, '(a)') DIM // "Space:select Shift+↑↓:block | ↑↓:nav →:enter ←:back ~:home /:root s:search 8:favorites *:star o:open n:rename r:remove v:move y:copy x:cut p:paste .:hidden a:add u:unstage m:commit d:diff f:fetch l:pull h:push c:cd q:quit" // RESET