rtfm-filemanager 7.3.1 → 7.3.3

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 +82 -20
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '093129751d7817064ef4574c62f9c13e2c37f16e8cd33b4460348106f0539873'
4
- data.tar.gz: f5d75638cf2cda6d05941a0d57644dbe65253ba9493afc6abc78812e5c755474
3
+ metadata.gz: 569164f3c97c0f0bdb82f942745574d135471984648f7abfa9bdb59a7172b9d5
4
+ data.tar.gz: 7753dae5080cf46b422f73cc9fcf70f5cd962e8d5a0c66bcac52eaff39dbd39b
5
5
  SHA512:
6
- metadata.gz: 4b77c9557d19bb63de13048e2f03a991e26b692bd1f24cea7cc3383899e6c14816e624f211f05f54903d662ce932640b0afc19fc9cc09e71321dd8d772b9dc97
7
- data.tar.gz: 1971e0a8861185de393dc51f717729b3d70650c9dd670565aee8d6279d7bb6f4e5d75c8db15f5154c70fc29839c8d5cde498b4747b85b6fa4662c8df2cd405f2
6
+ metadata.gz: ea542ce3837d322bfd9d93ba98edac063f89ae8b8c3447ceb6f444ddd84abd362949696a25895a77eed8cecb28ed1917ab06d3e75a2635cbdabad899aa491cdc
7
+ data.tar.gz: f3b24e4b77de0d0b319d8b14d264f820292acb3c7739d7f52c8692d6da535eb7a6251c5c97d551d575299c46bac40411a98532203b2f8c1d485dca1bb440b1f9
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.3.1' # Fixed image positioning and EXIF orientation
21
+ @version = '7.3.3' # Performance optimization and UTF-16 support
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -290,7 +290,7 @@ CONFIG_FILE = File.join(RTFM_HOME, 'conf')
290
290
  CLIPBOARD COPY
291
291
  y = Copy path of selected item to primary selection (for pasting with middle mouse button)
292
292
  Y = Copy path of selected item to clipboard
293
- Ctrl-y = Copy content of right pane to clipboard
293
+ Ctrl-y = Copy content of right pane to clipboard (images: copies image file, text: copies text)
294
294
  Turn off batcat syntax highlighting with 'b' for a clean copy of content
295
295
 
296
296
  SYSTEM SHORTCUTS
@@ -1043,14 +1043,16 @@ end
1043
1043
  # MAIN GETKEY FOR USER INPUT {{{2
1044
1044
  def getkey # {{{3
1045
1045
  chr = getchr(1)
1046
-
1047
- # Check for image redraw on focus regain (even if no key was pressed)
1048
- check_image_redraw if @showimage
1049
-
1046
+
1047
+ # Only check image redraw when idle (no keypress) to avoid delays during active use
1048
+ if chr.nil? && @showimage
1049
+ check_image_redraw
1050
+ end
1051
+
1050
1052
  return unless chr
1051
1053
 
1052
- showimage('clear') if @image
1053
- @image = false
1054
+ # Don't clear image here - let render system handle it when @pR.update is true
1055
+ # This preserves images during operations that don't change the selected item
1054
1056
  if handler = KEYMAP[chr] # rubocop:disable Lint/AssignmentInCondition
1055
1057
  m = method(handler)
1056
1058
  m.arity == 1 ? m.call(chr) : m.call
@@ -1065,6 +1067,7 @@ end
1065
1067
 
1066
1068
  # BASIC KEYS {{{2
1067
1069
  def show_help # {{{3
1070
+ clear_image
1068
1071
  help_info
1069
1072
  end
1070
1073
 
@@ -1146,6 +1149,7 @@ def refresh_all # {{{3
1146
1149
  end
1147
1150
 
1148
1151
  def show_config
1152
+ clear_image
1149
1153
  @pR.say('Configuration'.u.fg(254) + ":\n\n" + @conf.fg(249))
1150
1154
  end
1151
1155
 
@@ -2242,6 +2246,7 @@ end
2242
2246
 
