fatty 0.99.8.3 → 0.99.8.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f79cba23bcf8b408c343c3c732d0af6e93bdf677f3492838f3e1a16473bc05fd
4
- data.tar.gz: f3c72c60150347df09d4f8f17238566c78c4ade01bd33b73dffe3db48f462f24
3
+ metadata.gz: b46a42de2b3925689cb1b1383a85b01e143493db9271294b031eb78e3bcceb6b
4
+ data.tar.gz: 5ace58f489a5a0cfc0dfd623b76d2ff3f0074da7ceb776cbea86b25c42f49eaa
5
5
  SHA512:
6
- metadata.gz: a181c65be329a3e0ba0e4084538cee20f25f8250c98e764c9f60ededa9c95af7bda619f28a7ed54d747bbb46efb78ec5460a84263fb5ce4efdf2ba0f2b496e20
7
- data.tar.gz: abafce8dfdfa7446f229b2742b2de1cf9adcfae99e41fb66348e766153efa971bcf13de6239eef5ef2843258381bb6da268f806b2c389fa729a62a5b1703db94
6
+ metadata.gz: 1d01d6ee255dc289fe9828c96a16aaf267abdf4d3a95fb1e9eb26cee0dbdb1cc0523d66dd7f6cfd14a200a0654cb49df4c483e74b56865007e58a2365fb63e4d
7
+ data.tar.gz: 12aa3e2a67f801583f43a6de8e07dc560fb247c61d90cafe2285c49c4f12502307dde31f5c07942f982f272a3b19933f981527bb378628b4bb5a3343532f699d
@@ -155,6 +155,7 @@ module Fatty
155
155
 
156
156
  ::Curses.reset_prog_mode
157
157
  ::Curses.refresh
158
+ touch_windows!
158
159
  enable_bracketed_paste!
159
160
  nil
160
161
  end
@@ -172,6 +173,14 @@ module Fatty
172
173
  @started = false
173
174
  end
174
175
 
176
+ def touch_windows!
177
+ [@output_win, @status_win, @input_win, @alert_win].each do |win|
178
+ win.touch if win&.respond_to?(:touch)
179
+ end
180
+ ::Curses.stdscr.touch if ::Curses.respond_to?(:stdscr) && ::Curses.stdscr.respond_to?(:touch)
181
+ nil
182
+ end
183
+
175
184
  # Map a Fatty::Ansi::Style to a curses attribute.
176
185
  #
177
186
  # - If style has no explicit fg/bg, we keep the themed role pair.
@@ -519,9 +519,13 @@ module Fatty
519
519
  end
520
520
 
521
521
  def autosuggestion_suffix
522
- return "" unless autosuggestion_visible?
522
+ suggestion = autosuggestion.to_s
523
+ text = buffer.text.to_s
524
+ return "" if suggestion.empty?
525
+ return "" unless suggestion.start_with?(text)
526
+ return "" if suggestion == text
523
527
 
524
- autosuggestion.to_s.delete_prefix(buffer.text.to_s)
528
+ suggestion.delete_prefix(text)
525
529
  end
526
530
 
527
531
  def accept_autosuggestion!
@@ -24,6 +24,7 @@ module Fatty
24
24
  @line_numbers = false
25
25
  @narrow_query = nil
26
26
  @visible_lines = nil
27
+ @pending_command_reset = false
27
28
  mode = Fatty::Config.config.dig(:output, :mode)&.to_sym || :paging
28
29
  @default_output_mode = mode
29
30
  @pager = Fatty::Pager.new(output: @output, viewport: @viewport, mode: mode, lines: -> { visible_lines })
@@ -52,6 +53,7 @@ module Fatty
52
53
  []
53
54
  end
54
55
  when :append
56
+ prepare_for_command_output!
55
57
  case payload[:mode]
56
58
  when :scrolling
57
59
  pager.toggle_paging_mode if pager.mode == :paging
@@ -86,11 +88,15 @@ module Fatty
86
88
  resize_output!
87
89
  []
88
90
  when :begin_command
89
- reset_for_command!
90
- pager.begin_command!(anchor: output.lines.length)
91
+ @narrow_query = nil
92
+ invalidate_visible_lines!
93
+ @pending_command_reset = true
91
94
  []
92
95
  when :finish_command
93
- pager.finish_command!
96
+ unless @pending_command_reset
97
+ pager.finish_command!
98
+ end
99
+ @pending_command_reset = false
94
100
  []
95
101
  when :quit_paging
96
102
  pager.quit
@@ -509,6 +515,14 @@ module Fatty
509
515
  @pager.reset!(mode: mode)
510
516
  end
511
517
 
518
+ def prepare_for_command_output!
519
+ return unless @pending_command_reset
520
+
521
+ reset_for_command!
522
+ pager.begin_command!(anchor: output.lines.length)
523
+ @pending_command_reset = false
524
+ end
525
+
512
526
  # When the pager is active, the last output row is reserved for the pager
513
527
  # InputField. This returns the viewport to use for rendering the output
514
528
  # content itself.
@@ -97,6 +97,7 @@ module Fatty
97
97
  @last_render_time = nil
98
98
  @restore_cursor_after_render = true
99
99
  @render_count = 0
100
+ @deferred_render = false
100
101
  @deferred_count = 0
101
102
  end
102
103
 
@@ -161,6 +162,9 @@ module Fatty
161
162
  loop_count = 0
162
163
  while @running
163
164
  loop_count += 1
165
+ deferred_render = @deferred_render
166
+ @deferred_render = false
167
+ render_frame if deferred_render
164
168
  @session_dirty = false
165
169
  @immediate_render = false
166
170
  if (cmd = event_source.next_event)
@@ -194,8 +198,11 @@ module Fatty
194
198
  yield
195
199
  ensure
196
200
  ctx.resume
201
+ reconcile_terminal_size!
197
202
  renderer.invalidate!
203
+ renderer.clear_physical_screen! if renderer.context.truecolor
198
204
  render_frame
205
+ @deferred_render = true
199
206
  end
200
207
 
201
208
  # A command is either bound for this Terminal or it's meant to be
@@ -470,9 +477,9 @@ module Fatty
470
477
  command.action == :resize
471
478
  end
472
479
 
473
- def handle_resize
474
- rows = ::Curses.lines
475
- cols = ::Curses.cols
480
+ def handle_resize(rows: nil, cols: nil)
481
+ rows ||= ::Curses.lines
482
+ cols ||= ::Curses.cols
476
483
  size = [rows, cols]
477
484
 
478
485
  return [] if size == @last_handled_resize_size
@@ -520,6 +527,22 @@ module Fatty
520
527
  @inside_resize_term = false if did_resize_term
521
528
  end
522
529
 
530
+ def reconcile_terminal_size!
531
+ return unless @screen && @ctx
532
+
533
+ rows, cols = STDOUT.winsize
534
+ return if rows.to_i <= 0 || cols.to_i <= 0
535
+
536
+ if [rows, cols] == [@screen.rows, @screen.cols]
537
+ @ctx.apply_layout(@screen)
538
+ renderer.screen = @screen
539
+ else
540
+ handle_resize(rows:, cols:)
541
+ end
542
+ rescue SystemCallError, IOError
543
+ nil
544
+ end
545
+
523
546
  # --- Initialization ---------------------------------------------------------
524
547
 
525
548
  #
data/lib/fatty/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fatty
4
- VERSION = "0.99.8.3"
4
+ VERSION = "0.99.8.4"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fatty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.8.3
4
+ version: 0.99.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-09-08 00:00:00.000000000 Z
10
+ date: 2026-09-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: curses