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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d03b8da1539c55090e70b9b255fdd8a19e6621a5217da447904b6ff37db21b9a
4
- data.tar.gz: be3e1764c29da9cd392e84f9fb85f8afed29f1582cc26570125de2171fb5d0fe
3
+ metadata.gz: fe4f7b2aae6225c14b25136916d32f34a8090c3e01a356f70aadfac88a3525bf
4
+ data.tar.gz: 0f529031131f0b2cfe7fb713068bf079977a7793c5f676a9b222e083014789e7
5
5
  SHA512:
6
- metadata.gz: 6549958abeefb479c647fde946cbb100c4283a2f3f7d3d88694c3edf41dab4e3eea6bbf0cd6813f806f74d02fded4c279a13b313a46873f5b38a22ab6f643615
7
- data.tar.gz: d8d422b37676ffaef5116b4e78ec3fd49855633c0b1dd22f04e52da3125fb83a0b9108d1e43ce559fd964e66f89965167290246176a6413e2df2fdc437b64f25
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
@@ -39,6 +39,8 @@ rufio は、ファイルを探すところからスクリプトの実行、結
39
39
  - **ブックマーク**: よく使うディレクトリに素早くアクセス
40
40
  - **zoxide連携**: スマートなディレクトリ履歴
41
41
 
42
+ テキストのプレビューは先頭64 KiBまで読み込みます。PDFの本文はプレビューせず、ファイル移動時の読み込みを省きます。
43
+
42
44
  ### クロスプラットフォーム
43
45
 
44
46
  - **macOS**: ネイティブサポート
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
@@ -60,6 +60,8 @@ Files モードでは、最上段に現在のパス、その下にブックマ
60
60
 
61
61
  ## プレビュー
62
62
 
63
+ テキストのプレビューは先頭64 KiBまで読み込みます。PDFの本文はプレビューせず、ファイル移動時の読み込みを省きます。
64
+
63
65
  右側のペインに選択中のファイルを表示します。`bat` があればコードをハイライトします。`.zip` は展開せずにエントリ一覧(サイズ・圧縮方式・更新日時・名前)を表示します。
64
66
 
65
67
  | キー | 操作 |
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 |
@@ -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
- truncated = false
107
- encoding = "UTF-8"
108
-
109
- # UTF-8で読み込み、不正なバイト列は置換文字に変換
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
- # check if there are more lines to read
131
- truncated = !file.eof?
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: 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)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rufio
4
- VERSION = '1.4.0'
4
+ VERSION = '1.4.1'
5
5
  end
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.0
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-02 00:00:00.000000000 Z
11
+ date: 2026-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console