ruby-shell 3.6.11 → 3.6.12
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 +24 -24
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83be89da460ab7d6b0534773b414a23daebaa9c93e3dedae3c1e78d53fba1a3b
|
|
4
|
+
data.tar.gz: c95fffc211adbc81780bcf3e9d4003cd2880d0d370777ebeb9c70a90e9f4e5e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd7b51b6c55a5c84e4a3a04a7ab3ce127a6977e064cc4f133c2d2ebf9759835398b60f7044e76aeb6ecf1f286db59110815e37733b0ff6ce0949ed039e1cc71b
|
|
7
|
+
data.tar.gz: 84f6015d8eede6d78a226124730676bbb241dd9205077767776f8b4b19b9f45fa60716fc3b2a65d7bbd5547f85f6c8e3e50f6e52b71b272682d35353df780cdc
|
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.12" # Fix long command line wrapping
|
|
12
12
|
|
|
13
13
|
# MODULES, CLASSES AND EXTENSIONS
|
|
14
14
|
class String # Add coloring to strings (with escaping for Readline)
|
|
@@ -374,30 +374,23 @@ def getstr # A custom Readline-like function
|
|
|
374
374
|
row, col = @c.pos
|
|
375
375
|
@prompt_last_line = @display_prompt
|
|
376
376
|
# Calculate visible length (strip ANSI) - don't trust @c.pos with complex prompts
|
|
377
|
-
@pos0 = @display_prompt.gsub(/\001
|
|
377
|
+
@pos0 = @display_prompt.gsub(/\001?\e\[[0-9;]*m\002?/, '').length
|
|
378
378
|
@cmd_row = @row0
|
|
379
379
|
@is_multiline = false
|
|
380
380
|
end
|
|
381
381
|
|
|
382
|
-
@skip_prompt_print = false # Track if prompt already printed (for Ctrl-L)
|
|
383
|
-
|
|
384
382
|
while chr != "ENTER" # Keep going with readline until user presses ENTER
|
|
385
383
|
@ci = nil
|
|
386
384
|
lift = false
|
|
387
385
|
right = false
|
|
388
386
|
|
|
389
|
-
#
|
|
387
|
+
# Clear from cmd_row down (handles wrapped lines from previous iteration)
|
|
390
388
|
@c.row(@cmd_row)
|
|
389
|
+
@c.col(1)
|
|
390
|
+
@c.clear_screen_down
|
|
391
391
|
|
|
392
|
-
#
|
|
393
|
-
|
|
394
|
-
@c.col(1)
|
|
395
|
-
print @prompt_last_line
|
|
396
|
-
@c.clear_line_after
|
|
397
|
-
end
|
|
398
|
-
@skip_prompt_print = false # Reset flag
|
|
399
|
-
|
|
400
|
-
# Print command text with syntax highlighting
|
|
392
|
+
# Always reprint prompt + command text
|
|
393
|
+
print @prompt_last_line
|
|
401
394
|
print cmd_check(@history[0])
|
|
402
395
|
|
|
403
396
|
# Print history suggestion if available
|
|
@@ -411,12 +404,21 @@ def getstr # A custom Readline-like function
|
|
|
411
404
|
right = true
|
|
412
405
|
end
|
|
413
406
|
|
|
414
|
-
#
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
407
|
+
# Detect if terminal scrolled due to wrapping near the bottom
|
|
408
|
+
end_row, _ = @c.pos
|
|
409
|
+
printed_len = @pos0 + @history[0].to_s.length
|
|
410
|
+
printed_len += @ciprompt.to_s.length if right # Include suggestion text
|
|
411
|
+
expected_rows = printed_len > 0 ? (printed_len - 1) / @maxcol : 0
|
|
412
|
+
actual_start = end_row - expected_rows
|
|
413
|
+
if actual_start < @cmd_row
|
|
414
|
+
@cmd_row = [actual_start, 1].max # Terminal scrolled; adjust (min row 1)
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# Position cursor with wrapping math
|
|
418
|
+
total_pos = @pos0 + @pos # 0-indexed total position
|
|
419
|
+
cursor_row = @cmd_row + total_pos / @maxcol
|
|
420
|
+
cursor_col = total_pos % @maxcol + 1
|
|
421
|
+
@c.row(cursor_row)
|
|
420
422
|
@c.col(cursor_col)
|
|
421
423
|
chr = getchr
|
|
422
424
|
puts "DEBUG: Got char: '#{chr}' (length: #{chr.length})" if ENV['RSH_DEBUG']
|
|
@@ -473,11 +475,10 @@ def getstr # A custom Readline-like function
|
|
|
473
475
|
row, col = @c.pos
|
|
474
476
|
@prompt_last_line = @display_prompt
|
|
475
477
|
# Calculate visible length (match main init)
|
|
476
|
-
@pos0 = @display_prompt.gsub(/\001
|
|
478
|
+
@pos0 = @display_prompt.gsub(/\001?\e\[[0-9;]*m\002?/, '').length
|
|
477
479
|
@cmd_row = @row0
|
|
478
480
|
@is_multiline = false
|
|
479
481
|
end
|
|
480
|
-
@skip_prompt_print = true # Skip reprinting on next loop iteration
|
|
481
482
|
when 'UP' # Go up in history
|
|
482
483
|
if @stk == 0 and @history[0].length > 0
|
|
483
484
|
@tabsearch = @history[0]
|
|
@@ -541,7 +542,6 @@ def getstr # A custom Readline-like function
|
|
|
541
542
|
@history[0][@pos] = ""
|
|
542
543
|
end
|
|
543
544
|
lift = true
|
|
544
|
-
@c.clear_line_after
|
|
545
545
|
when 'WBACK' # Delete one word to the left (Ctrl-W)
|
|
546
546
|
unless @pos == @pos0
|
|
547
547
|
# Skip over any trailing spaces first
|
|
@@ -556,7 +556,6 @@ def getstr # A custom Readline-like function
|
|
|
556
556
|
end
|
|
557
557
|
end
|
|
558
558
|
lift = true
|
|
559
|
-
@c.clear_line_after
|
|
560
559
|
when 'C-Y' # Copy command line to primary selection
|
|
561
560
|
system("echo -n '#{@history[0]}' | xclip")
|
|
562
561
|
puts "\n#{Time.now.strftime("%H:%M:%S")}: Copied to primary selection (paste with middle buttoni)".c(@c_stamp)
|
|
@@ -603,6 +602,7 @@ def getstr # A custom Readline-like function
|
|
|
603
602
|
end
|
|
604
603
|
while $stdin.ready?
|
|
605
604
|
chr = $stdin.getc
|
|
605
|
+
chr = " " if chr == "\n" || chr == "\r" # Flatten pasted newlines
|
|
606
606
|
@history[0].insert(@pos,chr)
|
|
607
607
|
@pos += 1
|
|
608
608
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
@@ -12,7 +12,8 @@ date: 2026-02-19 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.
|
|
15
|
+
v3.6.12: Fix long command line wrapping - correct cursor positioning when commands
|
|
16
|
+
exceed terminal width.'
|
|
16
17
|
email: g@isene.com
|
|
17
18
|
executables:
|
|
18
19
|
- rsh
|