rtfm-filemanager 5.8.1 → 5.9

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +21 -13
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e00c84abae5f76fd1948fd4303d58541fb3ef238d98924bb71317b9a60957b61
4
- data.tar.gz: b3b9775f16cd75d800ea89cebc6dd5c9123acd1762c5485f8b1ad22816b2103c
3
+ metadata.gz: 3b51c7ac3f1785aaca41165d25820ea6f939b484c750c2f0296d6c6303e360eb
4
+ data.tar.gz: 6971374d4041158bb0a914d141524c625b6323f3609e427397375d53d4be8d2c
5
5
  SHA512:
6
- metadata.gz: d3fae5fae5d696f6065e2cd495034d9f2816dc7f566969eb2ee34dc0d2e085cc714a5e431b185ff980f003986820e415e5271fbc4ae43aa64f3d6e602520e9d1
7
- data.tar.gz: cabd4087a93b647ace9eebbd6b69e5bdc7d563358b0cef0505a63fc78f078c641f13945e76b86e5da79e37f298ea48a689b7b734e54a70cd3c84cb413460fe28
6
+ metadata.gz: 90bb41b3898f746ecac551330fa68fb1ebf2a130a9ba8627b0623f14f900f5de9701030a11a2a16f05aab430041a5e3d432e53f1cf687ecef6b857ee1d3b70d5
7
+ data.tar.gz: 80188dce4eaa620ed49b5ca078e9099f000a4f5715dc1c026520c7ed207237df276f5765d7f0b3a3993b5533ad6045754ccd0524615b45c9d0d5c7be3eaea41f
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 = '5.8.1' # Minor adjustment to max image width
21
+ @version = '5.9' # Delete/move message in bottom pane, bug fix on terminal restoration
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -499,7 +499,7 @@ end
499
499
  preview_specs = {
500
500
  'txt, rb, py, sh' => "#{@bat} -n --color=always @s",
501
501
  'md' => "pandoc @s -t plain",
502
- 'pdf' => "pdftotext -f 1 -l 4 @s -",
502
+ 'pdf' => "pdftotext -f 1 -l 4 @s - | tr -d '\\r'", # Filter carriage returns
503
503
  'odt, odp, odg, odc' => "odt2txt @s",
504
504
  'docx' => "docx2txt @s -",
505
505
  'xlsx' => "ssconvert -O 'separator= ' -T Gnumeric_stf:stf_assistant @s fd://1",
@@ -1002,7 +1002,7 @@ def delete_items # {{{3
1002
1002
  end
1003
1003
  @tagged.clear
1004
1004
  refresh_right
1005
- @pR.say("#{past_action} #{paths.size} items#{@trash ? " to #{TRASH_DIR}" : ''}".fg(204))
1005
+ @pB.say("#{past_action} #{paths.size} items#{@trash ? " to #{TRASH_DIR}" : ''}".fg(204))
1006
1006
  else
1007
1007
  @pB.update = true
1008
1008
  end
@@ -1969,15 +1969,18 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
1969
1969
  end
1970
1970
  return
1971
1971
  end
1972
- if File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
1972
+ # Don't try to read large files or PDFs as text for validation
1973
+ if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000 && File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
1973
1974
  system("stty #{ORIG_STTY} < /dev/tty")
1974
1975
  # Clear to top-left
1975
1976
  system('clear < /dev/tty > /dev/tty')
1976
1977
  Cursor.show
1977
1978
  editor = ENV.fetch('EDITOR', 'vi') # Launch $EDITOR on the real TTY
1978
1979
  system("#{editor} #{Shellwords.escape(@selected)}")
1980
+ system('stty raw -echo isig < /dev/tty')
1979
1981
  $stdin.raw!
1980
1982
  $stdin.echo = false
1983
+ Rcurses.init! # Reinitialize rcurses to fix input handling
1981
1984
  Cursor.hide
1982
1985
  Rcurses.clear_screen # Redraw RTFM
1983
1986
  refresh
@@ -2101,20 +2104,25 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
2101
2104
  @pR.say("No preview available for #{@selected}")
2102
2105
  end
2103
2106
  else # Fallback: treat as text if UTF‑8
2104
- text = File.read(@selected).force_encoding('UTF-8') rescue ''
2105
- if text.valid_encoding?
2106
- if @batuse
2107
- begin
2108
- showcommand("#{@bat} -n --color=always #{Shellwords.escape(@selected)}")
2109
- rescue
2107
+ # Don't try to preview PDFs as text - they contain binary data
2108
+ if @selected&.match(@pdffile)
2109
+ @pR.say("No preview available for #{@selected}")
2110
+ else
2111
+ text = File.read(@selected).force_encoding('UTF-8') rescue ''
2112
+ if text.valid_encoding?
2113
+ if @batuse
2114
+ begin
2115
+ showcommand("#{@bat} -n --color=always #{Shellwords.escape(@selected)}")
2116
+ rescue
2117
+ showcommand("cat #{Shellwords.escape(@selected)}")
2118
+ end
2119
+ else
2110
2120
  showcommand("cat #{Shellwords.escape(@selected)}")
2111
2121
  end
2112
- else
2113
- showcommand("cat #{Shellwords.escape(@selected)}")
2114
- end
2115
2122
  else
2116
2123
  @pR.say("No preview available for #{@selected}")
2117
2124
  end
2125
+ end
2118
2126
  end
2119
2127
  end
2120
2128
  rescue StandardError => e
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: 5.8.1
4
+ version: '5.9'
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-06-06 00:00:00.000000000 Z
11
+ date: 2025-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '7.4'
55
55
  description: |-
56
56
  Major release - RTFM v5: Complete rewrite using rcurses (https://github.com/isene/rcurses). Massive improvements. AI integration.
57
- A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. 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. 5.8.1: Minor adjustment to max image width.
57
+ A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. 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. 5.9: Delete/move message in bottom pane, bug fix on terminal restoration.
58
58
  email: g@isene.com
59
59
  executables:
60
60
  - rtfm