editor: /table focus, cell inline shortcuts, vim visual-mode snap - #522
Open
junereycasuga wants to merge 4 commits into
Open
editor: /table focus, cell inline shortcuts, vim visual-mode snap#522junereycasuga wants to merge 4 commits into
junereycasuga wants to merge 4 commits into
Conversation
adibhanna
added a commit
that referenced
this pull request
Aug 3, 2026
CI has been red on Windows since #522's database fix landed, and only on Windows: macOS, Linux x64 and Linux arm all pass the same test. It fails in `TestReadNoteStatusesDistinguishMissingFromBroken`, which asks the server to read `inbox/Db.base`, a database folder, and expects the 400 that says "that is a directory, not a file". Windows answered 500. The classification was made from the errno the read returned. `writeError` tested for `EISDIR`, which is what Unix gives you for reading a directory. Windows gives `ERROR_INVALID_FUNCTION` instead, printed in the CI log as "Incorrect function", so the test missed and the request fell through to the "something is broken here" branch. The server was not broken on either platform; the same request simply got two different answers. `ReadNote` already stats the path before reading it, so the answer is known one line earlier and does not need to be inferred from a platform's error code. It now returns a `vault.ErrIsDirectory` sentinel from that stat, the same shape as the `vault.ErrPathEscape` the handler already maps, and `writeError` maps it to 400. The `EISDIR` test stays underneath it as a fallback for read paths that have not been classified, where it is still correct on the platforms that produce it. The end-to-end test that caught this only fails on Windows, which is a poor place to keep the guarantee, so the classification is pinned in the vault package too: a directory is `ErrIsDirectory`, a real note still reads, and a missing file inside that directory is still `os.ErrNotExist` rather than being swallowed by the new branch. That test means the same thing on every runner. Unrelated to the task work on this branch; it was inherited red. How to test locally: `cd apps/server && go test ./...`. The new `TestReadNoteRejectsADirectoryOnEveryPlatform` fails before this change on any platform, because ReadNote returned the raw platform error rather than the sentinel. The Windows half of the fix cannot be reproduced on macOS, which is the reason it is no longer decided by an errno at all.
junereycasuga
force-pushed
the
fix/table-interactions
branch
from
August 7, 2026 20:04
e035e3f to
dd0a06a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three table-editor improvements, all driven by the same friction: tables are atomic block widgets, so the normal CodeMirror text-editing affordances don't reach them.
1. Inline formatting shortcuts in cells
Cmd-B / Cmd-I / Cmd-E now wrap (or unwrap) the selection in bold, italic,
code, directly inside a table cell. Toggle logic handles markers on either edge of the selection and supports word-run expansion when nothing is selected.2. /table focuses the first header cell
Inserting a table via /table now drops you straight into the first header cell so you can start typing without an extra click. A bounded rAF retry (~200 ms) handles the parse lag between insertion and widget creation.
3. Vim visual-mode snap across tables
In vim visual mode, j/k toward a table used to drop the selection head inside the atomic interior — a partial delete there corrupts the markdown. Now the head snaps to the table's far edge in one motion, so d removes the whole table cleanly. A ViewPlugin toggles .is-selected on the covered widget (CM draws no selection background over block widgets) so the snap is actually visible.
Bug fix: leaked context-menu keydown listener
While testing, found that the table context menu's deferred setTimeout listener registration could fire after teardown already ran, permanently leaking a capture-phase keydown listener on window that swallowed arrow keys. Fixed with a tornDown guard.
Test plan