2243
2247
  # FILE COMPARISON {{{2
2244
2248
  def compare_files # {{{3
2249
+ clear_image
2245
2250
  if @tagged.length == 0
2246
2251
  @pB.say("No files tagged for comparison. Tag 2 files with 't'".fg(196))
2247
2252
  return
@@ -3265,12 +3270,15 @@ def delete_items # {{{3
3265
3270
 
3266
3271
  tagged_info
3267
3272
 
3273
+ # Clear image before showing warning text
3274
+ clear_image
3275
+
3268
3276
  # Add deletion warning to the right pane
3269
3277
  warning_text = "\n" + "=" * 50 + "\n"
3270
3278
  action = @trash ? 'Move to Trash' : 'PERMANENT DELETE'
3271
3279
  action_color = @trash ? 220 : 196
3272
3280
  warning_text << action.fg(action_color).b + "\n\n"
3273
-
3281
+
3274
3282
  if @trash
3275
3283
  warning_text << "Items will be moved to:\n".fg(249)
3276
3284
  warning_text << " ~/.rtfm/trash/\n".fg(240)
@@ -3280,9 +3288,9 @@ def delete_items # {{{3
3280
3288
  warning_text << "Files will be permanently removed\n".fg(196)
3281
3289
  warning_text << "This action CANNOT be undone!\n".fg(196).b
3282
3290
  end
3283
-
3291
+
3284
3292
  warning_text << "\n" + "Press " + "y".fg(156).b + " to confirm, any other key to cancel".fg(249)
3285
-
3293
+
3286
3294
  @pR.text << warning_text
3287
3295
  @pR.refresh
3288
3296
 
@@ -3643,8 +3651,9 @@ end
3643
3651
 
3644
3652
  # GIT/HASH/OPENAI {{{2
3645
3653
  def git_status # {{{3
3654
+ clear_image
3646
3655
  @pR.clear
3647
-
3656
+
3648
3657
  # Check if we're in a git repository
3649
3658
  unless Dir.exist?('.git') || system('git rev-parse --git-dir > /dev/null 2>&1')
3650
3659
  @pR.say("Not a Git Repository".b.fg(196) + "\n\n" + "This directory is not under Git version control.".fg(240))
@@ -3945,14 +3954,37 @@ def get_selected_full_path # {{{3
3945
3954
  end
3946
3955
 
3947
3956
  def copy_right # {{{3
3948
- clip = 'xclip -selection clipboard'
3949
- @pB.say(' Right pane copied to clipboard')
3950
- # We drop the trailing & in the string itself…
3951
- shell("echo -n #{Shellwords.escape(@pR.text.pure)} | #{clip} > /dev/null 2>&1", background: true)
3957
+ if @image && @selected && @selected.match(@imagefile)
3958
+ # Copy the image file to clipboard
3959
+ escaped_path = Shellwords.escape(@selected)
3960
+ # Detect image type from extension
3961
+ ext = File.extname(@selected).downcase
3962
+ mime_type = case ext
3963
+ when '.png' then 'image/png'
3964
+ when '.jpg', '.jpeg' then 'image/jpeg'
3965
+ when '.gif' then 'image/gif'
3966
+ when '.bmp' then 'image/bmp'
3967
+ when '.webp' then 'image/webp'
3968
+ else 'image/png'
3969
+ end
3970
+
3971
+ # Use cat to pipe file contents to xclip
3972
+ if system("cat #{escaped_path} | xclip -selection clipboard -target #{mime_type} 2>/dev/null")
3973
+ @pB.say(' Image copied to clipboard')
3974
+ else
3975
+ @pB.say(' Failed to copy image - xclip may not be installed')
3976
+ end
3977
+ else
3978
+ # Copy right pane text content
3979
+ clip = 'xclip -selection clipboard'
3980
+ @pB.say(' Right pane text copied to clipboard')
3981
+ shell("echo -n #{Shellwords.escape(@pR.text.pure)} | #{clip} > /dev/null 2>&1", background: true)
3982
+ end
3952
3983
  end
