ruby-shell 3.6.1 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rsh +39 -26
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84b836c4727e19dc59d0e12f980ebb4437b729a474247d94288d017f39d735b3
4
- data.tar.gz: 72a2ef18a3a12bce6c1081743801d0f996373199268c084ffdb39e5b6f4771e8
3
+ metadata.gz: 993262643264502af4be2f3126a55986ac92fe38e4c3707936c825b29af7a772
4
+ data.tar.gz: a298f2fd1dec81cdb51e2f7eebb89508423e91a9a2fa8ac755d19690e6d0b647
5
5
  SHA512:
6
- metadata.gz: de67a854302e2855c5fc9fd74a34cf550a98e3e3827cc83862c6b3f8cb329b3da8e0c491bf4266c57f3c066c41d79f0858899f5d9578ce97641a6a2f3c56a15b
7
- data.tar.gz: a3a84a2553228efcbb9e77bbca2c01f7e3b689b1570a02e19a65d2b6c3e85a0bded51519a2bb16b04654687d8e7926272d112e7b4c33029318e9c454e0b8952a
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.1" # Ctrl-L fixes: Position reset, visible length calculation, no duplicate prompts
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)
@@ -689,12 +689,8 @@ def tab(type)
689
689
  completed = @tabstr + "/"
690
690
  @history[0] = @pretab + completed + @postab
691
691
  @pos = @pretab.length + completed.length
692
- # Consistent cursor calc
693
- if @is_multiline
694
- @c_col = @pos0 + @pos + 1
695
- else
696
- @c_col = @pos0 + @pos
697
- end
692
+ # Unified cursor calc (always +1 since @pos0 is now string length)
693
+ @c_col = @pos0 + @pos + 1
698
694
  @c.clear_line
699
695
  line_display = cmd_check(@history[0]).to_s
700
696
  # Use last line only for multi-line prompts
@@ -903,9 +899,17 @@ def tab(type)
903
899
  @tabarray = sort_by_learning(completion_context, @tabarray)
904
900
  end
905
901
 
906
- @c.clear_screen_down # Here we go
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
907
905
  max_items = @completion_limit || 5
908
- @tabarray.length.to_i - i < max_items ? l = @tabarray.length.to_i - i : l = max_items
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
909
913
  l.times do |x| # Iterate through
910
914
  if x == 0 # First item goes onto the commandline
911
915
  @c.clear_line # Clear the line
@@ -929,14 +933,10 @@ def tab(type)
929
933
  tabline = display_choice.sub(/(.*)#{escaped_tabstr}(.*)/, '\1'.c(choice_color) + @tabstr.u.c(choice_color) + '\2'.c(choice_color))
930
934
  print prompt_for_tab + line1 + tabline + line2 # Print the commandline (use last line only for multi-line)
931
935
  @pos = @pretab.length.to_i + tabchoice.length.to_i # Set the position on that commandline
932
- # Consistent cursor positioning
933
- if @is_multiline
934
- @c_col = @pos0 + @pos + 1 # Multi-line: string length needs +1
935
- else
936
- @c_col = @pos0 + @pos # Single-line: already 1-indexed
937
- end
936
+ # Unified cursor positioning (always +1 since @pos0 is now string length)
937
+ @c_col = @pos0 + @pos + 1
938
938
  @c.col(@c_col) # Set the cursor position
939
- nextline # Then start showing the completion items
939
+ nextline # Show items below
940
940
  tabline = @tabarray[i] # Get the next matching tabline
941
941
  # Add executable indicator
942
942
  display_item = tabline.dup
@@ -1205,17 +1205,29 @@ def config(*args) # Configure rsh settings
1205
1205
  value = args[1]
1206
1206
 
1207
1207
  if setting.nil?
1208
- # Show current configuration
1208
+ # Show current configuration with aligned columns
1209
1209
  puts "\n Current Configuration:".c(@c_prompt).b
1210
- puts " history_dedup: #{@history_dedup}"
1211
- puts " session_autosave: #{@session_autosave}s #{@session_autosave > 0 ? '(enabled)' : '(disabled)'}"
1212
- puts " auto_correct: #{@auto_correct ? 'on' : 'off'}"
1213
- puts " slow_command_threshold: #{@slow_command_threshold}s #{@slow_command_threshold > 0 ? '(enabled)' : '(disabled)'}"
1214
- puts " completion_learning: #{@completion_learning ? 'on' : 'off'}"
1215
- puts " show_tips: #{@show_tips ? 'on' : 'off'}"
1216
- puts " completion_limit: #{@completion_limit}"
1217
- puts " completion_fuzzy: #{@completion_fuzzy}"
1218
- puts " completion_case_sensitive: #{@completion_case_sensitive}"
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
1219
1231
  puts
1220
1232
  return
1221
1233
  end
@@ -1500,6 +1512,7 @@ def rshrc # Write user configuration to .rshrc (portable between machines)
1500
1512
  conf = persist_var(conf, '@auto_correct', @auto_correct, @auto_correct)
1501
1513
  conf = persist_var(conf, '@slow_command_threshold', @slow_command_threshold, @slow_command_threshold && @slow_command_threshold > 0)
1502
1514
  conf = persist_var(conf, '@completion_learning', @completion_learning, !@completion_learning)
1515
+ conf = persist_var(conf, '@show_tips', @show_tips, !@show_tips)
1503
1516
  conf = persist_var(conf, '@completion_show_metadata', @completion_show_metadata, @completion_show_metadata)
1504
1517
  conf = persist_var(conf, '@plugin_disabled', @plugin_disabled, !@plugin_disabled.empty?)
1505
1518
  conf = persist_var(conf, '@validation_rules', @validation_rules, !@validation_rules.empty?)
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.1
4
+ version: 3.6.3
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-05 00:00:00.000000000 Z
11
+ date: 2025-11-12 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