rufio 1.5.1 → 2.0.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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -0
  3. data/README.md +18 -6
  4. data/README_ja.md +18 -6
  5. data/Rakefile +5 -0
  6. data/SECURITY.md +16 -8
  7. data/docs/csv_cell_preview_design_ja.md +682 -0
  8. data/docs/guide.md +115 -20
  9. data/docs/guide_ja.md +116 -21
  10. data/docs/image_preview_design_ja.md +335 -0
  11. data/docs/native_fuzzy_search_design_ja.md +684 -0
  12. data/examples/config.rb +23 -0
  13. data/info/help.md +32 -18
  14. data/info/keybindings.md +43 -11
  15. data/info/welcome.md +4 -6
  16. data/lib/rufio/background_status.rb +7 -0
  17. data/lib/rufio/bookmark_controller.rb +0 -45
  18. data/lib/rufio/clipboard.rb +162 -0
  19. data/lib/rufio/command_locator.rb +49 -0
  20. data/lib/rufio/config.rb +7 -4
  21. data/lib/rufio/config_loader.rb +66 -11
  22. data/lib/rufio/csv_table_source.rb +125 -0
  23. data/lib/rufio/encoding_detector.rb +152 -0
  24. data/lib/rufio/file_operation_controller.rb +41 -0
  25. data/lib/rufio/file_preview.rb +92 -19
  26. data/lib/rufio/fuzzy_candidate_block.rb +131 -0
  27. data/lib/rufio/fuzzy_file_source.rb +180 -0
  28. data/lib/rufio/fuzzy_search.rb +327 -0
  29. data/lib/rufio/fuzzy_search_session.rb +426 -0
  30. data/lib/rufio/graphics_layer.rb +223 -0
  31. data/lib/rufio/health_checker.rb +27 -32
  32. data/lib/rufio/help_menu.rb +16 -10
  33. data/lib/rufio/image_preview_view.rb +421 -0
  34. data/lib/rufio/image_source.rb +158 -0
  35. data/lib/rufio/keybind_handler.rb +21 -34
  36. data/lib/rufio/kitty_graphics.rb +128 -0
  37. data/lib/rufio/native/aarch64-linux-gnu/librufio_zig.so +0 -0
  38. data/lib/rufio/native/aarch64-linux-musl/librufio_zig.so +0 -0
  39. data/lib/rufio/native/aarch64-macos/librufio_zig.dylib +0 -0
  40. data/lib/rufio/native/aarch64-windows/rufio_zig.dll +0 -0
  41. data/lib/rufio/native/x86_64-linux-gnu/librufio_zig.so +0 -0
  42. data/lib/rufio/native/x86_64-linux-musl/librufio_zig.so +0 -0
  43. data/lib/rufio/native/x86_64-macos/librufio_zig.dylib +0 -0
  44. data/lib/rufio/native/x86_64-windows/rufio_zig.dll +0 -0
  45. data/lib/rufio/native_content_search.rb +44 -8
  46. data/lib/rufio/native_image.rb +177 -0
  47. data/lib/rufio/native_scanner_zig.rb +39 -0
  48. data/lib/rufio/navigation_controller.rb +47 -16
  49. data/lib/rufio/preview_registry.rb +86 -0
  50. data/lib/rufio/preview_view.rb +363 -0
  51. data/lib/rufio/renderer.rb +8 -8
  52. data/lib/rufio/screen.rb +38 -1
  53. data/lib/rufio/search_prompt.rb +50 -0
  54. data/lib/rufio/search_screen.rb +680 -0
  55. data/lib/rufio/sheet_picker.rb +87 -0
  56. data/lib/rufio/sqlite_table_source.rb +205 -0
  57. data/lib/rufio/tab_mode_manager.rb +1 -3
  58. data/lib/rufio/table_cursor.rb +117 -0
  59. data/lib/rufio/table_document.rb +261 -0
  60. data/lib/rufio/table_layout.rb +231 -0
  61. data/lib/rufio/table_preview_view.rb +376 -0
  62. data/lib/rufio/table_query.rb +240 -0
  63. data/lib/rufio/table_source.rb +46 -0
  64. data/lib/rufio/terminal_graphics.rb +168 -0
  65. data/lib/rufio/terminal_ui.rb +74 -60
  66. data/lib/rufio/text_utils.rb +27 -0
  67. data/lib/rufio/ui_renderer.rb +380 -17
  68. data/lib/rufio/version.rb +1 -1
  69. data/lib/rufio/xlsx_table_source.rb +112 -0
  70. data/lib/rufio.rb +21 -1
  71. data/lib_zig/rufio_native/Makefile +21 -5
  72. data/lib_zig/rufio_native/build.zig +18 -0
  73. data/lib_zig/rufio_native/src/fuzzy.zig +520 -0
  74. data/lib_zig/rufio_native/src/fuzzy_test.zig +212 -0
  75. data/lib_zig/rufio_native/src/image.zig +525 -0
  76. data/lib_zig/rufio_native/src/image_bmp.zig +111 -0
  77. data/lib_zig/rufio_native/src/image_jpeg.zig +878 -0
  78. data/lib_zig/rufio_native/src/image_png.zig +561 -0
  79. data/lib_zig/rufio_native/src/image_resize.zig +170 -0
  80. data/lib_zig/rufio_native/src/image_test.zig +401 -0
  81. data/lib_zig/rufio_native/src/main.zig +28 -0
  82. data/lib_zig/rufio_native/src/search.zig +260 -64
  83. data/lib_zig/rufio_native/src/search_test.zig +35 -0
  84. data/lib_zig/rufio_native/src/testdata/alpha.png +0 -0
  85. data/lib_zig/rufio_native/src/testdata/gradient.bmp +0 -0
  86. data/lib_zig/rufio_native/src/testdata/gradient.jpg +0 -0
  87. data/lib_zig/rufio_native/src/testdata/gradient.png +0 -0
  88. data/retag.sh +4 -4
  89. metadata +44 -5
  90. data/lib/rufio/global_search.rb +0 -412
  91. data/lib/rufio/search_controller.rb +0 -92
  92. data/lib_zig/rufio_native/src/main.zig.sync +0 -205
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff603a8e5d0c14a9bb18bfe116f0ccef4a5eee527ea0a24bd78bc358cd274f74
4
- data.tar.gz: e4d85a17e12f8601d7e45ae1d338328db7a9febaf96a8aae3f115b10e438d56f
3
+ metadata.gz: 368708ecd4642fdb6822af7179753c61e517022f5828356ab7fe2550a106deca
4
+ data.tar.gz: f63838dc12e93fcb779389830e23d114b55ed84ecd1bcaa29204dcaf21e0fbf4
5
5
  SHA512:
