ruby-shell 3.6.2 → 3.6.3
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 +35 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 993262643264502af4be2f3126a55986ac92fe38e4c3707936c825b29af7a772
|
|
4
|
+
data.tar.gz: a298f2fd1dec81cdb51e2f7eebb89508423e91a9a2fa8ac755d19690e6d0b647
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1dde29a7fbe12138f245da5627921ccda93103dacd6e43be55b8bd33b587d9ec97d0d973442af83e2deedbde9d4a92d3a179183e0a3a80cf8c31bfe3a6777f3
|
|
7
|
+
data.tar.gz: c560f6b0453629da857922576ee5db5fb18f2c8e8a982a08c24f640a9178f9d159b6f0bfc99518eb89ab34eec011a872fd3b92dd142be7b01be0185c431f8f30
|
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.3" # Polish: Config persistence, aligned display, smart completion space management
|
|
12
12
|
|
|
13
13
|
# MODULES, CLASSES AND EXTENSIONS
|
|
14
14
|
class String # Add coloring to strings (with escaping for Readline)
|
|
@@ -899,9 +899,17 @@ def tab(type)
|
|
|
899
899
|
@tabarray = sort_by_learning(completion_context, @tabarray)
|
|
900
900
|
end
|
|
901
901
|
|
|
902
|
-
|
|
902
|
+
# Smart space calculation: Limit items to available screen space
|
|
903
|
+
current_row, current_col = @c.pos
|
|
904
|
+
space_available = @maxrow - current_row - 1 # Lines below cursor
|
|
903
905
|
max_items = @completion_limit || 5
|
|
904
|
-
|
|
906
|
+
|
|
907
|
+
# Show what fits: min of (space, limit, remaining items)
|
|
908
|
+
items_can_show = [space_available, max_items, @tabarray.length.to_i - i].min
|
|
909
|
+
items_can_show = [items_can_show, 1].max # At least 1
|
|
910
|
+
|
|
911
|
+
@c.clear_screen_down # Here we go
|
|
912
|
+
l = items_can_show
|
|
905
913
|
l.times do |x| # Iterate through
|
|
906
914
|
if x == 0 # First item goes onto the commandline
|
|
907
915
|
@c.clear_line # Clear the line
|
|
@@ -928,7 +936,7 @@ def tab(type)
|
|
|
928
936
|
# Unified cursor positioning (always +1 since @pos0 is now string length)
|
|
929
937
|
@c_col = @pos0 + @pos + 1
|
|
930
938
|
@c.col(@c_col) # Set the cursor position
|
|
931
|
-
nextline #
|
|
939
|
+
nextline # Show items below
|
|
932
940
|
tabline = @tabarray[i] # Get the next matching tabline
|
|
933
941
|
# Add executable indicator
|
|
934
942
|
display_item = tabline.dup
|
|
@@ -1197,17 +1205,29 @@ def config(*args) # Configure rsh settings
|
|
|
1197
1205
|
value = args[1]
|
|
1198
1206
|
|
|
1199
1207
|
if setting.nil?
|
|
1200
|
-
# Show current configuration
|
|
1208
|
+
# Show current configuration with aligned columns
|
|
1201
1209
|
puts "\n Current Configuration:".c(@c_prompt).b
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1210
|
+
config_items = [
|
|
1211
|
+
["history_dedup", @history_dedup],
|
|
1212
|
+
["session_autosave", "#{@session_autosave}s", @session_autosave > 0 ? "(enabled)" : "(disabled)"],
|
|
1213
|
+
["auto_correct", @auto_correct ? "on" : "off"],
|
|
1214
|
+
["slow_command_threshold", "#{@slow_command_threshold}s", @slow_command_threshold > 0 ? "(enabled)" : "(disabled)"],
|
|
1215
|
+
["completion_learning", @completion_learning ? "on" : "off"],
|
|
1216
|
+
["show_tips", @show_tips ? "on" : "off"],
|
|
1217
|
+
["completion_limit", @completion_limit],
|
|
1218
|
+
["completion_fuzzy", @completion_fuzzy],
|
|
1219
|
+
["completion_case_sensitive", @completion_case_sensitive]
|
|
1220
|
+
]
|
|
1221
|
+
|
|
1222
|
+
# Find max label width for alignment
|
|
1223
|
+
max_label = config_items.map { |item| item[0].length }.max
|
|
1224
|
+
|
|
1225
|
+
config_items.each do |item|
|
|
1226
|
+
label = item[0].ljust(max_label)
|
|
1227
|
+
value = item[1].to_s.ljust(6) # Tighter spacing (10 → 6)
|
|
1228
|
+
extra = item[2] || ""
|
|
1229
|
+
puts " #{label} #{value} #{extra}"
|
|
1230
|
+
end
|
|
1211
1231
|
puts
|
|
1212
1232
|
return
|
|
1213
1233
|
end
|
|
@@ -1492,6 +1512,7 @@ def rshrc # Write user configuration to .rshrc (portable between machines)
|
|
|
1492
1512
|
conf = persist_var(conf, '@auto_correct', @auto_correct, @auto_correct)
|
|
1493
1513
|
conf = persist_var(conf, '@slow_command_threshold', @slow_command_threshold, @slow_command_threshold && @slow_command_threshold > 0)
|
|
1494
1514
|
conf = persist_var(conf, '@completion_learning', @completion_learning, !@completion_learning)
|
|
1515
|
+
conf = persist_var(conf, '@show_tips', @show_tips, !@show_tips)
|
|
1495
1516
|
conf = persist_var(conf, '@completion_show_metadata', @completion_show_metadata, @completion_show_metadata)
|
|
1496
1517
|
conf = persist_var(conf, '@plugin_disabled', @plugin_disabled, !@plugin_disabled.empty?)
|
|
1497
1518
|
conf = persist_var(conf, '@validation_rules', @validation_rules, !@validation_rules.empty?)
|