rtfm-filemanager 7.0.11 → 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 +37 -6
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e78200976a8e712b82378dae1bff8f113943a1cca12d74646300f1f11ee2fb6f
4
- data.tar.gz: 0a99799ebac8608030e957b77e90a5863aef00a7c09b735f9c4d48635fb7defc
3
+ metadata.gz: 21434141f1b12b20834d27fc396872713be1d4539633c94a5013b037cef98103
4
+ data.tar.gz: 5178581ecd9e29b53fea3d6fb0d21038902d26f187964a8ce743e4ecf93e749a
5
5
  SHA512:
6
- metadata.gz: 8515ae1d820ac5bf2c010a890e01ffc8175abc7e0836c8ebc5cb138ca9b2f5970e4f9f383df490175cdb7a76e6c119e4da8cdbe2c6177683aa26a4ccdde9b473
7
- data.tar.gz: 78b78c1716929a3b8f7fc0050a17034b7b9a1046f425d3916a847df82e8f16f13b1470a5d6bbd93bc92e112851a557d8f1292500beae124ee8625fea33bcfbd5
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
@@ -18,7 +18,7 @@
18
18
  # get a great understanding of the code itself by simply sending
19
19
  # or pasting this whole file into you favorite AI for coding with
20
20
  # a prompt like this: "Help me understand every part of this code".
21
- @version = '7.0.11' # Fixed ESC behavior and GIF preview dimensions
21
+ @version = '7.0.12' # Fixed escape code residue in bottom pane during rapid key presses
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -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')
@@ -4758,7 +4771,11 @@ def render # RENDER ALL PANES {{{2
4758
4771
  info = " Showing only file types '#{@lsfiles}'".fg(129).u if @lsfiles =~ /,/
4759
4772
  info += " and only files matching '#{@lsmatch}'".fg(129).u if @lsfiles != '' && @lsmatch != ''
4760
4773
  @pB.text = info
4761
- @pB.refresh unless @pB.text == bottomtext
4774
+ # Ensure screen output is complete before continuing
4775
+ if @pB.text != bottomtext
4776
+ @pB.refresh
4777
+ STDOUT.flush
4778
+ end
4762
4779
  end
4763
4780
  end
4764
4781
 
@@ -5089,6 +5106,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5089
5106
  if !html && (prog = get_interactive_program(@selected))
5090
5107
  cmd = "#{prog} #{Shellwords.escape(@selected)}"
5091
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
5092
5111
  # Restore shell tty so Ctrl-C/D work
5093
5112
  system("stty #{ORIG_STTY} < /dev/tty")
5094
5113
  # Reset terminal to sane/cooked mode for interactive programs
@@ -5106,6 +5125,9 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5106
5125
  rescue Interrupt
5107
5126
  Process.kill('TERM', pid) rescue nil
5108
5127
  retry
5128
+ ensure
5129
+ # Clear flag when program exits
5130
+ @external_program_running = false
5109
5131
  end
5110
5132
  # Restore raw/no-echo for RTFM
5111
5133
  system('stty raw -echo isig < /dev/tty')
@@ -5134,6 +5156,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5134
5156
  end
5135
5157
  # Don't try to read large files or PDFs as text for validation
5136
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
5137
5161
  # Save terminal state before launching editor
5138
5162
  system("stty -g < /dev/tty > /tmp/rtfm_stty_$$")
5139
5163
  # Reset terminal to sane/cooked mode for editor
@@ -5144,6 +5168,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5144
5168
  # Launch editor
5145
5169
  editor = ENV.fetch('EDITOR', 'vi')
5146
5170
  system("#{editor} #{Shellwords.escape(@selected)}")
5171
+ # Clear flag when editor exits
5172
+ @external_program_running = false
5147
5173
  # Restore terminal state
5148
5174
  system("stty $(cat /tmp/rtfm_stty_$$) < /dev/tty")
5149
5175
  system("rm -f /tmp/rtfm_stty_$$")
@@ -5643,10 +5669,15 @@ setborder
5643
5669
 
5644
5670
  ## Catch change in terminal resize, redraw {{{2
5645
5671
  Signal.trap('WINCH') do
5646
- @h, @w = IO.console.winsize
5647
- @pT.update = @pL.update = @pR.update = @pB.update = true
5648
- refresh
5649
- 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
5650
5681
  end
5651
5682
 
5652
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.11
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-08-26 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.11: Fixed ESC key behavior to properly restore bottom pane after cancelling actions. Fixed animated GIF preview dimensions issue.
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: