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