fortrangoingonforty/fuss / a3813f4

Browse files

Update some git agnostic binds to be up front

Authored by espadonne
SHA
a3813f4f0492dc93a648b6ff17006af0c9fc4411
Parents
afbecfa
Tree
9126982

2 changed files

StatusFile+-
M src/display_module.f90 2 2
M src/fuss_main.f90 24 6
src/display_module.f90modified
@@ -183,14 +183,14 @@ contains
183183
                          achar(27) // '[31m✗' // achar(27) // '[0m=modified ' // &
184184
                          achar(27) // '[90m✗' // achar(27) // '[0m=untracked ' // &
185185
                          achar(27) // '[34m↓' // achar(27) // '[0m=incoming' // achar(27) // '[0m'
186
-            print '(A)', achar(27) // '[33mKeys: j/k/↑/↓:nav | ←/→:nav tree | space:toggle | .:hide-dots | a:stage | u:unstage | S:stage-all | U:unstage-all | x:discard | z:stash | Z:unstash | b:switch | n:new-br | R:del-br | G:merge | O:reset | I:rebase | f:fetch | d:diff | c:view | w:blame | h:history | L:reflog | y:cherry-pick | v:revert | r:delete | l:pull | m:commit | M:amend | p:push | t:tag | s:status | q:exit-mode | ESC:exit-mode | ctrl-c:quit' // achar(27) // '[0m'
186
+            print '(A)', achar(27) // '[33mKeys: j/k/↑/↓:nav | ←/→:nav tree | space:toggle | .:hide-dots | a:stage | u:unstage | S:stage-all | U:unstage-all | x:discard | z:stash | Z:unstash | b:switch | n:new-br | R:del-br | G:merge | O:reset | I:rebase | f:fetch | d:diff | c/alt-v:view | w:blame | h:history | L:reflog | y:cherry-pick | v:revert | r:delete | l:pull | m:commit | M:amend | p:push | t:tag | s/alt-s:status | q:exit-mode | ESC:exit-mode | ctrl-c:quit' // achar(27) // '[0m'
187187
         else
188188
             ! Normal mode help
189189
             print '(A)', 'Legend: ' // achar(27) // '[32m↑' // achar(27) // '[0m=staged ' // &
190190
                          achar(27) // '[31m✗' // achar(27) // '[0m=modified ' // &
191191
                          achar(27) // '[90m✗' // achar(27) // '[0m=untracked ' // &
192192
                          achar(27) // '[34m↓' // achar(27) // '[0m=incoming'
193
-            print '(A)', 'Keys: j/k/↑/↓:nav | ←/→:nav tree | space:toggle | .:hide-dots | alt-g:git-mode | ctrl-c:quit'
193
+            print '(A)', 'Keys: j/k/↑/↓:nav | ←/→:nav tree | space:toggle | .:hide-dots | alt-v:view | alt-s:status | alt-g:git-mode | ctrl-c:quit'
194194
         end if
195195
 
196196
         ! Don't free tree - it's owned by interactive_mode
src/fuss_main.f90modified
@@ -349,6 +349,24 @@ contains
349349
                 cycle  ! Skip rest of key handling
350350
             end if
351351
 
352
+            ! Check for alt-s to show git status (available in both modes)
353
+            ! alt-s is encoded as achar(1 + ichar('s') - ichar('a')) = achar(19)
354
+            if (key == achar(19)) then
355
+                call show_status_view()
356
+                needs_full_redraw = .true.
357
+                cycle
358
+            end if
359
+
360
+            ! Check for alt-v to view file (available in both modes)
361
+            ! alt-v is encoded as achar(1 + ichar('v') - ichar('a')) = achar(22)
362
+            if (key == achar(22)) then
363
+                if (items(selected)%is_file) then
364
+                    call view_file(items(selected)%path)
365
+                    needs_full_redraw = .true.
366
+                end if
367
+                cycle
368
+            end if
369
+
352370
             ! Handle ESC key - exit git mode or clear search
353371
             if (key == achar(27)) then
354372
                 if (mode == 'git') then
@@ -529,11 +547,6 @@ contains
529547
                                             hide_dotfiles, selected, running, force_refresh=.true.)
530548
                         needs_full_redraw = .true.
531549
                 end if
532
-            case ('s')  ! Show git status (lowercase)
533
-                if (mode == 'git') then
534
-                    call show_status_view()
535
-                    needs_full_redraw = .true.
536
-                end if
537550
             case ('p')  ! Push (lowercase)
538551
                 if (mode == 'git') then
539552
                     call push_prompt()
@@ -586,11 +599,16 @@ contains
586599
                     call git_diff_file(items(selected)%path, items(selected)%has_incoming)
587600
                     needs_full_redraw = .true.
588601
                 end if
589
-            case ('c')  ! View file contents (cat/bat/less)
602
+            case ('c')  ! View file contents (git mode shortcut; use alt-v in normal mode)
590603
                 if (mode == 'git' .and. items(selected)%is_file) then
591604
                     call view_file(items(selected)%path)
592605
                     needs_full_redraw = .true.
593606
                 end if
607
+            case ('s')  ! Show git status (git mode shortcut; use alt-s in normal mode)
608
+                if (mode == 'git') then
609
+                    call show_status_view()
610
+                    needs_full_redraw = .true.
611
+                end if
594612
             case ('w')  ! Git blame (who changed this line)
595613
                 if (mode == 'git' .and. items(selected)%is_file) then
596614
                     call blame_prompt(items(selected)%path)