claude-inbox 0.14.3 → 0.14.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 +4 -4
- data/lib/claude_inbox/input.rb +12 -4
- data/lib/claude_inbox/mouse.rb +13 -6
- data/lib/claude_inbox/renderer.rb +5 -2
- data/lib/claude_inbox/text.rb +1 -0
- data/lib/claude_inbox.rb +1 -1
- 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: ed40b9c11c703427940ad961d9f114e815c8af02090d8dd2b614971a1a578f4b
|
|
4
|
+
data.tar.gz: 21e8cbb5fac27662d14cf77dd40673c36b9f254618fcb029cef73b8cbee56dfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a464b6c6d6e97943dc66e66e2f3b6ed42eb4e839e878a54afb8fca8e8b5d46a51176180dd3231e178f92ce1b63cca49c755a1e36731b6740acb1d370143cb7f
|
|
7
|
+
data.tar.gz: 4e959e5f8b45042c7d19b40616865fa62830fca5b788313392eae6e006cbcf780e3549f253c6086913eecbd344f4d8e9e6480f13c75ae25efe6b34825d98468d
|
data/lib/claude_inbox/input.rb
CHANGED
|
@@ -13,6 +13,9 @@ module ClaudeInbox
|
|
|
13
13
|
# is taken as Option held with it.
|
|
14
14
|
ALT = /\A\e([a-z])\z/
|
|
15
15
|
|
|
16
|
+
# A nonblocking read can end partway through a mouse report.
|
|
17
|
+
UNFINISHED_REPORT = /\e\[<[\d;]*\z/
|
|
18
|
+
|
|
16
19
|
def self.alt?(name) = name.to_s.start_with?("alt_")
|
|
17
20
|
|
|
18
21
|
# An Option chord as the quick Esc-then-letter it may also have been.
|
|
@@ -22,6 +25,7 @@ module ClaudeInbox
|
|
|
22
25
|
@input = input
|
|
23
26
|
@reader = TTY::Reader.new(input: input, output: out, interrupt: :noop)
|
|
24
27
|
@paste = Paste.new
|
|
28
|
+
@held = +""
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
def pasting? = @paste.pasting?
|
|
@@ -33,13 +37,17 @@ module ClaudeInbox
|
|
|
33
37
|
|
|
34
38
|
# `[:paste, text]`, `[:mouse, event]` and `[:key, name, raw]`, in the
|
|
35
39
|
# order they arrived; `name` is the reader's symbol for a key it knows,
|
|
36
|
-
# else the raw string.
|
|
40
|
+
# else the raw string. The head of a report cut off at the end of a read
|
|
41
|
+
# waits for the rest instead of being typed.
|
|
37
42
|
def events(raw)
|
|
38
43
|
@paste.feed(raw).flat_map do |kind, text|
|
|
39
44
|
next [[:paste, text]] if kind == :paste
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
text = @held + text
|
|
46
|
+
@held = text[UNFINISHED_REPORT] || +""
|
|
47
|
+
Mouse.split(text.delete_suffix(@held)).flat_map do |piece|
|
|
48
|
+
next [[:mouse, piece]] if piece.is_a?(Mouse::Event)
|
|
49
|
+
split_keys(piece).map { |k| [:key, key_name(k), k] }
|
|
50
|
+
end
|
|
43
51
|
end
|
|
44
52
|
end
|
|
45
53
|
|
data/lib/claude_inbox/mouse.rb
CHANGED
|
@@ -10,14 +10,21 @@ module ClaudeInbox
|
|
|
10
10
|
|
|
11
11
|
Event = Struct.new(:kind, :row, :col)
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
def self.
|
|
17
|
-
|
|
13
|
+
# The read cut at its reports, in order: an Event per report acted on,
|
|
14
|
+
# the keys between as strings. An ignored report still cuts, so the keys
|
|
15
|
+
# either side of it never join into one.
|
|
16
|
+
def self.split(raw)
|
|
17
|
+
out = []
|
|
18
|
+
rest = raw
|
|
19
|
+
while (m = SEQUENCE.match(rest))
|
|
20
|
+
out << m.pre_match unless m.pre_match.empty?
|
|
21
|
+
cb, col, row, type = m.captures
|
|
18
22
|
kind = kind_for(cb.to_i, type)
|
|
19
|
-
Event.new(kind, row.to_i, col.to_i) if kind
|
|
23
|
+
out << Event.new(kind, row.to_i, col.to_i) if kind
|
|
24
|
+
rest = m.post_match
|
|
20
25
|
end
|
|
26
|
+
out << rest unless rest.empty?
|
|
27
|
+
out
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
# Bit 6 (0x40) marks a wheel tick, direction in bit 0. Otherwise bits
|
|
@@ -14,9 +14,12 @@ module ClaudeInbox
|
|
|
14
14
|
# The same frame for a terminal drawn without color.
|
|
15
15
|
def plain = self.class.new(lines.map { |l| l.gsub(Text::CSI, "") }, items, top)
|
|
16
16
|
|
|
17
|
+
# Only the row under the pointer is scanned: every keystroke paints a
|
|
18
|
+
# frame, and scanning the whole screen for links each time cost more
|
|
19
|
+
# than the key repeat interval.
|
|
17
20
|
def link_at(row, col)
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
line = lines[row - 1] if row >= 1
|
|
22
|
+
Text.links(line).find { |link| link.columns.cover?(col - 1) } if line
|
|
20
23
|
end
|
|
21
24
|
end
|
|
22
25
|
|
data/lib/claude_inbox/text.rb
CHANGED
data/lib/claude_inbox.rb
CHANGED