rtfm-filemanager 7.0.12 → 7.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -0
  3. data/bin/rtfm +31 -4
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c936aa089f19d7eab63bb507c4405e8ab06ff6edf4d10f29995f45b108b224f
4
- data.tar.gz: 16d500cab0353f09330b818af27b6930f8e71c433c11d19153336a2367bccaeb
3
+ metadata.gz: 21434141f1b12b20834d27fc396872713be1d4539633c94a5013b037cef98103
4
+ data.tar.gz: 5178581ecd9e29b53fea3d6fb0d21038902d26f187964a8ce743e4ecf93e749a
5
5
  SHA512:
6
- metadata.gz: 48d191cbc07c69e5d4bd293fc9e75ec6952d72c8da2e11e5ef9312072d055a137172e1b87e6088f8076dcefc5a6d24d2ff0966a5f1322c0ba15255b48a574d95
7
- data.tar.gz: 277886019de3d3502c7d5577117a46e7936f8f8faeea9615cefa4602175d7f0cfa43d17076f52416aac1df3f64352e9c67d69ea435dd1ddb7552ff2c9475778e
6
+ metadata.gz: d624adeb145e7b8f0e4e14806bf5c27e633384d7d61bee2982598421dec576613a6c7d900e2a19012139575b91c39df181ce83497253eb49acd9863257c5b5e1
7
+ data.tar.gz: 433791a3f9ac5d71961dd65071a3e1f38b18251a06a4f0857783c90ee8a37a47995a5bf7c9b81f3c38c2e798733a0a98926d0f8d50105f2b4ab096689e896f82
data/README.md CHANGED
@@ -574,6 +574,29 @@ def git_update
574
574
  @pB.full_refresh
575
575
  end
