rtfm-filemanager 5.8.1 → 5.8.2

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 +18 -12
  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: '08c5e4af4d6dbb3733790484b19dd8e9e4bb20bae175cbfedefb5cf6439e432e'
4
+ data.tar.gz: d5bcd58b749e15c49172da3a62c80091a663c5a15244c232616ec91ccfdf4cc2
5
5
  SHA512:
6
- metadata.gz: d3fae5fae5d696f6065e2cd495034d9f2816dc7f566969eb2ee34dc0d2e085cc714a5e431b185ff980f003986820e415e5271fbc4ae43aa64f3d6e602520e9d1
7
- data.tar.gz: cabd4087a93b647ace9eebbd6b69e5bdc7d563358b0cef0505a63fc78f078c641f13945e76b86e5da79e37f298ea48a689b7b734e54a70cd3c84cb413460fe28
6
+ metadata.gz: b55745561f69f836fa544aa9fdc5f37336b918fadc15ea7653e1c5a9614ba67bc19346bb37a024945a9f839cdc9ad822d919e6b4248734ded17e2a8d0f3af3fe
7
+ data.tar.gz: e16e2a07d75ef47c69d4a809e9e968d9011aee2e35e5178cf495ecf3fa4a78207abea45f7690db820cf9a9db7b977b19e3eafc6add761521532f3ae1838f55c5
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.8.2' # Bug fix for carriage return (also in PDFs)
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",
@@ -1969,7 +1969,8 @@ 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')
@@ -2101,20 +2102,25 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
2101
2102
  @pR.say("No preview available for #{@selected}")
2102
2103
  end
2103
2104
  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
2105
+ # Don't try to preview PDFs as text - they contain binary data
2106
+ if @selected&.match(@pdffile)
2107
+ @pR.say("No preview available for #{@selected}")
2108
+ else
2109
+ text = File.read(@selected).force_encoding('UTF-8') rescue ''
2110
+ if text.valid_encoding?
2111
+ if @batuse
2112
+ begin
2113
+ showcommand("#{@bat} -n --color=always #{Shellwords.escape(@selected)}")
2114
+ rescue
2115
+ showcommand("cat #{Shellwords.escape(@selected)}")
2116
+ end
2117
+ else
2110
2118
  showcommand("cat #{Shellwords.escape(@selected)}")
2111
2119
  end
2112
- else
2113
- showcommand("cat #{Shellwords.escape(@selected)}")
2114
- end
2115
2120
  else
2116
2121
  @pR.say("No preview available for #{@selected}")
2117
2122
  end
2123
+ end
2118
2124
  end
2119
2125
  end
2120
2126
  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.8.2
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-17 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.8.2: Bug fix for carriage return (also in PDFs).
58
58
  email: g@isene.com
59
59
  executables:
60
60
  - rtfm