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
6464
     ! Detect terminal type once for consistent padding throughout
6565
     call get_environment_variable("TERM_PROGRAM", term_program)
6666
     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)
6868
     else if (index(term_program, "Apple_Terminal") > 0 .or. index(term_program, "iTerm") > 0) then
6969
         top_padding = 2  ! Terminal.app and iTerm2 need 2 lines
7070
     else
@@ -76,7 +76,8 @@ program fortress
7676
     call hide_cursor()  ! Hide cursor for cleaner display
7777
 
7878
     ! 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
8081
     flush(output_unit)
8182
 
8283
     ! Initialize selection array to false
@@ -127,10 +128,10 @@ program fortress
127128
                                      favorite_dirs, favorite_count, parent_is_favorite)
128129
 
129130
         ! 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
-        ! So: vis_h = rows - top_padding - 3
131
+        ! Layout: top_padding + header(2 lines) + vis_h + footer(1 line) + buffer = rows
132
+        ! Subtract 1 extra to prevent any scrolling: vis_h = rows - top_padding - 4
132133
         call get_term_size(rows, cols)
133
-        visible_height = rows - top_padding - 3
134
+        visible_height = rows - top_padding - 4
134135
 
135136
         ! Handle navigation signals from previous iteration
136137
         if (selected == -1) then
@@ -179,8 +180,9 @@ program fortress
179180
             parent_scroll_offset = max(0, min(parent_scroll_offset, max(0, parent_count - visible_height)))
180181
         end if
181182
 
182
-        ! Draw - use CLEAR which does move home + clear in one operation
183
-        write(output_unit, '(a)', advance='no') CLEAR
183
+        ! Draw - position at 1,1 then clear from cursor to end (prevents scrollback)
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
184186
         flush(output_unit)
185187
         call draw_interface(rows, cols, top_padding, current_dir, current_files, current_is_dir, current_is_exec, &
186188
                            current_is_staged, current_is_unstaged, current_is_untracked, current_has_incoming, &
src/ui/display.f90modified
@@ -42,11 +42,11 @@ contains
4242
         character(len=20) :: color_code
4343
 
4444
         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
4646
 
4747
         ! Add blank lines at top as padding for terminals that need it
4848
         do i = 1, top_padding
49
-            write(output_unit, '(a)') ""
49
+            write(output_unit, '()')  ! Write blank line with explicit format
5050
         end do
5151
 
5252
         ! Header - Line 1: Always show path
@@ -78,8 +78,8 @@ contains
7878
             ! Show git repo info when no other status
7979
             write(output_unit, '(a)') DIM // trim(repo_name) // ":" // trim(branch_name) // RESET
8080
         else
81
-            ! Empty status line to maintain consistent spacing - write a space not empty string
82
-            write(output_unit, '(a)') " "
81
+            ! Empty status line to maintain consistent 2-line header
82
+            write(output_unit, '()')
8383
         end if
8484
 
8585
         ! Files (render based on scroll offsets)
@@ -231,7 +231,7 @@ contains
231231
             write(output_unit, '(a)') DIM // "↑↓:next/prev dir →:enter dir ←:parent ~:home /:root v:move here q:cancel" // RESET
232232
         else if (selection_count > 0) then
233233
             ! 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 // &
235235
                                      DIM // "→:enter ←:back ~:home /:root c:cd q:quit" // RESET
236236
         else if (in_git_repo) then
237237
             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