hyperlist 1.5.0 → 1.5.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/hyperlist +46 -31
  3. data/hyperlist.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e9aaa16290fdb66f194d55acfd1120e20b7b5c4f8b49203c20967580738cc4d
4
- data.tar.gz: 8155928a2850fff84d471b287f45f38e490d907cb172dba0e18fbd8da06e18ea
3
+ metadata.gz: d906cdf818500e49cb3911de90fec6dc30c2de1d8b184a6ea1f59f6055776263
4
+ data.tar.gz: d35bd7c1a80843e9167e9ff30321dec10b7f91269a888870dbf655961c3b1f58
5
5
  SHA512:
6
- metadata.gz: 1df02a40d21b232190692f1bc7a2e08b516fa66e0a8a35743efd8743bceabe1548ea3b20bc3ab5a8f277558467af98c8bc8c8bece6322154471e40ba0dd2ab18
7
- data.tar.gz: 8cbfa174bec6a8f3043942bd212f8b3b24548fe1ec1e42b4ef183f9db37bdd6dc0c934945bf99a29c85638b4a5d098c917d0e150c53feda7637e3e18f752075e
6
+ metadata.gz: 531069f6958c4056feab35ff0db6124801501741248ec773e8582134f289d42ed9c37fc77ae25c58e45c0aa06d5c80deb114b91bc3b89d8358c482219c0d497d
7
+ data.tar.gz: 67bb2e44b183907672c08a58971149ff59297f7d800e8d1ed9156b7e27f5a04d7ec0c1acf205656c6ce813e7047eec723a6db727f5ae0cdac908e3d28a4e25b5
data/hyperlist CHANGED
@@ -7,7 +7,7 @@
7
7
  # Check for help/version BEFORE loading any libraries
8
8
  if ARGV[0] == '-h' || ARGV[0] == '--help'
9
9
  puts <<~HELP
10
- HyperList v1.4.3 - Terminal User Interface for HyperList files
10
+ HyperList v1.5.1 - Terminal User Interface for HyperList files
11
11
 
12
12
  USAGE
13
13
  hyperlist [OPTIONS] [FILE]
@@ -52,7 +52,7 @@ if ARGV[0] == '-h' || ARGV[0] == '--help'
52
52
  HELP
53
53
  exit 0
54
54
  elsif ARGV[0] == '-v' || ARGV[0] == '--version'
55
- puts "HyperList v1.4.0"
55
+ puts "HyperList v1.5.1"
56
56
  exit 0
57
57
  end
58
58
 
@@ -72,7 +72,7 @@ class HyperListApp
72
72
  include Rcurses::Input
73
73
  include Rcurses::Cursor
74
74
 
75
- VERSION = "1.5.0"
75
+ VERSION = "1.5.1"
76
76
 
77
77
  def initialize(filename = nil)
78
78
  @filename = filename ? File.expand_path(filename) : nil
@@ -135,9 +135,6 @@ class HyperListApp
135
135
  @cols = ENV['COLUMNS']&.to_i || 80
136
136
  end
137
137
 
138
- # Debug: uncomment to see terminal size
139
- # puts "Terminal size: #{@rows}x#{@cols}"
140
-
141
138
  # Setup terminal resize handler
142
139
  setup_resize_handler
143
140
 
@@ -175,9 +172,8 @@ class HyperListApp
175
172
  # This is how RTFM works - it passes colored command output to panes with nil colors
176
173
  @main = Pane.new(1, 1, split_width - 1, @rows - 1, nil, nil)
177
174
  @split_pane = Pane.new(split_width + 1, 1, split_width - 1, @rows - 1, nil, nil)
178
- # Footer: Use @rows for y-position (this puts it at the actual bottom)
179
175
  @footer = Pane.new(1, @rows, @cols, 1, 15, 8)
180
-
176
+
181
177
  # Add separator with explicit background to overwrite emoji overflow
182
178
  @separator = Pane.new(split_width, 1, 1, @rows - 1, 15, 0)
183
179
  # Build separator with explicit clearing
@@ -192,7 +188,6 @@ class HyperListApp
192
188
  # Use nil colors like RTFM to avoid ANSI wrapping issues
193
189
  # This prevents the corruption that happens with narrow terminals
194
190
  @main = Pane.new(1, 1, @cols, @rows - 1, nil, nil)
195
- # Footer: Use @rows for y-position (this puts it at the actual bottom)
196
191
  @footer = Pane.new(1, @rows, @cols, 1, 15, 8)
197
192
  end
198
193
  end
@@ -661,7 +656,6 @@ class HyperListApp
661
656
  content += "\n" unless content.end_with?("\n")
662
657
  content += "\n" + @config_line
663
658
  else
664
- # Debug: Check why config line is missing
665
659
  if @fold_level != 99
666
660
  # Rebuild config line if we have config settings but no line
667
661
  update_config_line
@@ -1604,17 +1598,33 @@ class HyperListApp
1604
1598
  def has_children?(idx, items)
1605
1599
  return false if idx >= items.length - 1
1606
1600
  return false if idx < 0
