rtfm-filemanager 7.1.0 → 7.1.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 +27 -11
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df66c4e6ca08bab9851409bf047f49bb1fe76aeb14fa0daca85f32f3ee46d01c
4
- data.tar.gz: 66f604c96c5b8c6152eabaec35b6e34fe957f4991f2a9f7fd564f304c3afd647
3
+ metadata.gz: 352dbe60c0ad1334df752f43f9bd00acb2cce8579d6eb9ec4b593c95ce8bc174
4
+ data.tar.gz: e0ab2516386ab2e9985245058620a85123df74381f7ca80cdde683b2ad512cfc
5
5
  SHA512:
6
- metadata.gz: 6de938ff5ac1176cd3d09700bc9940f04c72202f7636d68be1bddc121299d1ec4ae7aa0577bd72beaee7c5b5383b79ae522cdc633452c88c911a40a4d697ebf6
7
- data.tar.gz: 95c9d6f9b0de87bde2c881ae2f52002f1fbfa86f4b31400d54073a3366ea83601314adefa754c5fd833fd155033af4c8ab3c0816990fa90ba020be2d436361bc
6
+ metadata.gz: 2ce3b7c9074e7be2e14a3f6d5d78dddbb7357126031e2eae216c0a4d81a4897cce21aab658d20e91138e6febd33f9e2ee4b51a720adb967c82d43a93e23f1fce
7
+ data.tar.gz: d82b55e69211cbfe6a4c69bd5b80e4e2885102642346462174625022b3aa86b5cddc11ae1eb4a2f004f83178c08a6fbd9f27fa66cc10b803c489bc8e79f5e8a0
data/bin/rtfm CHANGED
@@ -1482,7 +1482,8 @@ end
1482
1482
 
1483
1483
  def toggle_long # {{{3
1484
1484
  @lslong = @lslong.empty? ? (@is_macos_bsd ? '-lhT' : '-lh --time-style=long-iso') : ''
1485
- @pR.update = @pB.update = true
1485
+ @pB.say(@lslong.empty? ? ' Long info: Off' : ' Long info: On')
1486
+ @pL.update = @pR.update = true
1486
1487
  end
1487
1488
 
1488
1489
  def toggle_order # {{{3
@@ -4310,30 +4311,34 @@ def ruby_debug # {{{3
4310
4311
  end
4311
4312
 
4312
4313
  # GENERIC FUNCTIONS {{{1
4313
- def get_cached_dirlist(dir, ls_options) # {{{2
4314
+ def get_cached_dirlist(dir, ls_options, ls_options_with_long = nil) # {{{2
4315
+ # Use ls_options_with_long for display, or fall back to ls_options
4316
+ ls_options_with_long ||= ls_options
4317
+
4314
4318
  # Generate cache key with directory mtime for automatic invalidation
4319
+ # Include ls_options_with_long in cache key so toggling @lslong invalidates cache
4315
4320
  begin
4316
4321
  dir_mtime = File.mtime(dir).to_i
4317
- cache_key = "#{dir}:#{ls_options}:#{dir_mtime}"
4322
+ cache_key = "#{dir}:#{ls_options_with_long}:#{dir_mtime}"
4318
4323
  rescue
4319
4324
  return nil # Can't cache if we can't get mtime
4320
4325
  end
4321
-
4326
+
4322
4327
  # Return cached result if available and fresh
4323
4328
  cached = @dir_cache[cache_key]
4324
4329
  return cached if cached
4325
-
4330
+
4326
4331
  # Clean old cache entries if cache is getting too large
4327
4332
  if @dir_cache_size >= @max_cache_entries
4328
4333
  @dir_cache.clear
4329
4334
  @dir_cache_size = 0
4330
4335
  end
4331
-
4336
+
4332
4337
  # Generate new directory listing
4333
4338
  begin
4334
4339
  purels = command("ls #{Shellwords.escape(dir)} #{ls_options}").pure.split("\n")
4335
4340
  color_opt = @is_macos_bsd ? '-G' : '--color'
4336
- colorls = command("ls #{color_opt} #{Shellwords.escape(dir)} #{ls_options} #{@lslong}").split("\n")
4341
+ colorls = command("ls #{color_opt} #{Shellwords.escape(dir)} #{ls_options_with_long}").split("\n")
4337
4342
 
4338
4343
  result = { purels: purels, colorls: colorls }
4339
4344
  @dir_cache[cache_key] = result
@@ -4498,7 +4503,8 @@ def dirlist(left: true, directory: nil) # LIST DIRECTORIES {{{2
4498
4503
  end
4499
4504
  # Use cached directory listing
4500
4505
  ls_options = "#{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}"
4501
- cached = get_cached_dirlist(dir, ls_options)
4506
+ ls_options_with_long = "#{ls_options} #{@lslong}".strip
4507
+ cached = get_cached_dirlist(dir, ls_options, ls_options_with_long)
4502
4508
 
4503
4509
  if cached
4504
4510
  purels = cached[:purels]
@@ -5363,7 +5369,7 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
5363
5369
  .gsub(/&#(\d+);/, '&#\1;')
5364
5370
  .gsub(/&#x([0-9a-fA-F]+);/, '&#x\1;')
5365
5371
  File.write(temp_svg, fixed_content)
5366
-
5372
+
5367
5373
  if system("convert #{Shellwords.escape(temp_svg)} #{Shellwords.escape(tn)} 2>/dev/null")
5368
5374
  showimage(tn)
5369
5375
  @image = true
@@ -5398,9 +5404,19 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
5398
5404
  showimage(tn)
5399
5405
  @image = true
5400
5406
  else
5401
- @pR.say("No preview available for #{@selected}")
5407
+ # Check if file is text using the `file` command
5408
+ file_type = `file --mime-type -b #{Shellwords.escape(@selected)} 2>/dev/null`.strip
5409
+ if file_type.start_with?('text/') || file_type == 'application/x-empty'
5410
+ # It's a text file - fall through to text preview below
5411
+ else
5412
+ @pR.say("No preview available for #{@selected}")
5413
+ return # Exit early to avoid text preview attempt
5414
+ end
5402
5415
  end
5403
- else # Fallback: treat as text if UTF‑8
5416
+ end
5417
+
5418
+ # Fallback: treat as text if no handler matched
5419
+ unless tmpl || pattern
5404
5420
  # Don't try to preview PDFs as text - they contain binary data
5405
5421
  if @selected&.match(@pdffile)
5406
5422
  @pR.say("No preview available for #{@selected}")
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.1.0
4
+ version: 7.1.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-10-08 00:00:00.000000000 Z
11
+ date: 2025-10-13 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.1.0: Added comprehensive compressed archive viewing for .zip, .tar, .gz, .tgz, .bz2, .tbz, .tbz2, .xz, .txz, .rar, .7z files with smart fallback handling.
56
+ RTFM v7.1.2: Fixed text file preview for all text-encoded files - now uses `file` command MIME type detection to properly display text files with any extension.
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: