ruby-shell 3.6.0 → 3.6.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.
- checksums.yaml +4 -4
- data/bin/rsh +34 -20
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84b836c4727e19dc59d0e12f980ebb4437b729a474247d94288d017f39d735b3
|
|
4
|
+
data.tar.gz: 72a2ef18a3a12bce6c1081743801d0f996373199268c084ffdb39e5b6f4771e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de67a854302e2855c5fc9fd74a34cf550a98e3e3827cc83862c6b3f8cb329b3da8e0c491bf4266c57f3c066c41d79f0858899f5d9578ce97641a6a2f3c56a15b
|
|
7
|
+
data.tar.gz: a3a84a2553228efcbb9e77bbca2c01f7e3b689b1570a02e19a65d2b6c3e85a0bded51519a2bb16b04654687d8e7926272d112e7b4c33029318e9c454e0b8952a
|
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.
|
|
11
|
+
@version = "3.6.1" # Ctrl-L fixes: Position reset, visible length calculation, no duplicate prompts
|
|
12
12
|
|
|
13
13
|
# MODULES, CLASSES AND EXTENSIONS
|
|
14
14
|
class String # Add coloring to strings (with escaping for Readline)
|
|
@@ -371,12 +371,16 @@ def getstr # A custom Readline-like function
|
|
|
371
371
|
@is_multiline = true
|
|
372
372
|
else
|
|
373
373
|
# Single-line prompt
|
|
374
|
-
row,
|
|
374
|
+
row, col = @c.pos
|
|
375
375
|
@prompt_last_line = @display_prompt
|
|
376
|
+
# Calculate visible length (strip ANSI) - don't trust @c.pos with complex prompts
|
|
377
|
+
@pos0 = @display_prompt.gsub(/\001\e\[[0-9;]*m\002/, '').length
|
|
376
378
|
@cmd_row = @row0
|
|
377
379
|
@is_multiline = false
|
|
378
380
|
end
|
|
379
381
|
|
|
382
|
+
@skip_prompt_print = false # Track if prompt already printed (for Ctrl-L)
|
|
383
|
+
|
|
380
384
|
while chr != "ENTER" # Keep going with readline until user presses ENTER
|
|
381
385
|
@ci = nil
|
|
382
386
|
lift = false
|
|
@@ -385,16 +389,13 @@ def getstr # A custom Readline-like function
|
|
|
385
389
|
# Update command line display (not the prompt!)
|
|
386
390
|
@c.row(@cmd_row)
|
|
387
391
|
|
|
388
|
-
# Reprint the prompt line (preserves colors)
|
|
389
|
-
|
|
390
|
-
@c.col(1)
|
|
391
|
-
print @prompt_last_line
|
|
392
|
-
@c.clear_line_after
|
|
393
|
-
else
|
|
392
|
+
# Reprint the prompt line (preserves colors) - skip if Ctrl-L just printed it
|
|
393
|
+
unless @skip_prompt_print
|
|
394
394
|
@c.col(1)
|
|
395
395
|
print @prompt_last_line
|
|
396
396
|
@c.clear_line_after
|
|
397
397
|
end
|
|
398
|
+
@skip_prompt_print = false # Reset flag
|
|
398
399
|
|
|
399
400
|
# Print command text with syntax highlighting
|
|
400
401
|
print cmd_check(@history[0])
|
|
@@ -410,14 +411,11 @@ def getstr # A custom Readline-like function
|
|
|
410
411
|
right = true
|
|
411
412
|
end
|
|
412
413
|
|
|
413
|
-
# Position cursor (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
# Single-line: @pos0 already from @c.pos (1-indexed)
|
|
419
|
-
cursor_col = @pos0 + @pos
|
|
420
|
-
end
|
|
414
|
+
# Position cursor (unified - both now use string length which is 0-indexed)
|
|
415
|
+
# @pos0 = visible length of prompt (14 for "geir@juba: ~/ ")
|
|
416
|
+
# @pos = position in command text (0 = start, 5 = after 5 chars)
|
|
417
|
+
# Terminal columns are 1-indexed, so add +1
|
|
418
|
+
cursor_col = @pos0 + @pos + 1
|
|
421
419
|
@c.row(@cmd_row)
|
|
422
420
|
@c.col(cursor_col)
|
|
423
421
|
chr = getchr
|
|
@@ -449,21 +447,37 @@ def getstr # A custom Readline-like function
|
|
|
449
447
|
exit
|
|
450
448
|
when 'C-L' # Clear screen and set position to top of the screen
|
|
451
449
|
@c.row(1)
|
|
450
|
+
@c.col(1) # Also reset column to 1
|
|
452
451
|
@c.clear_screen_down
|
|
453
452
|
# Reprint prompt after clear
|
|
454
453
|
@row0 = 1
|
|
455
454
|
print @display_prompt
|
|
456
|
-
# Recalculate positions
|
|
455
|
+
# Recalculate positions (match initial setup exactly)
|
|
457
456
|
if @display_prompt.include?("\n")
|
|
458
457
|
newline_count = @display_prompt.count("\n")
|
|
459
458
|
@row0 += newline_count
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
# Reextract color codes and last line (same as init)
|
|
460
|
+
color_codes = ""
|
|
461
|
+
if @display_prompt =~ /^(\001\e\[[0-9;]+m\002)/
|
|
462
|
+
color_codes = $1
|
|
463
|
+
end
|
|
464
|
+
lines = @display_prompt.split("\n")
|
|
465
|
+
@prompt_last_line = lines.last
|
|
466
|
+
if !color_codes.empty? && !@prompt_last_line.start_with?("\001")
|
|
467
|
+
@prompt_last_line = color_codes + @prompt_last_line + "\001\e[0m\002"
|
|
468
|
+
end
|
|
469
|
+
@pos0 = @prompt_last_line.gsub(/\001?\e\[[0-9;]*m\002?/, '').length
|
|
462
470
|
@cmd_row = @row0
|
|
471
|
+
@is_multiline = true
|
|
463
472
|
else
|
|
464
|
-
row,
|
|
473
|
+
row, col = @c.pos
|
|
474
|
+
@prompt_last_line = @display_prompt
|
|
475
|
+
# Calculate visible length (match main init)
|
|
476
|
+
@pos0 = @display_prompt.gsub(/\001\e\[[0-9;]*m\002/, '').length
|
|
465
477
|
@cmd_row = @row0
|
|
478
|
+
@is_multiline = false
|
|
466
479
|
end
|
|
480
|
+
@skip_prompt_print = true # Skip reprinting on next loop iteration
|
|
467
481
|
when 'UP' # Go up in history
|
|
468
482
|
if @stk == 0 and @history[0].length > 0
|
|
469
483
|
@tabsearch = @history[0]
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-shell
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.6.
|
|
4
|
+
version: 3.6.1
|
|
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-
|
|
11
|
+
date: 2025-11-05 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
|