576
576
  ```
577
+ If you're launching external terminal programs (like editors or TUI applications) from your custom keys,
578
+ make sure to set `@external_program_running = true` before launching and `false` after it returns.
579
+ This prevents RTFM from redrawing over your program when switching terminals:
580
+ ```ruby
581
+ def custom_handler
582
+ if @selected&.end_with?('.ext')
583
+ @external_program_running = true # Prevent SIGWINCH interference
584
+ system('stty sane < /dev/tty')
585
+ system('clear < /dev/tty > /dev/tty')
586
+ Cursor.show
587
+ system("my_program #{Shellwords.escape(@selected)}")
588
+ @external_program_running = false # Re-enable SIGWINCH handling
589
+ # Restore terminal for RTFM
590
+ system('stty raw -echo isig < /dev/tty')
591
+ $stdin.raw!
592
+ $stdin.echo = false
593
+ Cursor.hide
594
+ Rcurses.clear_screen
595
+ refresh
596
+ render
597
+ end
598
+ end
599
+ ```
577
600
  ***With this, you can mold RTFM to fit your needs better.***
578
601
 
579
602
  When writing plugins, there are a few variables you should know:
@@ -589,6 +612,7 @@ Variable | Description
589
612
  @pAI | Pane for interacting with (Open)AI
590
613
  @pRuby | Ruby debug/command pane
591
614
  @selected | The selected item in the Left pane
615
+ @external_program_running | Set to true when launching terminal programs to prevent SIGWINCH from redrawing RTFM
592
616
 
593
617
  Here are three importan hook-ins to use with your plugins:
594
618
 
data/bin/rtfm CHANGED
@@ -494,6 +494,9 @@ end
494
494
  @last_focus_check = Time.now
495
495
  @focus_check_interval = 0.5 # Check focus every 500ms
496
496
 
497
+ # Track when external programs are running to prevent SIGWINCH interference
498
+ @external_program_running = false
499
+
497
500
  @bat = cmd?('bat') ? 'bat' : 'batcat'
498
501
 
499
502
  ## Set encoding for $stdin to utf-8 {{{2
@@ -2604,6 +2607,8 @@ def open_remote_shell # {{{3
2604
2607
  ssh_cmd = "ssh #{ssh_opts} #{ssh_target} -t 'cd #{Shellwords.escape(@remote_path)} 2>/dev/null || cd ~; exec bash -l'"
2605
2608
 
2606
2609
  # Use RTFM's interactive program pattern
2610
+ # Set flag to prevent SIGWINCH from refreshing during SSH session
2611
+ @external_program_running = true
2607
2612
  system("stty #{ORIG_STTY} < /dev/tty")
2608
2613
  system('clear < /dev/tty > /dev/tty')
2609
2614
  Cursor.show
@@ -2625,6 +2630,9 @@ def open_remote_shell # {{{3
2625
2630
  rescue Interrupt
2626
2631
  Process.kill('TERM', pid) rescue nil
2627
2632
  retry
2633
+ ensure
2634
+ # Clear flag when SSH session exits
2635
+ @external_program_running = false
2628
2636
  end
2629
2637
 
2630
2638
  # Restore RTFM's terminal state
@@ -4177,6 +4185,8 @@ def command_mode # {{{3
4177
4185
  end
4178
4186
  end
4179
4187
  if force || whitelist || magic # Decide interactive vs non-interactive
4188
+ # Set flag to prevent SIGWINCH from refreshing during interactive command
4189
+ @external_program_running = true
4180
4190
  # Restore shell tty so Ctrl-C/D work
4181
4191
  system("stty #{ORIG_STTY} < /dev/tty")
4182
4192
  # Clear to top-left
@@ -4192,6 +4202,9 @@ def command_mode # {{{3
4192
4202
  rescue Interrupt
4193
4203
  Process.kill('TERM', pid2) rescue nil
4194
4204
  retry
4205
+ ensure
4206
+ # Clear flag when command exits
4207
+ @external_program_running = false
4195
4208
  end
4196
4209
  # Restore raw/no-echo for RTFM
4197
4210
  system('stty raw -echo isig < /dev/tty')
@@ -5093,6 +5106,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5093
5106
  if !html && (prog = get_interactive_program(@selected))
5094
5107
  cmd = "#{prog} #{Shellwords.escape(@selected)}"
5095
5108
  # Use exactly the same logic as command_mode with § prefix (force interactive)
5109
+ # Set flag to prevent SIGWINCH from refreshing during external program
5110
+ @external_program_running = true
5096
5111
  # Restore shell tty so Ctrl-C/D work
5097
5112
  system("stty #{ORIG_STTY} < /dev/tty")
5098
5113
  # Reset terminal to sane/cooked mode for interactive programs
@@ -5110,6 +5125,9 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5110
5125
  rescue Interrupt
5111
5126
  Process.kill('TERM', pid) rescue nil
5112
5127
  retry
5128
+ ensure
5129
+ # Clear flag when program exits
5130
+ @external_program_running = false
5113
5131
  end
5114
5132
  # Restore raw/no-echo for RTFM
5115
5133
  system('stty raw -echo isig < /dev/tty')
@@ -5138,6 +5156,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5138
5156
  end
5139
5157
  # Don't try to read large files or PDFs as text for validation
5140
5158
  if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000 && File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
5159
+ # Set flag to prevent SIGWINCH from refreshing during editor
5160
+ @external_program_running = true
5141
5161
  # Save terminal state before launching editor
5142
5162
  system("stty -g < /dev/tty > /tmp/rtfm_stty_$$")
5143
5163
  # Reset terminal to sane/cooked mode for editor
@@ -5148,6 +5168,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5148
5168
  # Launch editor
5149
5169
  editor = ENV.fetch('EDITOR', 'vi')
5150
5170
  system("#{editor} #{Shellwords.escape(@selected)}")
5171
+ # Clear flag when editor exits
5172
+ @external_program_running = false
5151
5173
  # Restore terminal state
5152
5174
  system("stty $(cat /tmp/rtfm_stty_$$) < /dev/tty")
5153
5175
  system("rm -f /tmp/rtfm_stty_$$")
@@ -5647,10 +5669,15 @@ setborder
5647
5669
 
5648
5670
  ## Catch change in terminal resize, redraw {{{2
5649
5671
  Signal.trap('WINCH') do
5650
- @h, @w = IO.console.winsize
5651
- @pT.update = @pL.update = @pR.update = @pB.update = true
5652
- refresh
5653
- render
5672
+ # Don't refresh/render if an external interactive program is running
5673
+ # This prevents RTFM from painting over programs like HyperList when
5674
+ # switching terminals in window managers like i3-wm
5675
+ unless @external_program_running
5676
+ @h, @w = IO.console.winsize
5677
+ @pT.update = @pL.update = @pR.update = @pB.update = true
5678
+ refresh
5679
+ render
5680
+ end
5654
5681
  end
5655
5682
 
5656
5683
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.12
4
+ version: 7.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-02 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '7.4'
55
55
  description: |-
56
- RTFM v7.0.12: Fixed escape code residue in bottom pane during rapid key presses.
56
+ RTFM v7.0.13: Added @external_program_running flag for custom keys/plugins to prevent SIGWINCH interference when launching terminal programs.
57
57
  A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. Features include remote SSH/SFTP browsing, interactive SSH shell, comprehensive undo system, bookmarks, and much more. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers.
58
58
  email: g@isene.com
59
59
  executables: