rtfm-filemanager 5.4 → 5.6

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 +31 -11
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b36bdc259840435d9b71deaea0bee4abdb1facdd3b0371549fc49d90c01fc92
4
- data.tar.gz: d0c48761155ca6e31bf2a0ec78004925e1f2ae1e41bb944f885a4cf923c339a2
3
+ metadata.gz: f544a2581e939a651b9c5f7532960fb057dc449a4a549acbec646576845c71e5
4
+ data.tar.gz: 0c27c90a8b5ad28e804e15dc810837f783b37872ae1e6c45e399cf2e16b61b4e
5
5
  SHA512:
6
- metadata.gz: d7fedf5273a6d46f61d3f328d379f2c480d9b21375a837765803c59b29eca9631f5e5a862ca9346497c6e73b38a6c40a84b0215db28f6c574e721a1ffd237c0a
7
- data.tar.gz: 3f49418f17c471b2d8f2ab60e450cc41cca89c64b857921d47bf9891dbed980a55b76aa5b0d8044061c1bab60144d1dde0c0f1f532e813c56b485b767eed7c41
6
+ metadata.gz: 9ee6716978969d8a704647962322786f4a1fb703504600febdcf6c4dedb2c77801b9e1819b76eb5e8aa8f6d9491b6236ae14027a1112c755fa9764fcecd91e00
7
+ data.tar.gz: 69f326117d1d528a36175bf16e93e79db20018bbafe784167b24058239699680c63079bb253f6979ce938b165f6c1e9de16ccd2fe6d4060463d9521e2c8a4b4c
data/bin/rtfm CHANGED
@@ -18,7 +18,14 @@
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.4' # Removed tty startup/exit codes as rcurses now handles that
21
+ @version = '5.6' # Fixed bug with special characters in terminal after EDITOR exit
22
+
23
+ # SAVE & STORE TERMINAL {{{1
24
+ ORIG_STTY = `stty -g`.chomp
25
+
26
+ at_exit do
27
+ system("stty #{ORIG_STTY} < /dev/tty") rescue nil
28
+ end
22
29
 
23
30
  # BOOTSNAP {{{1
24
31
  cache_dir = ENV.fetch('BOOTSNAP_CACHE_DIR', File.join(Dir.home, '.rtfm', 'bootsnap-cache'))
@@ -105,9 +112,6 @@ KEYS_FILE = File.join(RTFM_HOME, 'keys.rb') unless defined?(KEYS_FILE)
105
112
  CONFIG_FILE = File.join(RTFM_HOME, 'conf')
106
113
  @plugin_errors = []
107
114
 
108
- # SAVE TERMINAL {{{1
109
- ORIG_STTY = `stty -g`.chomp
110
-
111
115
  # HELP {{{1
112
116
  @help = <<~HELPTEXT
113
117
  RTFM - Ruby Terminal File Manager (https://github.com/isene/RTFM)
@@ -679,6 +683,9 @@ def getkey # {{{3
679
683
  m = method(handler)
680
684
  m.arity == 1 ? m.call(chr) : m.call
681
685
  end
686
+ rescue Errno::EIO
687
+ # ignore transient TTY/read errors when upon focus switch
688
+ return
682
689
  rescue StandardError => e
683
690
  errormsg('⚷ Error in getkey', e)
684
691
  end
@@ -2005,7 +2012,7 @@ def showimage(image) # SHOW THE SELECTED IMAGE IN THE RIGHT WINDOW {{{2
2005
2012
  img_max_h += 2
2006
2013
  `echo "6;#{img_x};#{img_y};#{img_max_w};#{img_max_h};\n4;\n3;" | #{@imgdisplay} 2>/dev/null`
2007
2014
  else
2008
- img_w, img_h = `identify -format "%[fx:w]x%[fx:h]" #{image} 2>/dev/null`.split('x')
2015
+ img_w, img_h = `identify -format "%[fx:w]x%[fx:h]" #{Shellwords.escape(image)} 2>/dev/null`.split('x')
2009
2016
  img_w = img_w.to_i
2010
2017
  img_h = img_h.to_i
2011
2018
  if img_w > img_max_w
@@ -2068,9 +2075,10 @@ def open_selected(html = nil) # OPEN SELECTED ITEM (when pressing RIGHT or via o
2068
2075
  return
2069
2076
  end
2070
2077
  if File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
2078
+ system("stty #{ORIG_STTY} < /dev/tty")
2079
+ # Clear to top-left
2080
+ system('clear < /dev/tty > /dev/tty')
2071
2081
  Cursor.show
2072
- $stdin.raw!
2073
- $stdin.echo = false
2074
2082
  editor = ENV.fetch('EDITOR', 'vi') # Launch $EDITOR on the real TTY
2075
2083
  system("#{editor} #{Shellwords.escape(@selected)}")
2076
2084
  $stdin.raw!
@@ -2153,14 +2161,26 @@ $stdin.getc while $stdin.wait_readable(0)
2153
2161
  #checkpoint("Program started")
2154
2162
  loop do
2155
2163
  @dir_old = Dir.pwd
2156
- render
2157
- getkey
2158
- begin # If cwd was deleted externally, jump home
2164
+ # redraw, but ignore TTY‐focus errors
2165
+ begin
2166
+ render
2167
+ rescue Errno::EIO
2168
+ # nothing
2169
+ end
2170
+ # read key, but ignore TTY-focus errors
2171
+ begin
2172
+ getkey
2173
+ rescue Errno::EIO
2174
+ # nothing
2175
+ end
2176
+ # If cwd was deleted externally, jump home
2177
+ begin
2159
2178
  Dir.pwd
2160
2179
  rescue
2161
2180
  Dir.chdir
2162
2181
  end
2163
- @index = @directory[Dir.pwd] || 0 if Dir.pwd != @dir_old # If we cd'd, restore index
2182
+ # restore index if we cd'd
2183
+ @index = @directory[Dir.pwd] || 0 if Dir.pwd != @dir_old
2164
2184
  unless @navi.empty?
2165
2185
  command(@navi)
2166
2186
  @navi = ''
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.4'
4
+ version: '5.6'
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-05-14 00:00:00.000000000 Z
11
+ date: 2025-05-19 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.4: Removed tty startup/exit codes as rcurses now handles that.
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.6: Fixed bug with special characters in terminal after EDITOR exit.
58
58
  email: g@isene.com
59
59
  executables:
60
60
  - rtfm