1607
-
1601
+
1608
1602
  current_item = items[idx]
1609
1603
  next_item = items[idx + 1]
1610
-
1604
+
1611
1605
  # For visible items array
1612
1606
  if current_item.is_a?(Hash) && next_item.is_a?(Hash)
1613
1607
  return next_item["level"] > current_item["level"]
1614
1608
  end
1615
-
1609
+
1616
1610
  false
1617
1611
  end
1612
+
1613
+ def get_last_descendant_index(idx, items)
1614
+ # Find the index after the last descendant of item at idx
1615
+ # Returns idx + 1 if no children
1616
+ return idx + 1 if idx >= items.length - 1
1617
+ return idx + 1 unless has_children?(idx, items)
1618
+
1619
+ current_level = items[idx]["level"]
1620
+ last_idx = idx + 1
1621
+
1622
+ while last_idx < items.length && items[last_idx]["level"] > current_level
1623
+ last_idx += 1
1624
+ end
1625
+
1626
+ last_idx
1627
+ end
1618
1628
 
1619
1629
  def indent_split_right(with_children = false)
1620
1630
  visible_items = get_visible_split_items
@@ -2251,13 +2261,21 @@ class HyperListApp
2251
2261
 
2252
2262
  def insert_line_with_text(text)
2253
2263
  return unless text && !text.strip.empty?
2254
-
2264
+
2255
2265
  save_undo_state # Save state before modification
2256
2266
  visible = get_visible_items
2257
2267
  if @current < visible.length
2258
2268
  level = visible[@current]["level"]
2259
2269
  real_idx = get_real_index(visible[@current])
2260
- @items.insert(real_idx + 1, {"text" => text, "level" => level, "fold" => false})
2270
+
2271
+ # If current item has collapsed children, insert after all descendants
2272
+ if @items[real_idx]["fold"] && has_children?(real_idx, @items)
2273
+ insert_idx = get_last_descendant_index(real_idx, @items)
2274
+ else
2275
+ insert_idx = real_idx + 1
2276
+ end
2277
+
2278
+ @items.insert(insert_idx, {"text" => text, "level" => level, "fold" => false})
2261
2279
  else
2262
2280
  @items << {"text" => text, "level" => 0, "fold" => false}
2263
2281
  end
@@ -2297,17 +2315,26 @@ class HyperListApp
2297
2315
 
2298
2316
  def insert_child_with_text(text)
2299
2317
  return unless text && !text.strip.empty?
2300
-
2318
+
2301
2319
  save_undo_state # Save state before modification
2302
2320
  visible = get_visible_items
2303
2321
  if @current < visible.length
2304
2322
  level = visible[@current]["level"] + 1
2305
2323
  real_idx = get_real_index(visible[@current])
2306
-
2324
+
2325
+ # If current item has collapsed children, insert as last child
2326
+ if @items[real_idx]["fold"] && has_children?(real_idx, @items)
2327
+ # Insert just before the next sibling (at the end of all descendants)
2328
+ insert_idx = get_last_descendant_index(real_idx, @items)
2329
+ else
2330
+ # No collapsed children, insert right after current item
2331
+ insert_idx = real_idx + 1
2332
+ end
2333
+
2307
2334
  # Unfold parent if needed
2308
2335
  @items[real_idx]["fold"] = false
2309
-
2310
- @items.insert(real_idx + 1, {"text" => text, "level" => level, "fold" => false})
2336
+
2337
+ @items.insert(insert_idx, {"text" => text, "level" => level, "fold" => false})
2311
2338
  else
2312
2339
  @items << {"text" => text, "level" => 1, "fold" => false}
2313
2340
  end
@@ -4003,13 +4030,6 @@ class HyperListApp
4003
4030
  begin
4004
4031
  c = getchr
4005
4032
 
4006
- # Debug logging
4007
- if ENV['DEBUG']
4008
- File.open('/tmp/hyperlist_debug.log', 'a') do |f|
4009
- f.puts "Password prompt key: #{c.inspect}"
4010
- end
4011
- end
4012
-
4013
4033
  case c
4014
4034
  when "ENTER", "\r", "\n"
4015
4035
  break
@@ -4676,11 +4696,6 @@ class HyperListApp
4676
4696
  # Skip truly nil input
4677
4697
  next if c.nil?
4678
4698
 
4679
- # Debug logging to file
4680
- File.open('/tmp/hyperlist_debug.log', 'a') do |f|
4681
- f.puts "Template key received: #{c.inspect} (length: #{c.length}, ord: #{c.bytes.inspect})"
4682
- end if ENV['DEBUG']
4683
-
4684
4699
  case c
4685
4700
  when "q", "ESC", "C-c", "Q"
4686
4701
  exit_loop = true
data/hyperlist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "hyperlist"
3
- spec.version = "1.5.0"
3
+ spec.version = "1.5.1"
4
4
  spec.authors = ["Geir Isene"]
5
5
  spec.email = ["g@isene.com"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: "."
10
10
  cert_chain: []
11
- date: 2025-09-03 00:00:00.000000000 Z
11
+ date: 2025-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses