hostty 1.0.0 → 1.1.0

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/docs/assets/demo.svg +405 -126
  3. data/docs/features/stopping.md +12 -2
  4. data/lib/hostty/cli.rb +5 -1
  5. data/lib/hostty/config/loader.rb +4 -1
  6. data/lib/hostty/config/rules/path_settings.rb +3 -1
  7. data/lib/hostty/config/validator.rb +5 -1
  8. data/lib/hostty/ghostty/cell_reader.rb +1 -0
  9. data/lib/hostty/ghostty/mouse.rb +3 -1
  10. data/lib/hostty/ghostty/screen.rb +5 -1
  11. data/lib/hostty/ghostty/style_decoder.rb +3 -1
  12. data/lib/hostty/manager/child.rb +4 -1
  13. data/lib/hostty/manager/countdown.rb +39 -0
  14. data/lib/hostty/manager/events.rb +3 -1
  15. data/lib/hostty/manager.rb +47 -17
  16. data/lib/hostty/output.rb +8 -2
  17. data/lib/hostty/plain/app.rb +4 -1
  18. data/lib/hostty/plain/pipe.rb +9 -2
  19. data/lib/hostty/port_chooser.rb +18 -3
  20. data/lib/hostty/terminal/cell.rb +3 -1
  21. data/lib/hostty/terminal/style.rb +22 -5
  22. data/lib/hostty/tui/app.rb +14 -3
  23. data/lib/hostty/tui/blink.rb +5 -1
  24. data/lib/hostty/tui/canvas.rb +5 -1
  25. data/lib/hostty/tui/desktop.rb +11 -3
  26. data/lib/hostty/tui/display.rb +3 -1
  27. data/lib/hostty/tui/input.rb +7 -1
  28. data/lib/hostty/tui/mouse/idle.rb +4 -1
  29. data/lib/hostty/tui/mouse/pointer.rb +4 -1
  30. data/lib/hostty/tui/mouse/selecting.rb +4 -1
  31. data/lib/hostty/tui/mouse/target.rb +3 -1
  32. data/lib/hostty/tui/pane.rb +8 -1
  33. data/lib/hostty/tui/pty.rb +14 -0
  34. data/lib/hostty/tui/reactor.rb +4 -1
  35. data/lib/hostty/tui/regions/pane_view.rb +4 -1
  36. data/lib/hostty/tui/regions/tab_bar.rb +18 -4
  37. data/lib/hostty/tui/renderer.rb +5 -1
  38. data/lib/hostty/tui/selection.rb +3 -1
  39. data/lib/hostty/tui/sources/stdin.rb +4 -1
  40. data/lib/hostty/tui/tabs.rb +3 -1
  41. data/lib/hostty/tui/window.rb +5 -1
  42. data/lib/hostty/version.rb +1 -1
  43. data/lib/hostty.rb +1 -0
  44. metadata +2 -1
@@ -45,10 +45,20 @@ Hostty prints each step:
45
45
  12:10:00 hostty | jobs exited with code 143.
46
46
  ```
47
47
 
48
- When a process does not exit in time:
48
+ When a process is slow to exit, hostty names it and counts down:
49
49
 
50
50
  ```text
51
- 12:10:10 hostty | Killing the processes that are still running.
51
+ 12:10:01 hostty | Waiting for jobs, 9 seconds left. Press Ctrl-C to send KILL now.
52
+ 12:10:04 hostty | Waiting for jobs, 6 seconds left. Press Ctrl-C to send KILL now.
53
+ 12:10:07 hostty | Waiting for jobs, 3 seconds left. Press Ctrl-C to send KILL now.
54
+ 12:10:10 hostty | Killing jobs.
55
+ ```
56
+
57
+ When a process still runs 5 seconds after KILL, hostty exits without it:
58
+
59
+ ```text
60
+ 12:10:11 hostty | Waiting for jobs, 4 seconds left. Press Ctrl-C to stop waiting.
61
+ 12:10:15 hostty | Stopped waiting. Still running: jobs.
52
62
  ```
53
63
 
54
64
  The `--timeout` option sets the first wait. It defaults to 10 seconds. Give a slow process, such as Solid Queue finishing its running jobs, more time with a higher value.
data/lib/hostty/cli.rb CHANGED
@@ -73,7 +73,11 @@ module Hostty
73
73
 
74
74
  def start
75
75
  load_ghostty if tui?
76
- config.notices.each { |notice| output.notice(notice) }
76
+
77
+ config.notices.each do |notice|
78
+ output.notice(notice)
79
+ end
80
+
77
81
  Domains.new(processes: config.processes, nginx:, output:).add
78
82
  Manager.new(processes: config.processes, front_end:, output:, stop_timeout: options[:timeout]).run
79
83
  end
@@ -71,7 +71,10 @@ module Hostty
71
71
  end
72
72
 
73
73
  def processes
74
- @processes ||= definitions.map { |definition| definition.build(port: ports.fetch(definition)) }
74
+ @processes ||=
75
+ definitions.map do |definition|
76
+ definition.build(port: ports.fetch(definition))
77
+ end
75
78
  end
76
79
  end
77
80
  end
@@ -21,7 +21,9 @@ module Hostty
21
21
  attr_reader :name, :settings
22
22
 
23
23
  def invalid_keys
24
- @invalid_keys ||= KEYS.select { |key| settings.key?(key) && !Text.new(settings[key]).present? }
24
+ @invalid_keys ||= KEYS.select do |key|
25
+ settings.key?(key) && !Text.new(settings[key]).present?
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -8,7 +8,11 @@ module Hostty
8
8
  end
9
9
 
10
10
  def call
11
- failure = rules.find { |rule| !rule.valid? }
11
+ failure =
12
+ rules.find do |rule|
13
+ !rule.valid?
14
+ end
15
+
12
16
  raise ConfigError, failure.message if failure
13
17
  end
14
18
 
@@ -54,6 +54,7 @@ module Hostty
54
54
 
55
55
  def narrow(text, style_bytes)
56
56
  cells_by_text = narrow_cells.fetch(style_bytes) { {} }
57
+
57
58
  cells_by_text[text] ||= Terminal::Cell.new(char: text, style: style_decoder.decode(style_bytes))
58
59
  end
59
60
 
@@ -55,7 +55,9 @@ module Hostty
55
55
  end
56
56
 
57
57
  def mods(mouse)
58
- Library::MODS.sum { |name, bit| mouse.public_send(:"#{name}?") ? bit : 0 }
58
+ Library::MODS.sum do |name, bit|
59
+ mouse.public_send(:"#{name}?") ? bit : 0
60
+ end
59
61
  end
60
62
 
61
63
  def position(mouse)
@@ -90,7 +90,11 @@ module Hostty
90
90
  end
91
91
 
92
92
  def send_bells
93
- @ring = FFI::Function.new(:void, %i[pointer pointer]) { |_terminal, _userdata| bell&.call }
93
+ @ring =
94
+ FFI::Function.new(:void, %i[pointer pointer]) do |_terminal, _userdata|
95
+ bell&.call
96
+ end
97
+
94
98
  Library.ghostty_terminal_set(terminal, Library::TERMINAL_OPT_BELL, @ring)
95
99
  end
96
100
 
@@ -8,7 +8,9 @@ module Hostty
8
8
  end
9
9
 
10
10
  def decode(bytes)
11
- styles.fetch(bytes) { style(*bytes.unpack("C12S<")) }
11
+ styles.fetch(bytes) do
12
+ style(*bytes.unpack("C12S<"))
13
+ end
12
14
  end
13
15
 
14
16
  private
@@ -13,7 +13,10 @@ module Hostty
13
13
 
14
14
  def start
15
15
  @pid = launch.start(process)
16
- Thread.new(pid) { |child_pid| events.push(ProcessExited.new(name:, status: Process.wait2(child_pid).last)) }
16
+
17
+ Thread.new(pid) do |child_pid|
18
+ events.push(ProcessExited.new(name:, status: Process.wait2(child_pid).last))
19
+ end
17
20
  end
18
21
 
19
22
  def signal(signal_name)
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hostty
4
+ class Manager
5
+ class Countdown
6
+ def initialize(seconds:)
7
+ @deadline = now + seconds
8
+ @reminder_at = now + FIRST_REMINDER
9
+ end
10
+
11
+ def expired?
12
+ now >= deadline
13
+ end
14
+
15
+ def next_wait
16
+ ([deadline, reminder_at].min - now).clamp(0, nil)
17
+ end
18
+
19
+ def remind
20
+ return if now < reminder_at
21
+
22
+ @reminder_at = now + REMINDER_INTERVAL
23
+ yield (deadline - now).ceil
24
+ end
25
+
26
+ private
27
+
28
+ FIRST_REMINDER = 1
29
+ REMINDER_INTERVAL = 3
30
+ private_constant :FIRST_REMINDER, :REMINDER_INTERVAL
31
+
32
+ attr_reader :deadline, :reminder_at
33
+
34
+ def now
35
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -16,7 +16,9 @@ module Hostty
16
16
  end
17
17
 
18
18
  def pop(timeout: nil)
19
- queue.pop(timeout:)&.tap { wakeup_io.read_nonblock(1, exception: false) }
19
+ queue.pop(timeout:)&.tap do
20
+ wakeup_io.read_nonblock(1, exception: false)
21
+ end
20
22
  end
21
23
 
22
24
  private
@@ -7,7 +7,11 @@ module Hostty
7
7
  @output = output
8
8
  @stop_timeout = stop_timeout
9
9
  @events = Events.new
10
- @children = processes.to_h { |process| [process.name, build_child(process)] }
10
+ @children =
11
+ processes.to_h do |process|
12
+ [process.name, build_child(process)]
13
+ end
14
+
11
15
  @running = {}
12
16
  end
13
17
 
@@ -15,7 +19,10 @@ module Hostty
15
19
 
16
20
  def run
17
21
  with_signal_traps do
18
- children.each_key { |name| start(name) }
22
+ children.each_key do |name|
23
+ start(name)
24
+ end
25
+
19
26
  front_end.wait(self)
20
27
  ensure
21
28
  stop
@@ -47,56 +54,79 @@ module Hostty
47
54
 
48
55
  attr_reader :front_end, :output, :stop_timeout, :events, :children, :running
49
56
 
57
+ def running_names = running.keys.join(", ")
58
+
50
59
  def build_child(process)
51
60
  Child.new(process:, launch: front_end.launch_for(process), events:)
52
61
  end
53
62
 
63
+ def trap_signal(signal)
64
+ trap(signal) do
65
+ events.push(SignalReceived.new(signal:))
66
+ end
67
+ end
68
+
54
69
  def with_signal_traps
55
- previous_handlers = SIGNALS.to_h { |signal| [signal, trap(signal) { events.push(SignalReceived.new(signal:)) }] }
70
+ previous_handlers = SIGNALS.to_h do |signal|
71
+ [signal, trap_signal(signal)]
72
+ end
73
+
56
74
  yield
57
75
  ensure
58
- previous_handlers&.each { |signal, handler| trap(signal, handler || "DEFAULT") }
76
+ previous_handlers&.each do |signal, handler|
77
+ trap(signal, handler || "DEFAULT")
78
+ end
59
79
  end
60
80
 
61
81
  def receive(timeout: nil)
62
- next_event(timeout:)&.tap { |event| event.announce(output) }
82
+ next_event(timeout:)&.tap do |event|
83
+ event.announce(output)
84
+ end
63
85
  end
64
86
 
65
87
  def stop
66
88
  unless running.empty?
67
89
  output.notice("Stopping all processes.")
68
90
  signal_children("TERM")
69
- kill_children unless wait_for_children(timeout: stop_timeout)
91
+ kill_children unless wait_for_children(timeout: stop_timeout, hint: "Press Ctrl-C to send KILL now.")
70
92
  end
71
93
 
72
94
  children.each_value(&:finish)
73
95
  end
74
96
 
75
- def wait_for_children(timeout:)
76
- deadline = clock + timeout
97
+ def wait_for_children(timeout:, hint:)
98
+ countdown = Countdown.new(seconds: timeout)
77
99
 
78
100
  until running.empty?
79
- event = receive(timeout: (deadline - clock).clamp(0, timeout))
80
- return false if event.nil? || event.interrupt?
101
+ event = receive(timeout: countdown.next_wait)
102
+ return false if event&.interrupt?
103
+ next if event
104
+ return false if countdown.expired?
105
+
106
+ countdown.remind do |seconds|
107
+ output.notice("Waiting for #{running_names}, #{seconds_left(seconds)}. #{hint}")
108
+ end
81
109
  end
82
110
 
83
111
  true
84
112
  end
85
113
 
86
114
  def kill_children
87
- output.notice("Killing the processes that are still running.")
115
+ output.notice("Killing #{running_names}.")
88
116
  signal_children("KILL")
89
- return if wait_for_children(timeout: KILL_TIMEOUT)
117
+ return if wait_for_children(timeout: KILL_TIMEOUT, hint: "Press Ctrl-C to stop waiting.")
90
118
 
91
- output.notice("Stopped waiting for #{running.keys.join(", ")}.")
119
+ output.notice("Stopped waiting. Still running: #{running_names}.")
92
120
  end
93
121
 
94
- def signal_children(signal_name)
95
- children.each_value { |child| child.signal(signal_name) }
122
+ def seconds_left(seconds)
123
+ "#{seconds} #{(seconds == 1) ? "second" : "seconds"} left"
96
124
  end
97
125
 
98
- def clock
99
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
126
+ def signal_children(signal_name)
127
+ children.each_value do |child|
128
+ child.signal(signal_name)
129
+ end
100
130
  end
101
131
  end
102
132
  end
data/lib/hostty/output.rb CHANGED
@@ -5,14 +5,20 @@ module Hostty
5
5
  def initialize(names:, io:)
6
6
  @io = io
7
7
  @width = [*names, NOTICE_NAME].map(&:length).max
8
- @colors = names.each_with_index.to_h { |name, index| [name, COLORS[index % COLORS.size]] }
8
+
9
+ @colors = names.each_with_index.to_h do |name, index|
10
+ [name, COLORS[index % COLORS.size]]
11
+ end
12
+
9
13
  @mutex = Mutex.new
10
14
  end
11
15
 
12
16
  def line(name, text)
13
17
  prefix = "#{Time.now.strftime("%H:%M:%S")} #{name.ljust(width)} |"
14
18
 
15
- mutex.synchronize { io.puts("#{colorize(prefix, colors.fetch(name, NOTICE_COLOR))} #{text}") }
19
+ mutex.synchronize do
20
+ io.puts("#{colorize(prefix, colors.fetch(name, NOTICE_COLOR))} #{text}")
21
+ end
16
22
  end
17
23
 
18
24
  def notice(text)
@@ -12,7 +12,10 @@ module Hostty
12
12
  end
13
13
 
14
14
  def wait(manager)
15
- manager.next_event.tap { |event| event.announce(output) }.exit_code
15
+ manager
16
+ .next_event
17
+ .tap { |event| event.announce(output) }
18
+ .exit_code
16
19
  end
17
20
 
18
21
  private
@@ -10,7 +10,12 @@ module Hostty
10
10
  def start(process)
11
11
  reader, writer = IO.pipe
12
12
  pid = spawn_process(process, writer)
13
- @reader_thread = Thread.new { forward(process.name, reader) }
13
+
14
+ @reader_thread =
15
+ Thread.new do
16
+ forward(process.name, reader)
17
+ end
18
+
14
19
  pid
15
20
  ensure
16
21
  writer&.close
@@ -44,7 +49,9 @@ module Hostty
44
49
  end
45
50
 
46
51
  def forward(name, reader)
47
- reader.each_line { |text| output.line(name, text.chomp) }
52
+ reader.each_line do |text|
53
+ output.line(name, text.chomp)
54
+ end
48
55
  rescue IOError
49
56
  nil
50
57
  ensure
@@ -25,7 +25,8 @@ module Hostty
25
25
 
26
26
  RANDOM_PORTS = 10_000..59_999
27
27
  MOVE_LIMIT = 100
28
- private_constant :RANDOM_PORTS, :MOVE_LIMIT
28
+ LISTEN_HOSTS = %w[0.0.0.0 127.0.0.1 ::1].freeze
29
+ private_constant :RANDOM_PORTS, :MOVE_LIMIT, :LISTEN_HOSTS
29
30
 
30
31
  attr_reader :skip_used_ports, :random, :owners
31
32
 
@@ -34,10 +35,18 @@ module Hostty
34
35
  end
35
36
 
36
37
  def in_use?(port)
37
- TCPServer.new("0.0.0.0", port).close
38
+ LISTEN_HOSTS.any? do |host|
39
+ bound_on?(host, port)
40
+ end
41
+ end
42
+
43
+ def bound_on?(host, port)
44
+ TCPServer.new(host, port).close
38
45
  false
39
46
  rescue Errno::EADDRINUSE, Errno::EACCES
40
47
  true
48
+ rescue Errno::EADDRNOTAVAIL
49
+ false
41
50
  end
42
51
 
43
52
  def claim(port, name)
@@ -45,9 +54,15 @@ module Hostty
45
54
  port
46
55
  end
47
56
 
57
+ def first_free_port(candidates)
58
+ candidates.find do |candidate|
59
+ free?(candidate)
60
+ end
61
+ end
62
+
48
63
  def next_free_port(name, port)
49
64
  candidates = (port + 1)..(port + MOVE_LIMIT)
50
- candidates.find { |candidate| free?(candidate) } or
65
+ first_free_port(candidates) or
51
66
  raise ConfigError, "No free port for #{name} from #{candidates.begin} to #{candidates.end}."
52
67
  end
53
68
 
@@ -19,7 +19,9 @@ module Hostty
19
19
  end
20
20
 
21
21
  def self.blank(style = Style.plain)
22
- blanks.fetch(style.bg) { new(char: " ", style: style.background) }
22
+ blanks.fetch(style.bg) do
23
+ new(char: " ", style: style.background)
24
+ end
23
25
  end
24
26
 
25
27
  def self.blanks
@@ -10,7 +10,11 @@ module Hostty
10
10
  def initialize(fg: nil, bg: nil, **flags)
11
11
  @fg = fg
12
12
  @bg = bg
13
- FLAG_CODES.each_key { |flag| instance_variable_set(:"@#{flag}", flags.fetch(flag, false)) }
13
+
14
+ FLAG_CODES.each_key do |flag|
15
+ instance_variable_set(:"@#{flag}", flags.fetch(flag, false))
16
+ end
17
+
14
18
  freeze
15
19
  end
16
20
 
@@ -23,7 +27,9 @@ module Hostty
23
27
  def hash = to_h.hash
24
28
 
25
29
  def to_h
26
- ATTRIBUTES.to_h { |attribute| [attribute, public_send(attribute)] }
30
+ ATTRIBUTES.to_h do |attribute|
31
+ [attribute, public_send(attribute)]
32
+ end
27
33
  end
28
34
 
29
35
  def background
@@ -32,7 +38,11 @@ module Hostty
32
38
 
33
39
  def sgr
34
40
  codes = [0]
35
- FLAG_CODES.each { |flag, code| codes << code if public_send(flag) }
41
+
42
+ FLAG_CODES.each do |flag, code|
43
+ codes << code if public_send(flag)
44
+ end
45
+
36
46
  codes.concat(color_codes(fg, base: 30, extended: 38))
37
47
  codes.concat(color_codes(bg, base: 40, extended: 48))
38
48
  "\e[#{codes.join(";")}m"
@@ -43,11 +53,18 @@ module Hostty
43
53
  end
44
54
 
45
55
  def self.shared(attributes)
46
- styles.fetch(attributes.values) { new(**attributes) }
56
+ styles.fetch(attributes.values) do
57
+ new(**attributes)
58
+ end
47
59
  end
48
60
 
49
61
  def self.styles
50
- @styles ||= Flyweight.new.tap { |styles| styles.fetch(plain.to_h.values) { plain } }
62
+ @styles ||=
63
+ Flyweight.new.tap do |styles|
64
+ styles.fetch(plain.to_h.values) do
65
+ plain
66
+ end
67
+ end
51
68
  end
52
69
  private_class_method :styles
53
70
 
@@ -14,14 +14,25 @@ module Hostty
14
14
  end
15
15
 
16
16
  def launch_for(process)
17
- Pane.new(name: process.name, url: process.url, rows: layout.pane_rows, cols: layout.cols).tap { |pane| tabs.add(pane) }
17
+ Pane.new(name: process.name, url: process.url, rows: layout.pane_rows, cols: layout.cols).tap do |pane|
18
+ tabs.add(pane)
19
+ end
18
20
  end
19
21
 
20
22
  def wait(manager)
21
23
  @manager = manager
22
- tabs.each { |pane| pane.subscribe(activity) }
23
- with_terminal { cycle until outcome.decided? }
24
+
25
+ tabs.each do |pane|
26
+ pane.subscribe(activity)
27
+ end
28
+
29
+ with_terminal do
30
+ cycle until outcome.decided?
31
+ end
32
+
24
33
  outcome.exit_code
34
+ ensure
35
+ tabs.each(&:discard_output)
25
36
  end
26
37
 
27
38
  private
@@ -15,7 +15,11 @@ module Hostty
15
15
  end
16
16
 
17
17
  def tick
18
- timer.fire { flash } if ringing?
18
+ if ringing?
19
+ timer.fire do
20
+ flash
21
+ end
22
+ end
19
23
  end
20
24
 
21
25
  private
@@ -26,7 +26,11 @@ module Hostty
26
26
  end
27
27
 
28
28
  def tick
29
- frame.fire { draw } if dirty?
29
+ if dirty?
30
+ frame.fire do
31
+ draw
32
+ end
33
+ end
30
34
  end
31
35
 
32
36
  private
@@ -38,17 +38,25 @@ module Hostty
38
38
  def copy_with_command(text)
39
39
  return unless clipboard_command
40
40
 
41
- IO.popen(clipboard_command, "w", err: File::NULL) { |pipe| pipe.write(text) }
41
+ IO.popen(clipboard_command, "w", err: File::NULL) do |pipe|
42
+ pipe.write(text)
43
+ end
42
44
  rescue SystemCallError, IOError
43
45
  nil
44
46
  end
45
47
 
46
48
  def clipboard_command
47
- @clipboard_command ||= CLIPBOARD_COMMANDS.find { |command| installed?(command.first) }
49
+ @clipboard_command ||=
50
+ CLIPBOARD_COMMANDS.find do |command|
51
+ installed?(command.first)
52
+ end
48
53
  end
49
54
 
50
55
  def installed?(name)
51
- ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).any? { |dir| File.executable?(File.join(dir, name)) }
56
+ ENV
57
+ .fetch("PATH", "")
58
+ .split(File::PATH_SEPARATOR)
59
+ .any? { |dir| File.executable?(File.join(dir, name)) }
52
60
  end
53
61
  end
54
62
  end
@@ -16,7 +16,9 @@ module Hostty
16
16
  def cursor = regions.lazy.filter_map(&:cursor).first
17
17
 
18
18
  def press(row:, col:, &)
19
- regions.any? { |region| region.press(row:, col:, &) }
19
+ regions.any? do |region|
20
+ region.press(row:, col:, &)
21
+ end
20
22
  end
21
23
 
22
24
  private
@@ -58,11 +58,17 @@ module Hostty
58
58
  button: (code.anybits?(64) ? WHEEL_BUTTONS : BUTTONS)[code & 0b11],
59
59
  row: match[3].to_i - 1,
60
60
  col: match[2].to_i - 1,
61
- modifiers: MODIFIER_BITS.filter_map { |name, bit| name if code.anybits?(bit) }
61
+ modifiers: mouse_modifiers(code)
62
62
  )
63
63
  Events::MouseReport.new(mouse: event) if event.button
64
64
  end
65
65
 
66
+ def mouse_modifiers(code)
67
+ MODIFIER_BITS.filter_map do |name, bit|
68
+ name if code.anybits?(bit)
69
+ end
70
+ end
71
+
66
72
  def mouse_action(code, final)
67
73
  return :release if final == "m"
68
74
 
@@ -19,7 +19,10 @@ module Hostty
19
19
  def tick(_target) = self
20
20
 
21
21
  def press(event, target)
22
- target.press(event) { |pointer| return Selecting.new(pointer:, clock:) }
22
+ target.press(event) do |pointer|
23
+ return Selecting.new(pointer:, clock:)
24
+ end
25
+
23
26
  self
24
27
  end
25
28
 
@@ -19,7 +19,10 @@ module Hostty
19
19
  end
20
20
 
21
21
  def tick
22
- @state = state.tick(target) { canvas.invalidate }
22
+ @state =
23
+ state.tick(target) do
24
+ canvas.invalidate
25
+ end
23
26
  end
24
27
 
25
28
  private
@@ -17,7 +17,10 @@ module Hostty
17
17
  end
18
18
 
19
19
  def press(event, target)
20
- target.press(event) { |point| @pointer = point }
20
+ target.press(event) do |point|
21
+ @pointer = point
22
+ end
23
+
21
24
  self
22
25
  end
23
26
 
@@ -23,7 +23,9 @@ module Hostty
23
23
  end
24
24
 
25
25
  def drag(event)
26
- point(event).tap { |point| selected.select_to(**point) }
26
+ point(event).tap do |point|
27
+ selected.select_to(**point)
28
+ end
27
29
  end
28
30
 
29
31
  def release(event)