rtfm-filemanager 7.0.0 → 7.0.1

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 +17 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be480f6ed1a90820e211e9b3f17a8b2cf48c98e81524081df1c8149932465967
4
- data.tar.gz: a64cb2021d07b05a6eec47181e4fb3cc60d2caf6c4474290838a2033f92c0bc6
3
+ metadata.gz: d089d1bfe95a340e6979a12e7a1cdf648218b2089a761198e48495927b6c397b
4
+ data.tar.gz: 2a728824fe81ad20c8dca96e586c8ad70a0b98896753f42984bd696b5aef03b0
5
5
  SHA512:
6
- metadata.gz: '039702927e0662761a7a5b8865fa681909558c5d7af98012261ef554ce93b2128d263ce2b3d53b946f175f449f64fa54737042ce9a736fbd5c066a4b3817114d'
7
- data.tar.gz: 0c56a3bc97e7fa799076866fcbc1c2596d6016b68f18394c2f0ee3b135d543dd34f5b8a03410d10cecd789ef821580da9b3a2818d83be14a0d5f51e2f336ee63
6
+ metadata.gz: 52f5ebc86450d31acd054e136ff3acee035602de7f19549f54cb3290ddd36c5ee9361a34e5147deb7bdbfcee56bfb653491c221cf8b10c20afaa883860249c19
7
+ data.tar.gz: 65b034c640c804d40c8ed17a1d37ee5b759524c9f3407e1d73ac9892842a4e8280977df30f1ef2e6e94d3515ef130c6ede8a3b096bc37738b70f23287c08a870
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 = '6.0.12' # Fixed terminal state issue causing multiple keypresses in VIM
21
+ @version = '7.0.1' # Re-enabled directory caching for major performance improvement
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -501,6 +501,9 @@ $stdin.set_encoding(Encoding::UTF_8)
501
501
  @metadata_cache = {}
502
502
  @metadata_cache_size = 0
503
503
  @max_metadata_entries = 100
504
+ @command_cache = {} # Cache for expensive shell commands
505
+ @command_cache_size = 0
506
+ @max_command_cache = 50
504
507
 
505
508
  # INITIALIZE VARIABLES {{{1
506
509
  ## These can be set by user in ~/.rtfm/conf
@@ -4213,8 +4216,17 @@ end
4213
4216
 
4214
4217
  # GENERIC FUNCTIONS {{{1
4215
4218
  def get_cached_dirlist(dir, ls_options) # {{{2
4216
- # Directory caching disabled for stability
4217
- return nil
4219
+ # Generate cache key with directory mtime for automatic invalidation
4220
+ begin
4221
+ dir_mtime = File.mtime(dir).to_i
4222
+ cache_key = "#{dir}:#{ls_options}:#{dir_mtime}"
4223
+ rescue
4224
+ return nil # Can't cache if we can't get mtime
4225
+ end
4226
+
4227
+ # Return cached result if available and fresh
4228
+ cached = @dir_cache[cache_key]
4229
+ return cached if cached
4218
4230
 
4219
4231
  # Clean old cache entries if cache is getting too large
4220
4232
  if @dir_cache_size >= @max_cache_entries
@@ -4228,11 +4240,11 @@ def get_cached_dirlist(dir, ls_options) # {{{2
4228
4240
  colorls = command("ls --color #{Shellwords.escape(dir)} #{ls_options} #{@lslong}").split("\n")
4229
4241
 
4230
4242
  result = { purels: purels, colorls: colorls }
4231
- @dir_cache[cache_with_time] = result
4243
+ @dir_cache[cache_key] = result
4232
4244
  @dir_cache_size += 1
4233
4245
 
4234
4246
  # Clean up old entries for this directory
4235
- @dir_cache.delete_if { |key, _| key.start_with?("#{dir}:") && key != cache_with_time }
4247
+ @dir_cache.delete_if { |key, _| key.start_with?("#{dir}:") && key != cache_key }
4236
4248
 
4237
4249
  result
4238
4250
  rescue => e
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.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene