mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-03 16:41:27 +01:00
`file_text::catch_up` read every file without a row, which after a write meant walking every file node there is to find the one or two just put in. It now takes the part of the tree to look in: an upload asks about the folder it went into, an import about the folder it was poured into, an SFTP save about the folder it landed in, a decrypt about what was decrypted. Only an import at the root and the pass at start look at everything. The excerpt of a file found by its text marks each matched word between U+0002 and U+0003, which no text file has a use for, and the list draws them lit. A cut through a match leaves an opening without its close, and the rest is lit to the end rather than the marker shown. The screenshots are taken again, so the search one shows it.
79 lines
3.1 KiB
Markdown
79 lines
3.1 KiB
Markdown
# Files and search
|
|
|
|
## Files
|
|
|
|
A file is a node like a document, only with bytes instead of text. It sits in a
|
|
folder beside the notes about it, shows its size in the list, and `Enter` opens
|
|
it.
|
|
|
|
Put files in:
|
|
|
|
- drop them onto the list;
|
|
- `:upload` picks files for the folder you are in;
|
|
- `:import` uploads a whole folder, and `:import!` a zip
|
|
(see [Not losing things](Not-Losing-Things.md#import));
|
|
- copy them in over the [SFTP mount](SFTP.md).
|
|
|
|
Each upload is written to disk as it arrives, never held in memory, so the only
|
|
limit is `WORKSPACE_MAX_UPLOAD_MB` (1024 by default) per request.
|
|
|
|
### What opens in place
|
|
|
|
- images, video and audio;
|
|
- PDFs, in the browser's own viewer;
|
|
- text and source code of any kind, with line numbers, up to the first
|
|
256 KiB;
|
|
- markdown, rendered, with `:source` to see it as written;
|
|
- CSV and TSV, as a table of the first 500 rows;
|
|
- certificates, keys and keystores (`.pem`, `.crt`, `.cer`, `.der`, `.csr`,
|
|
`.key`, `.p8`, `.p12`, `.pfx`), read on the server.
|
|
|
|

|
|
|
|
A certificate shows its subject, issuer, validity, key, names, usage and
|
|
fingerprints, and which key belongs to which certificate. A `.p12` or an
|
|
encrypted key asks for its password, which opens it for that one look and is
|
|
not stored. Nothing of a private key is sent back but its algorithm and size.
|
|
|
|

|
|
|
|
Anything else is a download: `:download` (`:dl`) fetches the file under the
|
|
cursor, and `gx` opens it in a browser tab of its own. Files are renamed with
|
|
`:name`, moved like documents, and deleted into the trash with `x`.
|
|
|
|
Uploads are only ever served as types that cannot run in the browser. An HTML
|
|
file or an SVG, for example, downloads instead of opening.
|
|
|
|
## Search
|
|
|
|
| key | searches |
|
|
| --- | --- |
|
|
| `/` | the space you are in |
|
|
| `Ctrl-P` | every space |
|
|
|
|
Results appear as you type, ranked by relevance, each with the space and
|
|
folder it is in. `Tab` or `Ctrl-N` / `Ctrl-P` walk them without leaving the
|
|
line, and `Enter` opens the one lit. Afterwards `n` and `N` open the next and
|
|
previous result beside the list, and `:noh` clears the search.
|
|
|
|

|
|
|
|
Each word you type matches the start of a word, so `inge` finds "ingest". All
|
|
the words must be there. Punctuation is ignored, so a search of nothing else
|
|
finds nothing.
|
|
|
|
### Inside files
|
|
|
|
A search reads the text files in the tree as well as the documents. A file
|
|
counts as text by its type, or when its first 8 KiB read as UTF-8 with no NUL
|
|
byte, which covers `.log` files and Makefiles. The first 256 KiB of each is
|
|
indexed, the same part the viewer shows. A file found by its text shows the
|
|
words around the match under its name, with the words that matched lit.
|
|
|
|
The text is read when a file arrives, by upload, import or the SFTP mount,
|
|
again when its bytes change, and at start for any file still missing it. PDFs,
|
|
office documents and images are not read.
|
|
|
|
A sealed file is never indexed; see [The vault](Vault.md). Sealing a file drops
|
|
its text in the same step, and decrypting it reads it again.
|