ruby-shell 3.6.16 → 3.6.17

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/rsh +25 -24
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e133cdb364d88a5e82942a136ffd6a284105553a5e367bc5415e4623b1715ef
4
- data.tar.gz: e712cf81e8ffccebadfb579272892d54617da2e59e53a95fab02b5e6766a5a9f
3
+ metadata.gz: 47a8896d9151658c431c1f2302f18b0d143887c9fe67d410a64d9c18bd143347
4
+ data.tar.gz: 230a1b7784618c69c860d169e36be458a09509d66052cd3350e1bb6e16620908
5
5
  SHA512:
6
- metadata.gz: f3d81facd0b334b13a4112a17c02aa43e0364844d1405d45e3d989ef2122d24ea0dad9ebf80a86bfa1840fd0d1f1e56c2cddf1fe0c01590aa9feb8df764bc88f
7
- data.tar.gz: 7cf717175c6319230ab76586a02d065196e41a51b0e429a26d16bd5dd37ef3c037262a89f59697b4c31b7ad149664e32d8c19cbc9ff6d5581fa6d378463ed421
6
+ metadata.gz: 1c841a0dc5675dbd5bf1bb9341b0f9edeead426cec47357a2e1655dc1d67465732822a596d71468a5972f511c2a6f0f2f983ee19ed24317567de6b05affef665
7
+ data.tar.gz: 61c8fb056e30ad6eba62bca87be4d4d60da8817fb69acee4924d672fa32dcd8f050250a7accae2af6bb288de43907b06c95b38956980af53cdf205c437952f28
data/bin/rsh CHANGED
@@ -8,7 +8,7 @@
8
8
  # Web_site: http://isene.com/
9
9
  # Github: https://github.com/isene/rsh
10
10
  # License: Public domain
11
- @version = "3.6.15" # Fix config persistence bugs in .rshrc
11
+ @version = "3.6.17" # Optimize core input loop
12
12
 
13
13
  # MODULES, CLASSES AND EXTENSIONS
14
14
  class String # Add coloring to strings (with escaping for Readline)
@@ -388,38 +388,39 @@ def getstr # A custom Readline-like function
388
388
  lift = false
389
389
  right = false
390
390
 
391
- # Clear from cmd_row down (handles wrapped lines from previous iteration)
392
- @c.row(@cmd_row)
393
- @c.col(1)
394
- @c.clear_screen_down
395
-
396
- # Always reprint prompt + command text
397
- print @prompt_last_line
398
- print cmd_check(@history[0])
391
+ # Cache syntax highlighting (skip re-highlighting on cursor-only moves)
392
+ cmd_text = @history[0].to_s
393
+ if cmd_text != @_hl_text
394
+ @_hl_text = cmd_text.dup
395
+ @_hl_result = cmd_check(@history[0])
396
+ end
399
397
 
400
- # Print history suggestion if available
401
- @ci = @history[1..].find_index {|e| e =~ /^#{Regexp.escape(@history[0].to_s)}./}
398
+ # History suggestion lookup
399
+ @ci = @history[1..].find_index {|e| e =~ /^#{Regexp.escape(cmd_text)}./}
402
400
  unless @ci == nil
403
401
  @ci += 1
404
- @ciprompt = @history[@ci][@history[0].to_s.length..].to_s
405
- end
406
- if @history[0].to_s.length > 1 and @ci
407
- print @ciprompt.c(@c_stamp)
408
- right = true
402
+ @ciprompt = @history[@ci][cmd_text.length..].to_s
409
403
  end
404
+ right = cmd_text.length > 1 && @ci
410
405
 
411
- # Detect if terminal scrolled due to wrapping near the bottom
412
- end_row, _ = @c.pos
413
- printed_len = @pos0 + @history[0].to_s.length
414
- printed_len += @ciprompt.to_s.length if right # Include suggestion text
406
+ # Compute scroll adjustment before drawing (avoids terminal round-trip)
407
+ printed_len = @pos0 + cmd_text.length
408
+ printed_len += @ciprompt.to_s.length if right
415
409
  expected_rows = printed_len > 0 ? (printed_len - 1) / @maxcol : 0
416
- actual_start = end_row - expected_rows
417
- if actual_start < @cmd_row
418
- @cmd_row = [actual_start, 1].max # Terminal scrolled; adjust (min row 1)
410
+ if @cmd_row + expected_rows > @maxrow
411
+ @cmd_row = [@maxrow - expected_rows, 1].max
419
412
  end
420
413
 
414
+ # Redraw prompt + command
415
+ @c.row(@cmd_row)
416
+ @c.col(1)
417
+ @c.clear_screen_down
418
+ print @prompt_last_line
419
+ print @_hl_result
420
+ print @ciprompt.c(@c_stamp) if right
421
+
421
422
  # Position cursor with wrapping math
422
- total_pos = @pos0 + @pos # 0-indexed total position
423
+ total_pos = @pos0 + @pos
423
424
  cursor_row = @cmd_row + total_pos / @maxcol
424
425
  cursor_col = total_pos % @maxcol + 1
425
426
  @c.row(cursor_row)
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.16
4
+ version: 3.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-21 00:00:00.000000000 Z
11
+ date: 2026-03-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'A shell written in Ruby with extensive tab completions, aliases/nicks,
14
14
  history, syntax highlighting, theming, auto-cd, auto-opening files and more. UPDATE
15
- v3.6.16: Security hardening, fix shell injection in xclip/editor/mailcap calls,
16
- narrow bare rescues.'
15
+ v3.6.17: Optimize core input loop with cached syntax highlighting and math-based
16
+ scroll detection.'
17
17
  email: g@isene.com
18
18
  executables:
19
19
  - rsh