3953
3984
 
3954
3985
  # SYSTEM SHORTCUTS {{{2
3955
3986
  def system_info # {{{3
3987
+ clear_image
3956
3988
  text = "SYSTEM INFORMATION".b.fg(156) + " - " + Time.now.strftime("%Y-%m-%d %H:%M:%S").fg(249) + "\n"
3957
3989
  text << "=" * 50 + "\n\n"
3958
3990
 
@@ -4790,7 +4822,9 @@ def render # RENDER ALL PANES {{{2
4790
4822
 
4791
4823
  # RIGHT pane (or Preview pane in dual-pane mode) {{{3
4792
4824
  if @pR.update && @preview
4793
- showimage('clear') if @image; @image = false
4825
+ # Actually clear the image overlay when rendering new content
4826
+ showimage('clear') if @image
4827
+ @image = false
4794
4828
  righttext = @pR.text
4795
4829
 
4796
4830
  # In dual-pane mode, construct full path from active pane
@@ -5298,8 +5332,25 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
5298
5332
  end
5299
5333
  return
5300
5334
  end
5301
- # Don't try to read large files or PDFs as text for validation
5302
- if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000 && File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
5335
+ # Check if file is text (UTF-8, UTF-16, or other text encodings)
5336
+ is_text_file = false
5337
+ if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000
5338
+ sample = File.read(@selected, 1024) rescue nil
5339
+ if sample
5340
+ # Try UTF-8 first
5341
+ if sample.force_encoding('UTF-8').valid_encoding?
5342
+ is_text_file = true
5343
+ # Try UTF-16LE
5344
+ elsif sample.force_encoding('UTF-16LE').valid_encoding?
5345
+ is_text_file = true
5346
+ # Try UTF-16BE
5347
+ elsif sample.force_encoding('UTF-16BE').valid_encoding?
5348
+ is_text_file = true
5349
+ end
5350
+ end
5351
+ end
5352
+
5353
+ if is_text_file
5303
5354
  # Set flag to prevent SIGWINCH from refreshing during editor
5304
5355
  @external_program_running = true
5305
5356
  # Save terminal state before launching editor
@@ -5633,6 +5684,16 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
5633
5684
  @pR.update = false
5634
5685
  end
5635
5686
 
5687
+ def clear_image(skip_actual_clear: false) # HELPER TO CLEAR CURRENT IMAGE {{{2
5688
+ return unless @image
5689
+ # For operations that immediately render text over image, skip the slow clear
5690
+ # The text pane will cover the image overlay anyway
5691
+ unless skip_actual_clear
5692
+ showimage('clear')
5693
+ end
5694
+ @image = false
5695
+ end
5696
+
5636
5697
  def showimage(image) # SHOW THE SELECTED IMAGE IN THE RIGHT WINDOW {{{2
5637
5698
  # Pass 'clear' to clear the window for previous image
5638
5699
  return unless @showimage
@@ -5695,9 +5756,10 @@ def marks_info # SHOW MARKS IN RIGHT WINDOW {{{2
5695
5756
  end
5696
5757
 
5697
5758
  def tagged_info # SHOW THE LIST OF TAGGED ITEMS IN @pR {{{2
5759
+ clear_image
5698
5760
  info = "Tagged Items".b.fg(204) + "\n"
5699
5761
  info << "=" * 50 + "\n\n"
5700
-
5762
+
5701
5763
  # Summary information
5702
5764
  size_mb = (@tagsize.to_f / 1_000_000).round(2)
5703
5765
  info << "Summary:\n".fg(226)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.1
4
+ version: 7.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '7.4'
69
69
  description: |-
70
- RTFM v7.3.1: Fixed image positioning and EXIF orientation handling via termpix 0.2.0.
70
+ RTFM v7.3.3: Performance optimization for image operations and UTF-16 file support.
71
71
  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.
72
72
  email: g@isene.com
73
73
  executables: