rtfm-filemanager 7.0.5 → 7.0.8

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 +7 -0
  3. data/bin/rtfm +35 -15
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a868de1ca6a2f8cb3706cd0d297fa452c20e08b96fcac59146c560779b991f7d
4
- data.tar.gz: 670836887ce9581a5d2083e7cd12c38e8c52817bd0bf5eb40ebfe62e4b66df96
3
+ metadata.gz: fe74615d16c35a3df2cd43dc915eac92084b47c5c459a8d55699bfdea8d8901c
4
+ data.tar.gz: 792b91626ef04bd1afa86056b5937502e344864c3cd33a1713fce86206123118
5
5
  SHA512:
6
- metadata.gz: 12ea6e3767d8816c3e80e85888521fd8a772014d3480b4f59e9bfa68c7c0fd7a83aa3bd1f0a901e35595895e8eda5f4d48397de629d5a5ef57d4e9149c7ecd88
7
- data.tar.gz: b3376a6308e4a5e415ceb688074017ba8ce44d9dfd66fa0da9150b75b24b8b11a0a65488566b175695e8e77822d6080ddc86bf125fddf3c602ed8f5f8f0229a7
6
+ metadata.gz: 904e4487383b214f68096d13d4a207e3e04bcf6f48262dda18fd364a9846a1549a6c834dc206d939dcbffdbcbc1a9bdb52c40027a705e9d8a1a5485653235cfc
7
+ data.tar.gz: 5d7599105945ca79638a10b06d9847c1ce0d7b1b977bc2ac26f1bfd4b5c708acb9fac17b82155b4a122a7b559c47809e9d604f51623c74a54f3b480306198990
data/README.md CHANGED
@@ -523,9 +523,16 @@ previewed by default in RTFM. The `preview.rb` explains how you add thesea:
523
523
  # # plain text, Ruby, Python, shell
524
524
  # txt, rb, py, sh = bat -n --color=always @s
525
525
  #
526
+ # # Alternative syntax highlighters (e.g., on macOS without bat)
527
+ # # txt, rb, py, sh = highlight -O ansi --force --line-numbers @s
528
+ #
526
529
  # # markdown via pandoc
527
530
  # md = pandoc @s -t plain
528
531
  #
532
+ # # Alternative markdown viewers (e.g., lowdown, termmark)
533
+ # # md = lowdown -Tterm @s
534
+ # # md = termmark @s
535
+ #
529
536
  # # PDFs
530
537
  # pdf = pdftotext -f 1 -l 4 @s -
