rufio 1.4.0 → 1.4.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 +6 -0
- data/README.md +2 -0
- data/README_ja.md +2 -0
- data/docs/guide.md +2 -0
- data/docs/guide_ja.md +2 -0
- data/info/help.md +3 -0
- data/info/keybindings.md +2 -0
- data/info/welcome.md +2 -0
- data/lib/rufio/file_preview.rb +19 -56
- data/lib/rufio/help_menu.rb +1 -0
- data/lib/rufio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe4f7b2aae6225c14b25136916d32f34a8090c3e01a356f70aadfac88a3525bf
|
|
4
|
+
data.tar.gz: 0f529031131f0b2cfe7fb713068bf079977a7793c5f676a9b222e083014789e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 504988c5df9ae95601119734024a47d329a55abc4dc4a23cb815dfe90acb8d81836f6fb5a874d114af79d6375e755b9282e789088a2b14e1a276c72c8cfcc45c
|
|
7
|
+
data.tar.gz: 7d16fde591163866e3ed5560711f7c6f9f5c7918032a234b5dada4e253be11b98f5af1177b487aac6126946bb8c95de80813808df7a6df5a9d073ab71c4e27de
|
data/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
### Added
|
|
11
11
|
- G mode supports `Ctrl+J` / `Ctrl+K` to select the next / previous result; Enter (CR) opens the selected result
|
|
12
12
|
|
|
13
|
+
## [1.4.1] - 2026-11-08
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Skip PDF body reads in file previews so large binary streams do not block file navigation
|
|
17
|
+
- Limit text preview reads to the first 64 KiB before decoding and report omitted lines correctly
|
|
18
|
+
|
|
13
19
|
## [1.4.0] - 2026-11-02
|
|
14
20
|
|
|
15
21
|
### Added
|
data/README.md
CHANGED
|
@@ -39,6 +39,8 @@ rufio brings finding files, running scripts, and checking results together in on
|
|
|
39
39
|
- **Bookmarks**: Quick access to frequently used directories
|
|
40
40
|
- **zoxide Integration**: Smart directory history
|
|
41
41
|
|
|
42
|
+
Text previews read at most the first 64 KiB. PDF bodies are not previewed, keeping file navigation responsive.
|
|
43
|
+
|
|
42
44
|
### Cross-platform
|
|
43
45
|
|
|
44
46
|
- **macOS**: Native support
|
data/README_ja.md
CHANGED
data/docs/guide.md
CHANGED
|
@@ -60,6 +60,8 @@ The mouse also works: click to select, and scroll the list or the preview.
|
|
|
60
60
|
|
|
61
61
|
## Preview
|
|
62
62
|
|
|
63
|
+
Text previews read at most the first 64 KiB. PDF bodies are not previewed, keeping file navigation responsive.
|
|
64
|
+
|
|
63
65
|
The right pane previews the selected file. Code is highlighted when `bat` is installed. `.zip` files show their entry list (size, method, modified time, name) without extracting them.
|
|
64
66
|
|
|
65
67
|
| Key | Action |
|
data/docs/guide_ja.md
CHANGED
data/info/help.md
CHANGED
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
| `A` | Create new directory |
|
|
44
44
|
|
|
45
45
|
In a preview, `j/k` scroll, `Ctrl+D/U` page down/up and `ESC` returns to the file list.
|
|
46
|
+
|
|
47
|
+
Text previews read at most the first 64 KiB. PDF bodies are not previewed, keeping file navigation responsive.
|
|
48
|
+
|
|
46
49
|
`.zip` previews list the archive entries (size, method, modified time, name) without extracting them.
|
|
47
50
|
|
|
48
51
|
### File Selection & Bulk Operations
|
data/info/keybindings.md
CHANGED
|
@@ -27,6 +27,8 @@ Complete reference of all keyboard shortcuts in **rufio**.
|
|
|
27
27
|
|
|
28
28
|
`.zip` previews list the archive entries (size, method, modified time, name) without extracting them.
|
|
29
29
|
|
|
30
|
+
Text previews read at most the first 64 KiB. PDF bodies are not previewed, keeping file navigation responsive.
|
|
31
|
+
|
|
30
32
|
## File Selection
|
|
31
33
|
|
|
32
34
|
| Key | Action |
|
data/info/welcome.md
CHANGED
|
@@ -16,6 +16,8 @@ A TUI file manager that executes and coordinates tools and scripts from files.
|
|
|
16
16
|
- **Job Management** - Run commands in the background
|
|
17
17
|
- **Plugin System** - Extend functionality with custom plugins
|
|
18
18
|
|
|
19
|
+
Text previews read at most the first 64 KiB. PDF bodies are not previewed, keeping file navigation responsive.
|
|
20
|
+
|
|
19
21
|
## Quick Start
|
|
20
22
|
|
|
21
23
|
| Key | Action |
|
data/lib/rufio/file_preview.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Rufio
|
|
|
5
5
|
BINARY_THRESHOLD = 0.3 # treat as binary if 30% or more binary characters
|
|
6
6
|
DEFAULT_MAX_LINES = 50
|
|
7
7
|
MAX_LINE_LENGTH = 500
|
|
8
|
+
MAX_PREVIEW_BYTES = 64 * 1024
|
|
8
9
|
|
|
9
10
|
# Binary detection constants
|
|
10
11
|
BINARY_SAMPLE_SIZE = 512
|
|
@@ -28,6 +29,9 @@ module Rufio
|
|
|
28
29
|
return empty_response if file_size == 0
|
|
29
30
|
|
|
30
31
|
begin
|
|
32
|
+
# PDF bodies are not displayed; never scan their binary streams as text.
|
|
33
|
+
return binary_response(file_path) if File.extname(file_path).casecmp?('.pdf')
|
|
34
|
+
|
|
31
35
|
return archive_response(file_path, max_lines) if zip_archive?(file_path)
|
|
32
36
|
|
|
33
37
|
# binary file detection
|
|
@@ -102,71 +106,30 @@ module Rufio
|
|
|
102
106
|
end
|
|
103
107
|
|
|
104
108
|
def read_text_file(file_path, max_lines)
|
|
109
|
+
# Bound the read before decoding or splitting: a binary stream or minified
|
|
110
|
+
# file can contain a single line spanning the entire file.
|
|
111
|
+
content = File.binread(file_path, MAX_PREVIEW_BYTES + 1)
|
|
112
|
+
truncated = content.bytesize > MAX_PREVIEW_BYTES
|
|
113
|
+
content = content.byteslice(0, MAX_PREVIEW_BYTES) if truncated
|
|
114
|
+
content = content.force_encoding('UTF-8').encode(
|
|
115
|
+
'UTF-8', invalid: :replace, undef: :replace, replace: '?'
|
|
116
|
+
)
|
|
105
117
|
lines = []
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
File.open(file_path, "r:UTF-8:UTF-8", invalid: :replace, undef: :replace, replace: '�') do |file|
|
|
111
|
-
file.each_line.with_index do |line, index|
|
|
112
|
-
break if index >= max_lines
|
|
113
|
-
|
|
114
|
-
begin
|
|
115
|
-
# Ensure line is properly encoded as UTF-8
|
|
116
|
-
line = line.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
117
|
-
|
|
118
|
-
# truncate too long lines
|
|
119
|
-
if line.length > MAX_LINE_LENGTH
|
|
120
|
-
line = line[0...MAX_LINE_LENGTH] + "..."
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
lines << line.chomp
|
|
124
|
-
rescue EncodingError, ArgumentError
|
|
125
|
-
# If encoding fails, add placeholder
|
|
126
|
-
lines << "[encoding error in line #{index + 1}]"
|
|
127
|
-
end
|
|
118
|
+
content.each_line.with_index do |line, index|
|
|
119
|
+
if index >= max_lines
|
|
120
|
+
truncated = true
|
|
121
|
+
break
|
|
128
122
|
end
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
line = line[0...MAX_LINE_LENGTH] + '...' if line.length > MAX_LINE_LENGTH
|
|
125
|
+
lines << line.chomp
|
|
132
126
|
end
|
|
133
127
|
|
|
134
128
|
{
|
|
135
129
|
content: lines,
|
|
136
130
|
truncated: truncated,
|
|
137
|
-
encoding:
|
|
131
|
+
encoding: 'UTF-8'
|
|
138
132
|
}
|
|
139
|
-
rescue Encoding::InvalidByteSequenceError, Encoding::CompatibilityError
|
|
140
|
-
# try Shift_JIS if UTF-8 fails
|
|
141
|
-
begin
|
|
142
|
-
lines = []
|
|
143
|
-
File.open(file_path, "r:Shift_JIS:UTF-8", invalid: :replace, undef: :replace, replace: '�') do |file|
|
|
144
|
-
file.each_line.with_index do |line, index|
|
|
145
|
-
break if index >= max_lines
|
|
146
|
-
|
|
147
|
-
begin
|
|
148
|
-
# Ensure line is properly encoded as UTF-8
|
|
149
|
-
line = line.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
150
|
-
lines << line.chomp
|
|
151
|
-
rescue EncodingError, ArgumentError
|
|
152
|
-
# If encoding fails, add placeholder
|
|
153
|
-
lines << "[encoding error in line #{index + 1}]"
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
truncated = !file.eof?
|
|
157
|
-
end
|
|
158
|
-
{
|
|
159
|
-
content: lines,
|
|
160
|
-
truncated: truncated,
|
|
161
|
-
encoding: "Shift_JIS"
|
|
162
|
-
}
|
|
163
|
-
rescue
|
|
164
|
-
{
|
|
165
|
-
content: ["(#{ConfigLoader.message('file.encoding_error')})"],
|
|
166
|
-
truncated: false,
|
|
167
|
-
encoding: "unknown"
|
|
168
|
-
}
|
|
169
|
-
end
|
|
170
133
|
end
|
|
171
134
|
|
|
172
135
|
def determine_file_type(file_path)
|
data/lib/rufio/help_menu.rb
CHANGED
|
@@ -55,6 +55,7 @@ module Rufio
|
|
|
55
55
|
"#{key(:move_down)}/#{key(:move_up)} or arrows: Move down/up",
|
|
56
56
|
"#{key(:navigate_parent)}/#{key(:navigate_enter)}: Parent / enter directory",
|
|
57
57
|
"#{key(:preview)}: Fullscreen file preview | ESC: Back to file list",
|
|
58
|
+
'Text preview: first 64 KiB; PDF bodies are not previewed.',
|
|
58
59
|
'Preview: j/k scroll, Ctrl+D/U page down/up',
|
|
59
60
|
"#{key(:top)}/#{key(:bottom)}: First / last entry",
|
|
60
61
|
"#{key(:open_file)}: Open in external editor",
|
data/lib/rufio/version.rb
CHANGED
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: 1.4.
|
|
4
|
+
version: 1.4.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-11-
|
|
11
|
+
date: 2026-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: io-console
|