6
- metadata.gz: 33abb4a41ddfc5801b8afa1692bb020ba39ca003440349c8475b02436202bc0b3e90f996a68ffe1a1123ebd23c5f0bf75d3192c22a8bf6476123821e132e5347
7
- data.tar.gz: 1af1b2a50d37c6975697f87621df384d77b1863579b1e62e6396fdc0c7216a32575fec1cafccf964fdb474c87c3899340a94ff47983d43c672331119682f0af4
6
+ metadata.gz: 56b6de9ae8e33b21fcd45ce86a212dc83caa9a11090d15afb590909d6f7b6d6160539def6eee0a066b7909270fbffe361e6566db00de1672e91db804ff08f148
7
+ data.tar.gz: 21d431e6546428f2b0391e218953e87ce48fbac6b1e4b31fc10524be5c269a6e1cb246ed7dc98c1cb59f76e30d44b1ec3203ed8542758f6bbc6590fb863c131e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,92 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0] - 2026-11-23
11
+
12
+ ### Added
13
+ - `.csv`, `.tsv` and `.tab` previews are shown as a grid instead of raw text: column letters with the header row, row numbers, the header kept in place while scrolling, and a last line with the row and column counts, the detected character encoding, any truncation and how many columns do not fit. Both the split pane and the fullscreen preview (`P`) use it
14
+ - Character encoding detection for table previews (`Rufio::EncodingDetector`): UTF-8 and UTF-16 BOMs, UTF-8, CP932 and EUC-JP, so Shift_JIS CSV files no longer read as replacement characters. The byte limit is cut at the last newline so a multibyte character is never split
15
+ - `TABLE_PREVIEW` in `config.rb` sets the table preview limits (`max_bytes` up to 4 MiB, `max_rows`, `max_columns`, `max_column_width`) and the `header`, `delimiter` (`'auto'` detects `;`) and `encoding` handling. Omitted or invalid values keep the defaults (512 KiB / 1000 / 256 / 32)
16
+ - In preview mode (`P`) on a table file, `h`/`j`/`k`/`l` and the arrow keys move a cell cursor, `Ctrl+D`/`Ctrl+U` move one screen of rows, `g`/`}` jump to the first and last row and `0`/`$` to the first and last column. The grid scrolls vertically and horizontally to keep the cursor in view, the cursor cell is drawn in the selection colour, and the line under the file name shows the cell address and column name (`R3C2 price`). Cell movement follows the `move_up` / `move_down` / `navigate_parent` / `navigate_enter` keybinds
17
+ - `.xlsx`, `.xlsm` and `.ods` files are previewed as a grid through the `roo` gem that was already a dependency, and SQLite databases are too when the `sqlite3` command is installed, recognised by the file's own signature whatever the extension (without the command they are left as before). `[` and `]` switch between a workbook's sheets or a database's tables, and only the sheet on screen is read, so the others cost nothing until they are opened. A spreadsheet over 10 MiB, or one that cannot be read, falls back to the ZIP entry list
18
+ - `t` in a table preview opens the list of a workbook's sheets or a database's tables: `j`/`k` and the arrow keys move, `Ctrl+D`/`Ctrl+U` page, `g`/`}` jump to the first and last entry, `Enter` opens the selected one and `ESC` closes the list without switching, and the mouse wheel moves through it. The entry on screen is marked with `>`, the heading reads `Tables (3)` for a database and `Sheets (3)` for a workbook, and the list only needs the names, so no table is read until one is opened. A file with a single sheet has no list, and the other keys are ignored while it is open, so the cell cursor behind it does not move
19
+ - `Space` in a table preview selects the column under the cursor, and `y` then copies the cursor row's cells from the selected columns, in column order, joined with commas as one CSV line (`apple,30`), so a cell holding a comma or a newline is still quoted and readable back as CSV. The selected columns' cells are marked the way a selected file is, the line under the file name lists them (`cols A,C`), the copy is reported as `copied 2 cols`, and switching sheets clears the selection. `Space` follows the `select` keybind, and `y` without a selection still copies the cell under the cursor
20
+ - `Y` copies the row under the cursor as one CSV line
21
+ - `y` copies to the clipboard: the cell under the cursor in a table preview (the raw value, newlines inside a cell included), the file path in any other preview, and in the file list the paths of the selected files, or of the file under the cursor when nothing is selected, one per line. The result is shown in the preview's status line or at the bottom of the file list
22
+ - `Rufio::Clipboard` runs `pbcopy`, `clip`, `wl-copy`, `xclip` or `xsel` when one is on `PATH`, and otherwise writes OSC 52, which reaches the terminal over SSH as well (wrapped for tmux and screen; tmux also needs `set-clipboard on`). Commands run through `argv` without a shell. `CLIPBOARD_COMMAND` in `config.rb` sets a command of your own, and `rufio -c` reports which one is used
23
+ - `Rufio::PreviewView`: preview mode now delegates its keys, scroll position and status line to a view (`TextPreviewView`, `TablePreviewView`, or `ImagePreviewView`), so a further preview kind needs no change in `NavigationController` or `UIRenderer`. `Rufio::TableCursor` holds the cell position and the scroll offsets, and `TableLayout#offset_for` computes how far to scroll sideways
24
+ - `Rufio::TableSource` and `Rufio::PreviewRegistry`: a table format implements `supports?` and `open` and returns sheets whose rows are read through `fetch_rows(offset, limit)`, so further formats (Excel, SQLite) need no change to the renderer. The plan is in `docs/csv_cell_preview_design_ja.md`
25
+ - `Rufio::SheetPicker` holds the sheet list's selection and scroll position, and `TableDocument#sheet_label` gives each format its own word for them (`Tables` for SQLite, `Sheets` otherwise)
26
+ - Image previews on terminals that speak the Kitty graphics protocol (kitty, Ghostty, WezTerm, Konsole). `.png`, `.jpg`, `.gif` and `.bmp` are recognised by the file's own signature, and the preview pane (split view and `P`) shows the picture drawn by the terminal while preserving its original aspect ratio (never stretching small pictures to the pane, and omitting `c`/`r` when real cell pixel dimensions are known so the terminal renders at exact pixel size), with the cells behind it kept blank so the list and status line stay readable. The picture is removed when another file is selected, when the help menu, search screen or command mode opens, on a full redraw and on exit. Other terminals, and tmux, show the format, pixel size and file size as text instead. `RUFIO_IMAGE_PREVIEW=0` turns it off. `Rufio::TerminalGraphics` asks the terminal once at startup (graphics query, CSI 16t cell size / native `TIOCGWINSZ`, plus Primary DA), `Rufio::KittyGraphics` builds the escape sequences, `Rufio::GraphicsLayer` decides when to send or delete, and `Screen#reserve` keeps text out of the picture's cells. The design notes are in `docs/image_preview_design_ja.md`
27
+ - The bundled native library now decodes images, so `.jpg` and `.bmp` previews work and every picture is scaled down to the pane before it is sent: a 2000x1500 photo becomes a few hundred KB in about 30 ms, off the main loop (with background completion polled from the main loop so previews appear as soon as decoding finishes), and files up to 32 MiB are read (the pane shows `decoding...` meanwhile). The decoders are written in Zig with no third-party image code and no external tools: PNG (read and write, using the standard library's zlib), baseline JPEG (Huffman, 4:4:4 / 4:2:2 / 4:2:0, restart markers) and uncompressed BMP, plus area-average downscaling. `.gif`, progressive JPEG and interlaced PNG are not decoded and fall back to the text view. Without the library, or with `RUFIO_NATIVE_IMAGE=0`, PNG files up to 8 MiB are still sent as they are. Zooming decodes at the zoomed resolution, so a magnified picture stays sharp
28
+ - `+` and `-` zoom an image preview in 25% steps up to 4x, `0` fits it to the pane again, and `h/j/k/l` or the arrow keys move around while zoomed. Zooming asks the terminal for a part of the picture (`x,y,w,h`), and the status line shows the current scale
29
+ - Image previews are steadier: a picture whose cells were painted over (by a notification or a mode change) is put back, moving to another file removes the old picture at once and sends the new one about 80 ms later so holding `j` through a folder of images does not flood the terminal, and the last few pictures are kept encoded in memory (4 images, 8 MB) so coming back to one costs no disk read and no re-encoding
30
+
31
+ ### Changed
32
+ - `Renderer#render` returns the row numbers it rewrote instead of `true` / `false`, so the image layer can tell whether its area was painted over
33
+ - `/` in a preview searches inside the previewed file: typing jumps to the first match, `Enter` keeps the search, `n` / `N` move between matches (wrapping around) and `ESC` clears it before a second `ESC` leaves the preview. Every match is highlighted and the current one is drawn in its own colour. Preview mode now reads up to 20,000 lines instead of 50, so scrolling and searching reach the whole 64 KiB the preview loads
34
+ - `/` in a table preview filters its rows with conditions written as `price > 100, name a%`: comparisons (`=`, `!=`, `<>`, `>`, `>=`, `<`, `<=`, numeric when both sides are numbers), `LIKE` patterns (`a%`, `a_c`, or a plain word matched anywhere in the column), quoted values that keep their commas (`note "red, sweet"`), and a term without a column searched in every column. Column names ignore case and the column letters work too. `Enter` applies it, the line under the file name shows `filter: price > 100 (2 rows)`, and `ESC` clears it. For a SQLite table the conditions become a read-only `SELECT ... WHERE` run inside the database, so the filter finds rows past the preview's row limit; values are always quoted literals and column names are resolved against the table's own columns, so the input cannot become SQL of its own. A spreadsheet or CSV is filtered over the rows that were read (`Rufio::TableQuery`, `TableSheet#filter`)
35
+ - Search is one key. `/` opens the search screen for the current directory tree: `Tab` switches between fuzzy file names and literal contents, `Enter` goes to the file, `ESC` returns. Bookmarks are no longer searched, and the screen reports the directory it is searching
36
+ - `SEARCH_EXCLUDED_EXTENSIONS` in `config.rb` replaces `GLOBAL_SEARCH_EXCLUDED_EXTENSIONS`, which is still read when the new name is not set
37
+ - `rufio -c` checks for `sqlite3` (used by the SQLite preview) instead of `rga`
38
+
39
+ ### Removed
40
+ - G mode is gone: the `G` key, the Search tab and the mode itself. Its search moved to `/`, scoped to the current directory
41
+ - `s` (fuzzy file name search), `/` (its alias) and `F` (rga content search) are gone, with the search screen they used (`FuzzyFinder`), the rga integration (`RgaResultSource`), the file list cache (`FuzzyCandidateCache` and `FUZZY_SEARCH_CACHE`) and its preview pane (`FuzzyPreviewLoader`). `rga` is no longer used at all. The `search` keybind accepts the old action names (`file_search`, `file_search_alt`, `rga_search`, `global_search`, `fzf_search`, `fzf_search_alt`) so existing `KEYBINDS` settings keep working
42
+ - `Tab` / `Shift+Tab` no longer cycle through bookmarks in Files and Config modes; the keys do nothing there. Bookmarks are reached with `1`-`9`, the `B` menu and `0` for the start directory. In the other modes `Shift+Tab` still switches to the previous mode
43
+
44
+ ### Security
45
+ - Hardened image preview and native Zig image decoders against crafted files and terminal escape injection:
46
+ - `KittyGraphics` validates pre-encoded payloads strictly against `[A-Za-z0-9+/=]` and coerces all numeric control keys (including `query`'s `id`) to integers; `TerminalGraphics` bounds probe responses to 4 KiB and rejects out-of-range cell pixel sizes (> 1024)
47
+ - Native image loading rejects embedded NUL bytes, opens POSIX files with `O_NONBLOCK` + `O_CLOEXEC` and verifies `S_ISREG` via `fstat`/`statx` (preventing FIFO hangs and device reads), and verifies `FILE_TYPE_DISK` on Windows; direct Ruby reads also cap `File.binread` against TOCTOU file growth
48
+ - PNG decoder and direct-send fast path enforce pixel/dimension caps (25M pixels, 16384 max dimension), 2 MiB direct-send cap, `IEND` length/trailing-data checks, valid palette bit depth (`8` only), and streaming zlib decompression bomb limits (`inspectVerified` / `inflate`)
49
+ - JPEG decoder validates DHT code-count limits, rejects duplicate SOF / pre-SOF SOS / oversized MCU block counts (> 10), clamps DC/AC coefficients and uses 64-bit IDCT intermediates, and aborts EOF zero-padding loops to prevent small-file DoS; BMP decoder checks `header_size` against integer overflow
50
+ - Area-average downscaling uses `u64` accumulators to prevent `u32` overflow on large-to-tiny resizes, cooperative cancellation stops PNG/JPEG/resize loops promptly, completed native jobs are closed immediately (with an `ObjectSpace` finalizer safety net), and all eight bundled native binaries are built with `-O ReleaseSafe` to keep bounds and overflow checks active
51
+
52
+ ## [1.6.0] - 2026-11-22
53
+
54
+ ### Added
55
+ - Phase 1 of the internal fuzzy search engine: a persistent Zig candidate index, bounded top-K ranking, UTF-8 match byte offsets, and an equivalent Ruby fallback. Missing or older native libraries and `RUFIO_NATIVE_FUZZY=0` use Ruby. The engine is available through `Rufio::FuzzySearch`
56
+ - Native/Ruby parity tests, allocation-failure checks, a reproducible synthetic benchmark, and the staged implementation plan in `docs/native_fuzzy_search_design_ja.md`. The bundled native binaries for all eight platforms are rebuilt with the fuzzy API
57
+ - Phase 2 adds `Rufio::FuzzySearchSession`: background file listing and index ownership, bounded producer queues, latest-query coalescing, generation-checked immutable results, and nonblocking close with worker-owned cleanup. Candidate-only refreshes are grouped at 50ms intervals; query changes and scan completion bypass the interval
58
+ - `Rufio::FuzzyFileSource` lists hidden files and regular-file symlinks using the existing Zig listing API or a Ruby fallback, skips directory symlinks, and keeps original paths separate from scrubbed UTF-8 labels. A cooperative cancellation callback on `NativeContentSearch#each_batch` stops idle polling as well. Session lifecycle tests and a streaming benchmark cover the new APIs
59
+ - Built-in fuzzy search screen (`Rufio::FuzzyFinder`) for `s` / `/`: lists every file under the current directory while scanning, filters as you type with in-order fuzzy matching, highlights matched characters, and opens the selection with `Enter`. `Up` / `Down`, `Ctrl+J` / `Ctrl+K`, `Ctrl+N` / `Ctrl+P` select, `Ctrl+U` clears and `ESC` returns. The selection stays on the same file while new candidates arrive
60
+ - `F` asks for the text in an input dialog, then streams rga's `file:line:text` results into the same screen (`Rufio::RgaResultSource`); `Enter` opens the file at that line. rga is stopped when the screen closes
61
+ - The fuzzy search screen previews the selected file on the right when the screen is at least 80 columns wide (`Rufio::FuzzyPreviewLoader`). Previews load in the background, only the latest selection is read, and reads are limited to the first 64 KiB. `F` results scroll to the matching line and highlight it. `UI_OPTIONS` `preview_enabled: false` hides the preview
62
+ - Reopening `s` in a directory scanned in the last 5 minutes shows the cached file list immediately (`Rufio::FuzzyCandidateCache`, up to 4 directories and 200,000 files, kept as packed label strings). The title shows `Cached ... ago`, `Ctrl+R` rescans while keeping the query, and choosing a file deleted since then keeps the screen open with `File no longer exists`
63
+
64
+ - `FUZZY_SEARCH_CACHE` in `config.rb` changes the file list cache limits (`max_entries` up to 1,000,000, `max_roots` up to 16, `ttl` up to 86,400 seconds; `0` disables). Omitted or invalid values keep the defaults (200,000 / 4 / 300)
65
+
66
+ ### Security
67
+ - Control characters are replaced with a space before anything is stored in the screen buffer (`Rufio::TextUtils.sanitize_for_display`, applied in `Screen#put` / `#put_string`). Previously only colour codes (`\e[…m`) were removed, so an `ESC` in a file name, a file's contents or a table cell reached the terminal: a cell or column name holding `\e]52;c;…\a` silently replaced the viewer's clipboard when the cursor moved onto the file, and `\e[2J` or `\e]0;…\a` could repaint the screen or the title. The table preview, the preview status lines, the file list and text previews all go through the one sanitizing step now
68
+ - Text copied with `y` or `Y` loses its trailing newline and has control characters other than newline and tab replaced, so a cell cannot execute itself when pasted into a shell. A cell holding a newline is reported as `copied, 2 lines`, since the grid draws it on one line
69
+ - SQLite databases are opened by absolute path, so a file named like an option (`-cmd`) cannot be read as one, and with `-safe` where the `sqlite3` command supports it, which refuses `writefile()`, `load_extension()` and `ATTACH`
70
+
71
+ ### Changed
72
+ - Table previews read up to 512 KiB of a `.csv` or `.tsv` instead of 64 KiB, and `TABLE_PREVIEW`'s `max_bytes` goes up to 4 MiB. Parsing now stops at `max_rows` rows rather than parsing everything that was read, so a wider limit does not cost more time: a 40-column CSV showed 147 rows in 2 ms before and 1000 rows in 14 ms now, where the old code needed 29 ms for the same rows. Cells are measured and drawn from their first 256 characters, which keeps a cell of several hundred thousand characters from slowing the layout
73
+
74
+ - `s`, `/` and `F` no longer use fzf, and `rufio -c` no longer checks for it. The keybind actions are renamed to `file_search` / `file_search_alt`; the former `fzf_search` / `fzf_search_alt` names in `KEYBINDS` are still accepted as aliases (the new names win when both are set)
75
+ - G mode file name search uses the same fuzzy matching as `s`: results are ranked, matched characters are highlighted and filtering runs in the background instead of on each keystroke in the UI thread. Content search stays literal. Exclusions, skipped counts and bookmark labels are unchanged
76
+ - Fuzzy ranking no longer penalizes the distance from the start of the path, and the first character of the file name gets +8, so file names that start with the query rank first (e.g. `Rakefile` for `rakefile`, `gemspec.rb` for `gemspec`). Ruby and native scoring stay identical
77
+ - `rake native:sync_nvim` (`make -C lib_zig/rufio_native sync-nvim`) copies the shared Zig core (`search.zig`, `os.zig`, `fuzzy.zig` and their tests) to the usurai.nvim Zig tree and rebuilds it there, so both projects stay on one search and fuzzy implementation
78
+
79
+ ### Performance
80
+ - The fuzzy index narrows from the previous query: when the previous query is a subsequence of the new one (typing more characters), only the previous matches and candidates added since are scored. `Rufio::FuzzySearch#scanned` reports how many candidates the last query scored; the Ruby fallback narrows the same way
81
+ - Native fuzzy scoring runs on all CPU cores for 2,048 or more candidates, with work split into chunks claimed atomically and per-thread top-K merged deterministically (results are identical to a single thread)
82
+ - The native index stores each candidate once as UTF-8 plus a start offset and a character count, and decodes characters only for candidates that pass the subsequence check. For 168,785 paths the memory increase dropped from about 222 MiB to about 48 MiB, and registration from about 390 ms to about 43 ms
83
+ - Sessions keep frozen candidates without copying them, and the file, rga and G mode sources emit frozen rows. Reopening `s` from the cache for 168,785 files takes about 0.22–0.32 s instead of 0.76–1.05 s
84
+ - File candidates travel as packed blocks (`Rufio::FuzzyCandidateBlock`: NUL-terminated labels in one string) instead of one Hash per file. Sessions register a block with `Rufio::FuzzySearch#add_packed` and build rows only for candidates that reach the results; the file list cache keeps the scanned blocks and hands the same objects to the next session. `s` / `/` and G mode file names use blocks; rga results keep rows. Sources may yield either rows or blocks. No native library change
85
+ - Measured on Linux x86_64 (4 cores) with 168,000 synthetic files: reopening `s` from the cache completes in 25–40 ms instead of 686–860 ms, a fresh scan in 434–659 ms instead of about 1,570 ms, G mode file names in 541–596 ms instead of about 1,760 ms, and Ruby objects held by an open session drop from 87–136 MiB to 17 MiB
86
+ - `NativeContentSearch#each_batch(max_events:)` splits large drains so parsing does not hold the interpreter lock for long, and a search that ran before any candidate arrived no longer delays the first results by the 50 ms refresh interval
87
+ - On the same data, a query takes 1.7–12.9 ms instead of 20.7–47.6 ms, and typing `s` → `sctrl` takes 9–14 ms per key instead of 22–55 ms. The bundled native libraries for all eight platforms are rebuilt
88
+ - The native file listing can return root-relative labels packed per root (`core_files_labels_create`, `NativeContentSearch.new(labels: true)`), and `s` / `/` and G mode file names turn them into candidate blocks without per-file Ruby strings. Opening `s` on 168,000 files completes in about 93 ms instead of 513 ms, and G mode file names in about 124 ms instead of 722 ms (Linux x86_64, 4 cores); `rg --files | fzf` takes about 176 ms on the same files
89
+ - The multi-thread threshold was lowered from 16,384 to 2,048 candidates after measuring, so narrowed queries no longer fall back to one thread (`unicod` / `unicode` on 50,934 paths: 3.0 / 2.3 ms instead of 7.0 / 5.2 ms). `FuzzySearch#query(positions:)` and `FuzzySearchSession.new(position_limit:)` recover match positions only for the best results; G mode computes positions for rows below the top 100 when they are drawn (`FuzzySearch.positions`)
90
+ - G mode content search no longer fills its in-memory cache during the first search: files are searched as usual and cached by a background thread afterwards, so the first search takes about 88–118 ms instead of 156–199 ms (rg: 87–107 ms). Searches made while the cache is being filled do not use it. `NativeContentSearch::Cache#wait_for_fill` waits for the fill
91
+ - The bundled native libraries for all eight platforms are rebuilt with these APIs; older libraries keep working with the previous code paths
92
+
93
+ ### Fixed
94
+ - G mode and the fuzzy search screen erase rows left over from the previous frame when the result list gets shorter
95
+
10
96
  ## [1.5.1] - 2026-11-15
11
97
 
12
98
  ### Fixed
data/README.md CHANGED
@@ -8,6 +8,13 @@ Add your own actions in Ruby.
8
8
 
9
9
  [日本語](./README_ja.md) | **English**
10
10
 
11
+ 2.0.0 brings grid previews for tabular files (`.csv`, `.tsv`, `.xlsx`, `.ods` and SQLite),
12
+ terminal image previews via the Kitty graphics protocol (`.png`, `.jpg`, `.bmp`, decoded and scaled
13
+ by the bundled native library), and a single `/` search key across the file list, text previews and
14
+ tables (removing the old `G` mode and `rga` dependency).
15
+ See the [table preview notes](./docs/csv_cell_preview_design_ja.md) and
16
+ [image preview notes](./docs/image_preview_design_ja.md).
17
+
11
18
  ## What Makes rufio Different
12
19
 
13
20
  rufio brings finding files, running scripts, and checking results together in one interface.
@@ -15,7 +22,7 @@ rufio brings finding files, running scripts, and checking results together in on
15
22
  - **Run scripts where your files are**: Register your script directories, then press `:`, type `@` + part of a script name, press `Tab`, and hit `Enter`. Run Ruby, Python, or PowerShell scripts in the directory you are browsing
16
23
  - **Follow jobs and execution logs**: Keep browsing while scripts run in the background. Press `J` to check jobs and `L` to view execution logs
17
24
  - **Add your own actions in Ruby**: Define custom commands with a small Ruby DSL in `~/.config/rufio/commands.rb`. `~/.rufio/commands.rb` is also supported
18
- - **Use installed tools without extra configuration**: Search file names with fzf, search contents with rga, highlight previews with bat, and navigate directory history with zoxide
25
+ - **Use installed tools without extra configuration**: Highlight previews with bat, read SQLite databases with `sqlite3`, and navigate directory history with zoxide
19
26
  - **Windows support**: Run PowerShell scripts with keyboard input handling adapted to Windows terminals
20
27
  - **Trace behavior in the source**: The implementation is primarily Ruby, so you can inspect and change the parts you need. Security design is documented in [SECURITY.md](./SECURITY.md)
21
28
 
@@ -33,7 +40,13 @@ rufio brings finding files, running scripts, and checking results together in on
33
40
 
34
41
  - **Vim-like Key Bindings**: Intuitive navigation
35
42
  - **Real-time Preview**: Instantly display file contents with syntax highlighting (via `bat`), including `.zip` entry lists
36
- - **Fast Search**: Integration with fzf/rga, plus built-in search across all bookmarks that also reads PDF, Excel and PowerPoint
43
+ - **Images in the Terminal**: `.png`, `.jpg` and `.bmp` are drawn in the preview pane with the Kitty graphics protocol (kitty, Ghostty, WezTerm, Konsole). The bundled native library decodes and scales the picture down to the pane first, with no third-party image code and no external tools; other terminals show the format and dimensions as text
44
+ - **Tables as a Grid**: `.csv`, `.tsv`, `.tab`, `.xlsx`, `.xlsm`, `.ods` and SQLite databases (with the `sqlite3` command, recognised by file signature) are shown as rows and columns, with the header row fixed while scrolling and automatic decoding of UTF-8, UTF-16, CP932 and EUC-JP
45
+ - **Sheets and Tables**: `[` and `]` switch between a workbook's sheets or a database's tables and `t` opens the list of sheets or tables to pick from, and only the one on screen is read
46
+ - **Move Between Cells**: In preview mode (`P`), `hjkl` moves a cell cursor through the grid, which scrolls in both directions to follow it
47
+ - **Pick Columns**: `Space` selects columns, and `y` then copies the cursor row's selected columns joined with commas
48
+ - **Copy with `y`**: Copies the cell under the cursor (`Y` for the whole row), or the current and selected file paths in the file list, using your clipboard command or OSC 52 over SSH
49
+ - **One Search Key**: `/` searches where you are. The file list searches the directory tree by name (fuzzy) or contents (also reading PDF, Excel and PowerPoint); a preview searches inside the file (`n`/`N` between matches); a table preview filters its rows with `price > 100, name a%`, and for a SQLite table that runs as a read-only `SELECT ... WHERE` inside the database
37
50
  - **ZIP Archives**: Extract or compress selected items as a background job
38
51
  - **Jump to a Path**: Paste any path into `:cd`
39
52
  - **Bookmarks**: Quick access to frequently used directories
@@ -93,15 +106,14 @@ The most used keys. See the **[User Guide](./docs/guide.md)** for every key and
93
106
  | `m/c/x` | Move / copy / delete selected items |
94
107
  | `z` | Extract or compress selected items (`.zip`); zoxide history when nothing is selected |
95
108
  | `a/A`, `r`, `d` | Create file / directory, rename, delete |
96
- | `f`, `s`, `F` | Filter, fzf file name search, rga content search |
97
- | `G` | Search names or contents (PDF, Excel, PowerPoint too) across all bookmarks |
98
- | `b`, `B`, `1-9`, `Tab` | Add bookmark, bookmark menu, jump, next bookmark |
109
+ | `f`, `/` | Filter the list, search under the current directory (names or contents) |
110
+ | `b`, `B`, `1-9` | Add bookmark, bookmark menu, jump to bookmark 1-9 |
99
111
  | `:` | Command mode (`@script`, `rake:task`, `!shell`, `cd <path>`) |
100
112
  | `J`, `L`, `C` | Jobs, logs, config directory |
101
113
  | `?` | Help |
102
114
  | `q`, `T` | Quit, quit and cd the shell to the current directory |
103
115
 
104
- In G mode, use `Up` / `Down` or `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it. Application cursor arrows and extended Ctrl-key sequences are supported, including on Ghostty.
116
+ In the search screen, use `Up` / `Down` or `Ctrl+J` / `Ctrl+K` to select the next / previous result and `Enter` to open it. Application cursor arrows and extended Ctrl-key sequences are supported, including on Ghostty.
105
117
 
106
118
  ## Documentation
107
119
 
data/README_ja.md CHANGED
@@ -8,6 +8,11 @@
8
8
 
9
9
  **日本語** | [English](./README.md)
10
10
 
11
+ 2.0.0 では表形式のファイルを行列で表示し(`.csv` / `.tsv` / `.xlsx` / `.ods` と SQLite)、
12
+ Kitty グラフィックスプロトコルによる画像プレビュー(`.png` / `.jpg` / `.bmp`、同梱のネイティブライブラリでデコード・縮小)を追加しました。
13
+ また検索キーを `/` に一本化し、旧 `G` モードと `rga` 依存を廃止しました。
14
+ 詳細は[表プレビューの設計記録](./docs/csv_cell_preview_design_ja.md)と[画像プレビューの設計記録](./docs/image_preview_design_ja.md)を参照してください。
15
+
11
16
  ## rufioならではの点
12
17
 
13
18
  rufio は、ファイルを探すところからスクリプトの実行、結果の確認までを一つの画面にまとめます。
@@ -15,7 +20,7 @@ rufio は、ファイルを探すところからスクリプトの実行、結
15
20
  - **ファイルのある場所からスクリプトを実行**: スクリプトのディレクトリを登録し、`:` → `@` + スクリプト名の一部 → `Tab` → `Enter` で呼び出せます。Ruby・Python・PowerShell を、いま開いているディレクトリで実行できます
16
21
  - **ジョブとログで実行結果を追える**: バックグラウンドで実行しながらファイル操作を続け、`J` でジョブ、`L` で実行ログを確認できます
17
22
  - **自分用の操作を Ruby で追加**: `~/.config/rufio/commands.rb` に小さな Ruby DSL で独自コマンドを定義できます。`~/.rufio/commands.rb` にも対応しています
18
- - **インストール済みのツールと追加設定なしで連携**: fzf でファイル名検索、rga で内容検索、bat でプレビューのシンタックスハイライト、zoxide でディレクトリ履歴から移動できます
23
+ - **インストール済みのツールと追加設定なしで連携**: bat でプレビューのシンタックスハイライト、`sqlite3` で SQLite の読み取り、zoxide でディレクトリ履歴から移動できます
19
24
  - **Windows にも対応**: PowerShell スクリプトの実行に対応し、Windows のターミナルに合わせたキー入力処理を備えています
20
25
  - **挙動をソースで追いやすい**: Ruby を中心とした実装で、必要な処理を自分で確認・修正できます。セキュリティに関する設計は [SECURITY.md](./SECURITY.md) にまとめています
21
26
 
@@ -33,7 +38,13 @@ rufio は、ファイルを探すところからスクリプトの実行、結
33
38
 
34
39
  - **Vimライクなキーバインド**: 直感的なナビゲーション
35
40
  - **リアルタイムプレビュー**: ファイル内容を即座に表示(`bat` によるシンタックスハイライト対応、`.zip` はエントリ一覧)
36
- - **高速検索**: fzf/rgaとの連携に加え、PDF・Excel・PowerPointも読める全ブックマーク横断検索を内蔵
41
+ - **端末に画像を表示**: Kitty グラフィックスプロトコルで `.png` / `.jpg` / `.bmp` をプレビューペインに描きます(kitty・Ghostty・WezTerm・Konsole)。同梱のネイティブライブラリ(第三者の画像コードも外部ツールも使わない)がペインの大きさまで縮小してから送ります。非対応端末では形式と寸法をテキストで表示します
42
+ - **表を行列で表示**: `.csv` / `.tsv` / `.tab` / `.xlsx` / `.xlsm` / `.ods`、および `sqlite3` コマンドがあれば SQLite のデータベースを、列見出し付きのグリッドで表示します。スクロール中もヘッダ行は固定され、UTF-8・UTF-16・CP932・EUC-JP を自動判定して読み込みます
43
+ - **シート・テーブルの切替**: `[` / `]` で Excel のシートや SQLite のテーブルを切り替えます。`t` を押すとシート/テーブル一覧から選べます。表示しているものだけを読み込みます
44
+ - **セル間を移動**: プレビューモード(`P`)で `hjkl` によりセルカーソルを動かせます。カーソルに合わせて縦横にスクロールします
45
+ - **カラムを選んでコピー**: `Space` でカラムを選び、`y` でカーソル行の選択カラムをカンマ区切りで連結してコピーします
46
+ - **`y` でコピー**: カーソル位置のセルを(`Y` で行全体を)クリップボードへコピーします。ファイル一覧では選択中(またはカーソル位置)のパスをコピーします。コマンドがない環境では OSC 52 を使うので SSH 越しでも動きます
47
+ - **検索キーは `/` だけ**: いる場所によって対象が変わります。ファイル一覧では現在のディレクトリ配下をファイル名(あいまい)か内容(PDF・Excel・PowerPoint も読む)で検索、プレビューではファイルの中を検索(`n`/`N` で前後の一致へ)、表プレビューでは `price > 100, name a%` のように行を絞り込みます。SQLite のテーブルでは読み取り専用の `SELECT ... WHERE` をデータベース側で実行します
37
48
  - **ZIPの展開・圧縮**: 選択したアイテムをバックグラウンドで展開・圧縮
38
49
  - **パスへ移動**: コピーしたパスを `:cd` に貼り付けて移動
39
50
  - **ブックマーク**: よく使うディレクトリに素早くアクセス
@@ -41,6 +52,8 @@ rufio は、ファイルを探すところからスクリプトの実行、結
41
52
 
42
53
  テキストのプレビューは先頭64 KiBまで読み込みます。PDFの本文はプレビューせず、ファイル移動時の読み込みを省きます。
43
54
 
55
+ `.csv` / `.tsv` / `.tab` / `.xlsx` / `.xlsm` / `.ods` と SQLite(`sqlite3` コマンドがある場合。拡張子ではなくファイル先頭のシグネチャで判定します)は行列(グリッド)で表示します。テキスト形式は先頭 512 KiB まで読み込みます。プレビューモード(`P`)では `hjkl` でセルを移動し、`g`/`}` で先頭行・最終行、`0`/`$` で先頭列・最終列へ移動できます。`y` でカーソル位置のセル、`Y` で行全体をクリップボードへコピーでき、`[` / `]` でシートやテーブルを切り替えられます。ファイル名の下の行にセル番地と列名(`R3C2 price`)とコピー結果が出ます。読み込み上限や区切り文字、ヘッダ行の扱い、文字コードは `config.rb` の `TABLE_PREVIEW` で変更できます。
56
+
44
57
  ### クロスプラットフォーム
45
58
 
46
59
  - **macOS**: ネイティブサポート
@@ -93,15 +106,14 @@ rufio /path/to # 指定したディレクトリで起動
93
106
  | `m/c/x` | 選択したアイテムの移動 / コピー / 削除 |
94
107
  | `z` | 選択したアイテムの展開・圧縮(`.zip`)。未選択時は zoxide 履歴 |
95
108
  | `a/A`、`r`、`d` | ファイル / ディレクトリ作成、リネーム、削除 |
96
- | `f`、`s`、`F` | フィルター、fzf でファイル名検索、rga で内容検索 |
97
- | `G` | 全ブックマーク配下のファイル名・内容(PDF・Excel・PowerPoint も)を横断検索 |
98
- | `b`、`B`、`1-9`、`Tab` | ブックマーク追加、メニュー、ジャンプ、次のブックマーク |
109
+ | `f`、`/` | 一覧の絞り込み、現在のディレクトリ配下の検索(ファイル名・内容) |
110
+ | `b`、`B`、`1-9` | ブックマーク追加、メニュー、ブックマーク 1-9 へジャンプ |
99
111
  | `:` | コマンドモード(`@スクリプト`、`rake:タスク`、`!シェル`、`cd <パス>`) |
100
112
  | `J`、`L`、`C` | ジョブ、ログ、設定ディレクトリ |
101
113
  | `?` | ヘルプ |
102
114
  | `q`、`T` | 終了、終了してシェルを現在のディレクトリへ移動 |
103
115
 
104
- Gモードでは `↓` / `↑` または `Ctrl+J` / `Ctrl+K` で次/前の検索結果を選択し、`Enter` で開きます。Ghosttyなどのアプリケーションカーソル形式の矢印キーと拡張Ctrlキー入力にも対応しています。
116
+ 検索画面では `↓` / `↑` または `Ctrl+J` / `Ctrl+K` で次/前の検索結果を選択し、`Enter` で開きます。Ghosttyなどのアプリケーションカーソル形式の矢印キーと拡張Ctrlキー入力にも対応しています。
105
117
 
106
118
  ## ドキュメント
107
119
 
data/Rakefile CHANGED
@@ -25,6 +25,11 @@ namespace :native do
25
25
  task :check do
26
26
  ruby '-I test -I lib test/test_native_platform_binaries.rb'
27
27
  end
28
+
29
+ desc 'Sync shared Zig core (search/os/fuzzy and tests) to usurai.nvim and rebuild'
30
+ task :sync_nvim do
31
+ sh 'make -C lib_zig/rufio_native sync-nvim'
32
+ end
28
33
  end
29
34
 
30
35
  # Gem build and push tasks
data/SECURITY.md CHANGED
@@ -31,21 +31,25 @@ rufio is a local TUI tool run by you, on files you can already access.
31
31
  - Commands you type yourself in command mode (`:`, `!`) — they are executed as shell commands
32
32
  - Code in your own configuration: `~/.rufio/commands.rb` and `~/.config/rufio/commands.rb` are **evaluated as Ruby**. Keep them writable only by you
33
33
  - Scripts you register under script paths — they run with your privileges
34
- - Vulnerabilities in external tools (fzf, rga, bat, zoxide, editors)
34
+ - Vulnerabilities in external tools (rga, bat, zoxide, editors)
35
35
 
36
36
  ### Design practices
37
37
 
38
38
  - Files and scripts are launched in array form (`system(*argv)`), never through a shell string; paths beginning with `-` are prefixed with `./`
39
39
  - Search queries are passed to rga after `--`
40
+ - Everything drawn to the screen passes through one sanitizing step: control characters (C0 and C1, so `ESC`, `BEL` and the 8-bit `CSI`) are replaced with a space before a cell is stored, so an escape sequence in a file name, a file's contents, a spreadsheet cell, a database table name or a tool's output cannot reach the terminal
41
+ - Text copied to the clipboard has its trailing newline removed, and control characters other than newline and tab replaced, so a value cannot execute on paste
42
+ - SQLite databases are opened read-only, with `-safe` where the `sqlite3` command supports it, by absolute path, and only `SELECT` is issued; table names are quoted as identifiers
40
43
  - YAML is loaded with `YAML.safe_load`
41
44
  - Command execution logs are written with `0600` permissions
42
- - Runtime dependencies are limited to `io-console`, `pastel`, `tty-cursor`, `tty-screen`
45
+ - Runtime dependencies are kept to the terminal libraries (`io-console`, `pastel`, `tty-cursor`, `tty-screen`) and the parsers the previews need (`csv`, `rubyzip`, `roo`, `nokogiri`, `pdf-reader`, `base64`). A parser only ever reads the file being previewed or searched
43
46
  - Gems are published from tagged commits via RubyGems Trusted Publishing (no long-lived API key); CI runs the test suite before publishing
44
47
 
45
48
  ### Known limitations
46
49
 
47
- - Text previews only detect binary files (by control-character ratio); terminal escape sequences inside otherwise-textual files are not explicitly stripped. Avoid previewing untrusted files in a terminal you do not trust
48
- - The optional native extension under `lib_zig` is not shipped in the gem and has not been independently audited
50
+ - A preview reads the file it shows, so a parser bug in a bundled library (`roo` for spreadsheets, Ruby's `csv`) is reachable by moving the cursor onto a file. Previews are bounded (512 KiB of text, 1000 rows, 10 MiB for a spreadsheet) and a file that cannot be parsed falls back to the archive or binary view
51
+ - A SQLite preview runs the `sqlite3` command on the file. A view's body is SQL written by whoever made the file; it is executed read-only and in `-safe` mode where available, and the CLI refuses `writefile()`, `readfile()`, `edit()` and `load_extension()` outside a direct statement. A `sqlite3` older than 3.32 does not carry those refusals
52
+ - The optional native library (`lib_zig`, prebuilt under `lib/rufio/native/` and compiled with `-O ReleaseSafe`) is shipped in the gem for faster search, directory scanning, and image preview decoding, and has not been independently audited. Image preview native decoding can be disabled with `RUFIO_NATIVE_IMAGE=0`, and image preview itself with `RUFIO_IMAGE_PREVIEW=0`
49
53
 
50
54
  ---
51
55
 
@@ -78,18 +82,22 @@ rufioは、あなた自身がアクセスできるファイルに対して、ロ
78
82
  - コマンドモード(`:`、`!`)で自分で入力したコマンド — シェルコマンドとして実行されます
79
83
  - 自分の設定ファイル内のコード — `~/.rufio/commands.rb` と `~/.config/rufio/commands.rb` は**Rubyとして評価**されます。書き込み権限は自分だけにしてください
80
84
  - スクリプトパスに登録したスクリプト — あなたの権限で実行されます
81
- - 外部ツール(fzf、rga、bat、zoxide、エディタ)自体の脆弱性
85
+ - 外部ツール(rga、bat、zoxide、エディタ)自体の脆弱性
82
86
 
83
87
  ### 設計上の方針
84
88
 
85
89
  - ファイルやスクリプトは配列形式(`system(*argv)`)で起動し、シェル文字列を介しません。`-` で始まるパスには `./` を付与します
86
90
  - rga には `--` を挟んで検索語を渡します
91
+ - 画面に出す文字列はすべて 1 箇所で無害化します。制御文字(C0 と C1。`ESC`・`BEL`・8 ビットの `CSI` を含む)はバッファに入れる前に空白へ置き換えるため、ファイル名・ファイル内容・表のセル・データベースのテーブル名・ツールの出力に含まれるエスケープシーケンスがターミナルへ届きません
92
+ - クリップボードへコピーする文字列は、末尾の改行を落とし、改行とタブ以外の制御文字を置き換えます(貼り付けた瞬間に実行されるのを防ぐため)
93
+ - SQLite は読み取り専用で開き、`sqlite3` が対応していれば `-safe` を付け、絶対パスで渡し、`SELECT` のみを発行します。テーブル名は識別子としてクォートします
87
94
  - YAML は `YAML.safe_load` で読み込みます
88
95
  - コマンド実行ログは `0600` で保存します
89
- - 実行時依存gemは `io-console`、`pastel`、`tty-cursor`、`tty-screen` のみです
96
+ - 実行時依存gemは、ターミナル操作(`io-console`、`pastel`、`tty-cursor`、`tty-screen`)と、プレビュー・検索に必要な解析ライブラリ(`csv`、`rubyzip`、`roo`、`nokogiri`、`pdf-reader`、`base64`)に限っています。解析ライブラリはプレビュー・検索の対象ファイルを読むためだけに使います
90
97
  - gemはタグ付きコミットからRubyGemsのTrusted Publishingで公開します(長期APIキーなし)。公開前にCIでテストを実行します
91
98
 
92
99
  ### 既知の制約
93
100
 
94
- - テキストのプレビューはバイナリ判定(制御文字の比率)のみで、テキストとして扱われるファイル内のエスケープシーケンスは明示的に除去していません。信頼できないファイルを、信頼できないターミナルでプレビューするのは避けてください
95
- - `lib_zig` のネイティブ拡張(任意機能)はgemに同梱しておらず、第三者による監査も受けていません
101
+ - プレビューは対象ファイルを解析するため、同梱ライブラリ(表計算は `roo`、CSV は Ruby の `csv`)の解析不具合にはカーソルを合わせるだけで到達します。読み込み量には上限があり(テキスト 512 KiB、1000 行、表計算 10 MiB)、解析できないファイルはアーカイブ表示またはバイナリ表示に戻ります
102
+ - SQLite のプレビューは `sqlite3` コマンドをファイルに対して実行します。ビューの本体はファイル作成者が書いた SQL です。読み取り専用かつ(対応していれば)`-safe` で実行し、CLI 側も直接の文以外からの `writefile()`・`readfile()`・`edit()`・`load_extension()` を拒否します。3.32 より古い `sqlite3` にはこの拒否がありません
103
+ - `lib_zig` のネイティブライブラリ(`lib/rufio/native/` に `-O ReleaseSafe` でビルド済みバイナリを同梱)は、検索・ディレクトリ走査・画像プレビューのデコード高速化のために利用され、第三者による監査は受けていません。画像プレビューのネイティブデコードは `RUFIO_NATIVE_IMAGE=0`、画像プレビュー自体は `RUFIO_IMAGE_PREVIEW=0` で無効化できます