rtfm-filemanager 7.0.12 → 7.0.14

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 +36 -5
  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: e573fe0886eb3f338836fbf751fa2d24f4bb0ccdd6f8441dcfa8fb11e787a3c3
4
+ data.tar.gz: 433cc84863d13ca956e0332f497b53a607f21204b95bcb4bccaabb9896523afc
5
5
  SHA512:
6
- metadata.gz: 48d191cbc07c69e5d4bd293fc9e75ec6952d72c8da2e11e5ef9312072d055a137172e1b87e6088f8076dcefc5a6d24d2ff0966a5f1322c0ba15255b48a574d95
7
- data.tar.gz: 277886019de3d3502c7d5577117a46e7936f8f8faeea9615cefa4602175d7f0cfa43d17076f52416aac1df3f64352e9c67d69ea435dd1ddb7552ff2c9475778e
6
+ metadata.gz: '0785c69d762d6612833b71f8b86325dd042b9739481ca72f58f7593749f5e8f09baa7adc70bebb8af7139436c4a1004b8b3b41dc0db2844835b75fcaea8e9995'
7
+ data.tar.gz: 32b6814c2ff6d0370f979896f457c92fa721d3961473a538cd97d4fa3a66f3f00edf30884927bcf94d8863c89118416d6fb82b78af559e80cbd97b3c94cf7cd3
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.12' # Fixed escape code residue in bottom pane during rapid key presses
21
+ @version = '7.0.14' # Fixed regex error when using '*' to mark all files with C-T
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
@@ -1557,6 +1560,10 @@ def tag_pattern # {{{3
1557
1560
  # Reset bottom pane after input
1558
1561
  @pB.clear; @pB.update = true
1559
1562
  return if pat.nil? || pat.strip.empty?
1563
+ # Handle special case: * means match all files in current directory
1564
+ if pat == '*'
1565
+ pat = '.*' # Convert * to .* to match all files
1566
+ end
1560
1567
  re = Regexp.new(pat)
1561
1568
  matches = @files.grep(re).map { |t| File.join(Dir.pwd, t) }
1562
1569
  matches.each do |f|
@@ -2604,6 +2611,8 @@ def open_remote_shell # {{{3
2604
2611
  ssh_cmd = "ssh #{ssh_opts} #{ssh_target} -t 'cd #{Shellwords.escape(@remote_path)} 2>/dev/null || cd ~; exec bash -l'"
2605
2612
 
2606
2613
  # Use RTFM's interactive program pattern
2614
+ # Set flag to prevent SIGWINCH from refreshing during SSH session
2615
+ @external_program_running = true
2607
2616
  system("stty #{ORIG_STTY} < /dev/tty")
2608
2617
  system('clear < /dev/tty > /dev/tty')
2609
2618
  Cursor.show
@@ -2625,6 +2634,9 @@ def open_remote_shell # {{{3
2625
2634
  rescue Interrupt
2626
2635
  Process.kill('TERM', pid) rescue nil
2627
2636
  retry
2637
+ ensure
2638
+ # Clear flag when SSH session exits
2639
+ @external_program_running = false
2628
2640
  end
2629
2641
 
2630
2642
  # Restore RTFM's terminal state
@@ -4177,6 +4189,8 @@ def command_mode # {{{3
4177
4189
  end
4178
4190
  end
4179
4191
  if force || whitelist || magic # Decide interactive vs non-interactive
4192
+ # Set flag to prevent SIGWINCH from refreshing during interactive command
4193
+ @external_program_running = true
4180
4194
  # Restore shell tty so Ctrl-C/D work
4181
4195
  system("stty #{ORIG_STTY} < /dev/tty")
4182
4196
  # Clear to top-left
@@ -4192,6 +4206,9 @@ def command_mode # {{{3
4192
4206
  rescue Interrupt
4193
4207
  Process.kill('TERM', pid2) rescue nil
4194
4208
  retry
4209
+ ensure
4210
+ # Clear flag when command exits
4211
+ @external_program_running = false
4195
4212
  end
4196
4213
  # Restore raw/no-echo for RTFM
4197
4214
  system('stty raw -echo isig < /dev/tty')
@@ -5093,6 +5110,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5093
5110
  if !html && (prog = get_interactive_program(@selected))
5094
5111
  cmd = "#{prog} #{Shellwords.escape(@selected)}"
5095
5112
  # Use exactly the same logic as command_mode with § prefix (force interactive)
5113
+ # Set flag to prevent SIGWINCH from refreshing during external program
5114
+ @external_program_running = true
5096
5115
  # Restore shell tty so Ctrl-C/D work
5097
5116
  system("stty #{ORIG_STTY} < /dev/tty")
5098
5117
  # Reset terminal to sane/cooked mode for interactive programs
@@ -5110,6 +5129,9 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5110
5129
  rescue Interrupt
5111
5130
  Process.kill('TERM', pid) rescue nil
5112
5131
  retry
5132
+ ensure
5133
+ # Clear flag when program exits
5134
+ @external_program_running = false
5113
5135
  end
5114
5136
  # Restore raw/no-echo for RTFM
5115
5137
  system('stty raw -echo isig < /dev/tty')
@@ -5138,6 +5160,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5138
5160
  end
5139
5161
  # Don't try to read large files or PDFs as text for validation
5140
5162
  if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000 && File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
5163
+ # Set flag to prevent SIGWINCH from refreshing during editor
5164
+ @external_program_running = true
5141
5165
  # Save terminal state before launching editor
5142
5166
  system("stty -g < /dev/tty > /tmp/rtfm_stty_$$")
5143
5167
  # Reset terminal to sane/cooked mode for editor
@@ -5148,6 +5172,8 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5148
5172
  # Launch editor
5149
5173
  editor = ENV.fetch('EDITOR', 'vi')
5150
5174
  system("#{editor} #{Shellwords.escape(@selected)}")
5175
+ # Clear flag when editor exits
5176
+ @external_program_running = false
5151
5177
  # Restore terminal state
5152
5178
  system("stty $(cat /tmp/rtfm_stty_$$) < /dev/tty")
5153
5179
  system("rm -f /tmp/rtfm_stty_$$")
@@ -5647,10 +5673,15 @@ setborder
5647
5673
 
5648
5674
  ## Catch change in terminal resize, redraw {{{2
5649
5675
  Signal.trap('WINCH') do
5650
- @h, @w = IO.console.winsize
5651
- @pT.update = @pL.update = @pR.update = @pB.update = true
5652
- refresh
5653
- render
5676
+ # Don't refresh/render if an external interactive program is running
5677
+ # This prevents RTFM from painting over programs like HyperList when
5678
+ # switching terminals in window managers like i3-wm
5679
+ unless @external_program_running
5680
+ @h, @w = IO.console.winsize
5681
+ @pT.update = @pL.update = @pR.update = @pB.update = true
5682
+ refresh
5683
+ render
5684
+ end
5654
5685
  end
5655
5686
 
5656
5687
 
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.14
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-26 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.14: Fixed regex error when using '*' to mark all files with C-T. Now properly converts '*' to '.*' regex pattern.
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: