typr 1.8.0 → 1.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/browser.rb +80 -12
- data/lib/grid.rb +61 -21
- data/lib/line.rb +41 -7
- data/lib/space.rb +113 -8
- data/lib/stack.rb +62 -14
- data/lib/terminal.rb +377 -55
- data/lib/text.rb +42 -7
- data/lib/typr.rb +4 -2
- data/typr.gemspec +2 -2
- metadata +2 -2
data/lib/text.rb
CHANGED
|
@@ -22,7 +22,12 @@ module Typr
|
|
|
22
22
|
|
|
23
23
|
class Text < Stack
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
##
|
|
26
|
+
# Tabstop width in spaces applied by {#build}. Default: 2.
|
|
27
|
+
#
|
|
28
|
+
# text.tabspace = 4
|
|
29
|
+
# text.tabspace #=> 4
|
|
30
|
+
|
|
26
31
|
attr_accessor :tabspace
|
|
27
32
|
|
|
28
33
|
# Rebuilds the internal line buffer from +input+.
|
|
@@ -173,15 +178,31 @@ module Typr
|
|
|
173
178
|
step
|
|
174
179
|
end
|
|
175
180
|
|
|
176
|
-
##
|
|
181
|
+
##
|
|
182
|
+
# Jump to the next match of the last search (wrap-around).
|
|
183
|
+
#
|
|
184
|
+
# text.search_next #=> 12 (next matching line id, or nil)
|
|
185
|
+
#
|
|
186
|
+
# @return [Integer, nil] matched line id
|
|
177
187
|
|
|
178
188
|
def search_next; @search[:dir] = :forward; step end
|
|
179
189
|
|
|
180
|
-
##
|
|
190
|
+
##
|
|
191
|
+
# Jump to the previous match of the last search (wrap-around).
|
|
192
|
+
#
|
|
193
|
+
# text.search_prev #=> 12 (previous matching line id, or nil)
|
|
194
|
+
#
|
|
195
|
+
# @return [Integer, nil] matched line id
|
|
181
196
|
|
|
182
197
|
def search_prev; @search[:dir] = :backward; step end
|
|
183
198
|
|
|
184
|
-
##
|
|
199
|
+
##
|
|
200
|
+
# Recompute the set of lines containing the current pattern (called
|
|
201
|
+
# by {#search} and {#build}).
|
|
202
|
+
#
|
|
203
|
+
# text.highlight # @search[:matches] updated
|
|
204
|
+
#
|
|
205
|
+
# @return [nil]
|
|
185
206
|
|
|
186
207
|
def highlight
|
|
187
208
|
@search[:matches] = @re ?
|
|
@@ -190,7 +211,12 @@ module Typr
|
|
|
190
211
|
return
|
|
191
212
|
end
|
|
192
213
|
|
|
193
|
-
##
|
|
214
|
+
##
|
|
215
|
+
# Clear the search pattern and all match highlights.
|
|
216
|
+
#
|
|
217
|
+
# text.highlight_clear # matches => [], pattern => nil
|
|
218
|
+
#
|
|
219
|
+
# @return [nil]
|
|
194
220
|
|
|
195
221
|
def highlight_clear
|
|
196
222
|
@re = @search[:pattern] = nil
|
|
@@ -215,8 +241,17 @@ module Typr
|
|
|
215
241
|
self << @input
|
|
216
242
|
end
|
|
217
243
|
|
|
218
|
-
|
|
219
|
-
#
|
|
244
|
+
##
|
|
245
|
+
# Reset state: +:search+ clears the pattern and highlights, +:all+
|
|
246
|
+
# resets position, selection, and search; anything else falls through
|
|
247
|
+
# to {Stack#reset}.
|
|
248
|
+
#
|
|
249
|
+
# text.reset :search
|
|
250
|
+
# text.reset :all
|
|
251
|
+
#
|
|
252
|
+
# @param type [:search, :all, :position, :selection, Array<Symbol>]
|
|
253
|
+
# @return [void]
|
|
254
|
+
|
|
220
255
|
def reset type=:all
|
|
221
256
|
case type
|
|
222
257
|
when :search; highlight_clear
|
data/lib/typr.rb
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
#
|
|
6
6
|
# * Typr::Grid - Sortable, filterable table with formatted columns and row selection
|
|
7
7
|
# * Typr::Text - Scrollable text viewer with word/line picking and search
|
|
8
|
-
# * Typr::Browser - File-system directory browser with MIME type detection
|
|
8
|
+
# * Typr::Browser - File-system directory browser with MIME type detection,
|
|
9
|
+
# live / narrowing, mark/range selection, and a rebindable keybar
|
|
9
10
|
# * Typr::Stack - Scrollable container with keyboard navigation and hint overlays
|
|
10
11
|
# * Typr::Space - Base layout primitive with border drawing
|
|
11
|
-
# * Typr::Line - Interactive prompt/input with colored questions and
|
|
12
|
+
# * Typr::Line - Interactive prompt/input with colored questions and
|
|
13
|
+
# answers, ask question types, and shell command-line completion
|
|
12
14
|
#
|
|
13
15
|
# == Terminal Control
|
|
14
16
|
#
|
data/typr.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: typr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kilian Reitmayr
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-10-
|
|
10
|
+
date: 2026-10-12 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: unicode-display_width
|