531
538
  ```
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.4' # Fixed platform-specific issues for macOS/BSD and improved first-run message
21
+ @version = '7.0.8' # Fixed ALL SVG metadata processing to prevent hangs
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -1634,13 +1634,15 @@ def undo_delete(operation) # {{{3
1634
1634
  if operation[:trash]
1635
1635
  # Restore from trash
1636
1636
  operation[:paths].each do |path_info|
1637
- source = File.join(TRASH_DIR, File.basename(path_info[:path]))
1637
+ # Use the unique trash name if available (new format), otherwise fallback to basename (old format)
1638
+ trash_name = path_info[:trash_name] || File.basename(path_info[:path])
1639
+ source = File.join(TRASH_DIR, trash_name)
1638
1640
  dest = path_info[:path]
1639
1641
 
1640
1642
  if File.exist?(source)
1641
1643
  FileUtils.mv(source, dest)
1642
1644
  else
1643
- raise "Cannot restore #{path_info[:path]}: not found in trash"
1645
+ raise "Cannot restore #{path_info[:path]}: not found in trash (looked for #{trash_name})"
1644
1646
  end
1645
1647
  end
1646
1648
  else
@@ -3197,7 +3199,7 @@ def delete_items # {{{3
3197
3199
  if @trash
3198
3200
  warning_text << "Items will be moved to:\n".fg(249)
3199
3201
  warning_text << " ~/.rtfm/trash/\n".fg(240)
3200
- warning_text << "\nYou can restore them with " + "C-z".fg(156) + "\n".fg(249)
3202
+ warning_text << "\nYou can restore them with " + "U".fg(156) + " (undo)\n".fg(249)
3201
3203
  else
3202
3204
  warning_text << "⚠️ WARNING: PERMANENT DELETION!\n".fg(196).b
3203
3205
  warning_text << "Files will be permanently removed\n".fg(196)
@@ -3220,18 +3222,27 @@ def delete_items # {{{3
3220
3222
  else
3221
3223
  # Record undo information before deletion
3222
3224
  if @trash
3225
+ # Generate unique trash names to avoid overwriting
3226
+ timestamp = Time.now.strftime('%Y%m%d_%H%M%S')
3227
+ trash_mappings = paths.map do |p|
3228
+ basename = File.basename(p)
3229
+ # Add timestamp and a random suffix to ensure uniqueness
3230
+ trash_name = "#{timestamp}_#{basename}_#{rand(1000..9999)}"
3231
+ trash_path = File.join(TRASH_DIR, trash_name)
3232
+ { path: p, trash_name: trash_name, trash_path: trash_path }
3233
+ end
3234
+
3223
3235
  undo_info = {
3224
3236
  type: 'delete',
3225
3237
  trash: true,
3226
- paths: paths.map { |p| { path: p } },
3238
+ paths: trash_mappings.map { |m| { path: m[:path], trash_name: m[:trash_name] } },
3227
3239
  timestamp: Time.now
3228
3240
  }
3229
- end
3230
-
3231
- esc = paths.map { |p| Shellwords.escape(p) }.join(' ')
3232
- if @trash
3233
- esc_trash = Shellwords.escape(TRASH_DIR)
3234
- command("mv -f #{esc} #{esc_trash}")
3241
+
3242
+ # Move each file with its unique trash name
3243
+ trash_mappings.each do |mapping|
3244
+ command("mv -f #{Shellwords.escape(mapping[:path])} #{Shellwords.escape(mapping[:trash_path])}")
3245
+ end
3235
3246
  # Only add to undo history if operation succeeded and we can undo it
3236
3247
  add_undo_operation(undo_info)
3237
3248
  else
@@ -4295,7 +4306,10 @@ def get_cached_file_metadata(file_path) # {{{2
4295
4306
  metadata = nil
4296
4307
  begin
4297
4308
  if file_path.match(@imagefile) && cmd?('identify')
4298
- metadata = `identify -format " [%wx%h %m %[colorspace] %[bit-depth]-bit]" #{Shellwords.escape(file_path)} 2>/dev/null`.strip
4309
+ # Skip SVG files as identify can be very slow on them
4310
+ unless file_path =~ /\.svg$/i
4311
+ metadata = `identify -format " [%wx%h %m %[colorspace] %[bit-depth]-bit]" #{Shellwords.escape(file_path)} 2>/dev/null`.strip
4312
+ end
4299
4313
  elsif file_path.match(@pdffile)
4300
4314
  info = `pdfinfo #{Shellwords.escape(file_path)} 2>/dev/null`
4301
4315
  pages = info[/^Pages:\s+(\d+)/, 1]
@@ -4647,9 +4661,12 @@ def render # RENDER ALL PANES {{{2
4647
4661
  if cached_meta
4648
4662
  text += cached_meta
4649
4663
  elsif @selected&.match(@imagefile) && cmd?('identify')
4650
- # Fallback for non-cached image metadata
4651
- meta = `identify -format " [%wx%h %m %[colorspace] %[bit-depth]-bit]" #{Shellwords.escape(@selected)} 2>/dev/null`
4652
- text += meta
4664
+ # Skip SVG files as identify can be very slow on them
4665
+ unless @selected =~ /\.svg$/i
4666
+ # Fallback for non-cached image metadata
4667
+ meta = `identify -format " [%wx%h %m %[colorspace] %[bit-depth]-bit]" #{Shellwords.escape(@selected)} 2>/dev/null`
4668
+ text += meta
4669
+ end
4653
4670
  elsif @selected&.match(@pdffile)
4654
4671
  # Fallback for non-cached PDF metadata
4655
4672
  info = `pdfinfo #{Shellwords.escape(@selected)} 2>/dev/null`
@@ -5200,6 +5217,9 @@ def showcommand(cmd) # Helper function for showcontent {{{2
5200
5217
  end
5201
5218
 
5202
5219
  def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
5220
+ # Only process content if preview is enabled
5221
+ return unless @preview
5222
+
5203
5223
  if @pR.update
5204
5224
  showimage('clear') if @image
5205
5225
  @image = false
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.5
4
+ version: 7.0.8
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-08-19 00:00:00.000000000 Z
11
+ date: 2025-08-21 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.5: Added fallback to 'cat' when pandoc or batcat are not available (Issue #8).
56
+ RTFM v7.0.8: Fixed SVG processing hangs, improved undo system with unique trash filenames, and better preview handling.
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: