rufio 0.34.0 → 0.40.1
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/file_preview.rb +7 -6
- 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 -4
- data/publish_gem.zsh +0 -131
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.1
|
|
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-12 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
|
|
@@ -188,7 +192,6 @@ files:
|
|
|
188
192
|
- lib_zig/rufio_native/build.zig
|
|
189
193
|
- lib_zig/rufio_native/src/main.zig
|
|
190
194
|
- lib_zig/rufio_native/src/main.zig.sync
|
|
191
|
-
- publish_gem.zsh
|
|
192
195
|
- retag.sh
|
|
193
196
|
- test_delete/test1.txt
|
|
194
197
|
- test_delete/test2.txt
|
data/publish_gem.zsh
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
#!/bin/zsh
|
|
2
|
-
|
|
3
|
-
# Gem Build & Push Script
|
|
4
|
-
# Usage: ./publish_gem.zsh [version]
|
|
5
|
-
|
|
6
|
-
set -e # Exit on any error
|
|
7
|
-
|
|
8
|
-
# Colors for output
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
BLUE='\033[0;34m'
|
|
13
|
-
NC='\033[0m' # No Color
|
|
14
|
-
|
|
15
|
-
# Function to print colored output
|
|
16
|
-
print_status() {
|
|
17
|
-
echo -e "${BLUE}[INFO]${NC} $1"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
print_success() {
|
|
21
|
-
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
print_warning() {
|
|
25
|
-
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
print_error() {
|
|
29
|
-
echo -e "${RED}[ERROR]${NC} $1"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
# Check if we're in the correct directory
|
|
33
|
-
if [[ ! -f "rufio.gemspec" ]]; then
|
|
34
|
-
print_error "rufio.gemspec not found. Please run this script from the project root directory."
|
|
35
|
-
exit 1
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Get current version from version.rb
|
|
39
|
-
CURRENT_VERSION=$(ruby -r ./lib/rufio/version -e "puts Rufio::VERSION")
|
|
40
|
-
print_status "Current version: $CURRENT_VERSION"
|
|
41
|
-
|
|
42
|
-
# Use provided version or current version
|
|
43
|
-
VERSION=${1:-$CURRENT_VERSION}
|
|
44
|
-
print_status "Publishing version: $VERSION"
|
|
45
|
-
|
|
46
|
-
# Confirm before proceeding
|
|
47
|
-
echo
|
|
48
|
-
read "REPLY?Do you want to proceed with publishing version $VERSION? (y/N): "
|
|
49
|
-
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
50
|
-
print_warning "Aborted by user."
|
|
51
|
-
exit 0
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
echo
|
|
55
|
-
print_status "Starting gem publication process..."
|
|
56
|
-
|
|
57
|
-
# Step 1: Run tests
|
|
58
|
-
print_status "Running tests..."
|
|
59
|
-
if ! bundle exec rake test; then
|
|
60
|
-
print_error "Tests failed. Aborting publication."
|
|
61
|
-
exit 1
|
|
62
|
-
fi
|
|
63
|
-
print_success "All tests passed!"
|
|
64
|
-
|
|
65
|
-
# Step 2: Clean up old gem files
|
|
66
|
-
print_status "Cleaning up old gem files..."
|
|
67
|
-
rm -f *.gem
|
|
68
|
-
print_success "Cleanup completed."
|
|
69
|
-
|
|
70
|
-
# Step 3: Build gem
|
|
71
|
-
print_status "Building gem..."
|
|
72
|
-
if ! bundle exec gem build rufio.gemspec; then
|
|
73
|
-
print_error "Gem build failed."
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
# Find the built gem file
|
|
78
|
-
GEM_FILE=$(ls rufio-*.gem | head -n 1)
|
|
79
|
-
if [[ -z "$GEM_FILE" ]]; then
|
|
80
|
-
print_error "No gem file found after build."
|
|
81
|
-
exit 1
|
|
82
|
-
fi
|
|
83
|
-
|
|
84
|
-
print_success "Gem built successfully: $GEM_FILE"
|
|
85
|
-
|
|
86
|
-
# Step 4: Verify gem contents (optional)
|
|
87
|
-
print_status "Gem contents:"
|
|
88
|
-
gem contents $GEM_FILE | head -10
|
|
89
|
-
echo "..."
|
|
90
|
-
|
|
91
|
-
# Step 5: Final confirmation
|
|
92
|
-
echo
|
|
93
|
-
read "REPLY?Push $GEM_FILE to RubyGems? (y/N): "
|
|
94
|
-
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
95
|
-
print_warning "Gem build completed but not published."
|
|
96
|
-
print_status "You can manually push later with: gem push $GEM_FILE"
|
|
97
|
-
exit 0
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
# Step 6: Push to RubyGems
|
|
101
|
-
print_status "Pushing gem to RubyGems..."
|
|
102
|
-
if ! gem push $GEM_FILE; then
|
|
103
|
-
print_error "Gem push failed."
|
|
104
|
-
exit 1
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
print_success "Gem published successfully!"
|
|
108
|
-
|
|
109
|
-
# Step 7: Create git tag if version was provided
|
|
110
|
-
if [[ -n "$1" ]]; then
|
|
111
|
-
print_status "Creating git tag v$VERSION..."
|
|
112
|
-
if git tag "v$VERSION" 2>/dev/null; then
|
|
113
|
-
print_success "Tag v$VERSION created."
|
|
114
|
-
read "REPLY?Push tag to remote? (y/N): "
|
|
115
|
-
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
116
|
-
git push origin "v$VERSION"
|
|
117
|
-
print_success "Tag pushed to remote."
|
|
118
|
-
fi
|
|
119
|
-
else
|
|
120
|
-
print_warning "Tag v$VERSION already exists or failed to create."
|
|
121
|
-
fi
|
|
122
|
-
fi
|
|
123
|
-
|
|
124
|
-
# Step 8: Cleanup
|
|
125
|
-
print_status "Cleaning up gem file..."
|
|
126
|
-
rm -f $GEM_FILE
|
|
127
|
-
|
|
128
|
-
echo
|
|
129
|
-
print_success "Publication completed!"
|
|
130
|
-
print_status "Gem should be available at: https://rubygems.org/gems/rufio"
|
|
131
|
-
print_status "Install with: gem install rufio"
|