rufio 0.34.0 → 0.40.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 +54 -0
- data/bin/rufio +17 -2
- data/docs/{CHANGELOG_v0.34.0.md → CHANGELOG_v0.33.0.md} +2 -2
- data/docs/CHANGELOG_v0.40.0.md +416 -0
- data/lib/rufio/application.rb +2 -2
- data/lib/rufio/color_helper.rb +59 -6
- data/lib/rufio/command_mode_ui.rb +18 -0
- data/lib/rufio/dialog_renderer.rb +68 -0
- data/lib/rufio/keybind_handler.rb +53 -2
- data/lib/rufio/plugins/stop.rb +32 -0
- data/lib/rufio/renderer.rb +64 -0
- data/lib/rufio/screen.rb +184 -0
- data/lib/rufio/terminal_ui.rb +557 -34
- data/lib/rufio/text_utils.rb +30 -18
- data/lib/rufio/version.rb +1 -1
- data/lib/rufio.rb +2 -0
- metadata +7 -3
data/lib/rufio/text_utils.rb
CHANGED
|
@@ -18,10 +18,12 @@ module Rufio
|
|
|
18
18
|
# Line break constants
|
|
19
19
|
BREAK_POINT_THRESHOLD = 0.5 # Break after 50% of max_width
|
|
20
20
|
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
# Character width cache (memo化)
|
|
22
|
+
@char_width_cache = {}
|
|
23
|
+
|
|
24
|
+
# Calculate width for a single character with caching
|
|
25
|
+
def char_width(char)
|
|
26
|
+
@char_width_cache[char] ||= begin
|
|
25
27
|
case char
|
|
26
28
|
when /[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF\uFF00-\uFFEF\u2500-\u257F\u2580-\u259F]/
|
|
27
29
|
FULLWIDTH_CHAR_WIDTH # Japanese characters (hiragana, katakana, kanji, full-width symbols, box drawing, block elements)
|
|
@@ -30,7 +32,17 @@ module Rufio
|
|
|
30
32
|
else
|
|
31
33
|
char.bytesize > MULTIBYTE_THRESHOLD ? FULLWIDTH_CHAR_WIDTH : HALFWIDTH_CHAR_WIDTH
|
|
32
34
|
end
|
|
33
|
-
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Calculate display width of a string
|
|
39
|
+
# Full-width characters (Japanese, etc.) count as 2, half-width as 1
|
|
40
|
+
def display_width(string)
|
|
41
|
+
width = 0
|
|
42
|
+
string.each_char do |char|
|
|
43
|
+
width += char_width(char)
|
|
44
|
+
end
|
|
45
|
+
width
|
|
34
46
|
end
|
|
35
47
|
|
|
36
48
|
# Truncate string to fit within max_width
|
|
@@ -44,11 +56,11 @@ module Rufio
|
|
|
44
56
|
target_width = max_width - ELLIPSIS_MIN_WIDTH
|
|
45
57
|
|
|
46
58
|
string.each_char do |char|
|
|
47
|
-
|
|
48
|
-
break if current_width +
|
|
59
|
+
cw = char_width(char)
|
|
60
|
+
break if current_width + cw > target_width
|
|
49
61
|
|
|
50
62
|
result += char
|
|
51
|
-
current_width +=
|
|
63
|
+
current_width += cw
|
|
52
64
|
end
|
|
53
65
|
|
|
54
66
|
result + ELLIPSIS
|
|
@@ -58,11 +70,11 @@ module Rufio
|
|
|
58
70
|
current_width = 0
|
|
59
71
|
|
|
60
72
|
string.each_char do |char|
|
|
61
|
-
|
|
62
|
-
break if current_width +
|
|
73
|
+
cw = char_width(char)
|
|
74
|
+
break if current_width + cw > max_width
|
|
63
75
|
|
|
64
76
|
result += char
|
|
65
|
-
current_width +=
|
|
77
|
+
current_width += cw
|
|
66
78
|
end
|
|
67
79
|
|
|
68
80
|
result
|
|
@@ -89,10 +101,10 @@ module Rufio
|
|
|
89
101
|
punct_break_point = nil
|
|
90
102
|
|
|
91
103
|
line.each_char.with_index do |char, index|
|
|
92
|
-
|
|
93
|
-
break if current_width +
|
|
104
|
+
cw = char_width(char)
|
|
105
|
+
break if current_width + cw > max_width
|
|
94
106
|
|
|
95
|
-
current_width +=
|
|
107
|
+
current_width += cw
|
|
96
108
|
best_break_point = index + 1
|
|
97
109
|
|
|
98
110
|
# Record break point at space
|
|
@@ -134,16 +146,16 @@ module Rufio
|
|
|
134
146
|
current_width = 0
|
|
135
147
|
|
|
136
148
|
line.each_char do |char|
|
|
137
|
-
|
|
149
|
+
cw = char_width(char)
|
|
138
150
|
|
|
139
|
-
if current_width +
|
|
151
|
+
if current_width + cw > max_width
|
|
140
152
|
# Start a new line
|
|
141
153
|
wrapped << current_line.join
|
|
142
154
|
current_line = [char]
|
|
143
|
-
current_width =
|
|
155
|
+
current_width = cw
|
|
144
156
|
else
|
|
145
157
|
current_line << char
|
|
146
|
-
current_width +=
|
|
158
|
+
current_width += cw
|
|
147
159
|
end
|
|
148
160
|
end
|
|
149
161
|
|
data/lib/rufio/version.rb
CHANGED
data/lib/rufio.rb
CHANGED
|
@@ -37,6 +37,8 @@ require_relative "rufio/native_scanner_zig"
|
|
|
37
37
|
require_relative "rufio/async_scanner_promise"
|
|
38
38
|
require_relative "rufio/async_scanner_fiber"
|
|
39
39
|
require_relative "rufio/parallel_scanner"
|
|
40
|
+
require_relative "rufio/screen"
|
|
41
|
+
require_relative "rufio/renderer"
|
|
40
42
|
|
|
41
43
|
# プロジェクトモード
|
|
42
44
|
require_relative "rufio/project_mode"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rufio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.40.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- masisz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: io-console
|
|
@@ -129,8 +129,9 @@ files:
|
|
|
129
129
|
- docs/CHANGELOG_v0.30.0.md
|
|
130
130
|
- docs/CHANGELOG_v0.31.0.md
|
|
131
131
|
- docs/CHANGELOG_v0.32.0.md
|
|
132
|
-
- docs/CHANGELOG_v0.
|
|
132
|
+
- docs/CHANGELOG_v0.33.0.md
|
|
133
133
|
- docs/CHANGELOG_v0.4.0.md
|
|
134
|
+
- docs/CHANGELOG_v0.40.0.md
|
|
134
135
|
- docs/CHANGELOG_v0.5.0.md
|
|
135
136
|
- docs/CHANGELOG_v0.6.0.md
|
|
136
137
|
- docs/CHANGELOG_v0.7.0.md
|
|
@@ -175,9 +176,12 @@ files:
|
|
|
175
176
|
- lib/rufio/plugin_manager.rb
|
|
176
177
|
- lib/rufio/plugins/file_operations.rb
|
|
177
178
|
- lib/rufio/plugins/hello.rb
|
|
179
|
+
- lib/rufio/plugins/stop.rb
|
|
178
180
|
- lib/rufio/project_command.rb
|
|
179
181
|
- lib/rufio/project_log.rb
|
|
180
182
|
- lib/rufio/project_mode.rb
|
|
183
|
+
- lib/rufio/renderer.rb
|
|
184
|
+
- lib/rufio/screen.rb
|
|
181
185
|
- lib/rufio/selection_manager.rb
|
|
182
186
|
- lib/rufio/shell_command_completion.rb
|
|
183
187
|
- lib/rufio/terminal_ui.rb
|