Repository navigation
feat(tui): open and save .sql files from disk in their own tabs - #814
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edb3ca6fc6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
DokaDev
force-pushed
the
files-048/4-open-save
branch
3 times, most recently
from
December 6, 2026 05:39
3320377 to
d938dc3
Compare
:e <path> opens a file from anywhere on disk in a tab of its own (one tab per file, a link included), on the active tab's connection; any other argument stays a saved query's name, and a path inside the saved queries' folder opens that saved query. Ctrl+S and :w write the file only when asked, after checking that it is the version last read; :w <path> saves a tab as a file and asks before replacing another one. * shows text that is not in the file yet, which is kept in the state folder meanwhile, so quitting asks nothing and the next start brings it back. Closing asks: save, drop or keep. A file changed on disk is reloaded when its clean tab is entered, and a tab with changes asks at its next save. Read-only files open and refuse saves in words, as does a folder that cannot be written. :e! reloads from disk. Statements of a CRLF file or saved query are sent with CRLF again. Related issue: #311
…e paths on the : line Space f o opens the file browser in the folder datarig was started from (else home), with .sql files drawn as they are and other files dimmed; any file opens. Space f a saves the active tab as a file there, a name typed being a file in the folder shown. The : line completes the path argument of :e and :w from the names in its folder, read off the UI thread as the export path field reads them. A closed file tab comes back with Space t u, read again from its file, and a file gone from disk is found by its path. Also the new Files guide page, getting started, the regenerated key map and the screens of a file tab, its questions and the browsers. Related issue: #311
…h> in Korean
The close question of a file tab says where its changes would go ("Its
changes are not saved to ~/work/query.sql."), and the Korean refusals keep
the :w <path> syntax as typed. The leader group list, the command list and
the which-key screens gain Space f and :e!.
Related issue: #311
Related issue: #311
…ct, and let a file become a saved query A clean tab whose file is gone now compares its text again, so it shows *, keeps its text in the copy and asks on close. A file tab in conflict whose text is in no copy (a second instance, a failed copy) is counted before quitting. A file tab saved under a saved query's name drops its file and its copy, so the next start brings back the saved query. The file tests also build and pass on Windows. Related issue: #311
The browser's top row writes a folder under the home folder as its field takes it, ~/ and then the rest with /, on every platform, as the key file picker always has. The test expected the platform's separator there and failed on Windows. Related issue: #311
A file tab whose text is not in its file showed * in the tab bar, but the status line said nothing about it. It now says "Not saved to the file yet", over an outcome that is only information (a warning or an error said there keeps its place), and the hint line starts with the keys that save the tab: Ctrl+S save, then Space f a save as a file (only the latter for a read-only file). At 80x24 the note and Ctrl+S save fit; the save as hint follows where there is room. In English and Korean. Related issue: #817
DokaDev
force-pushed
the
files-048/4-open-save
branch
from
December 6, 2026 08:37
d938dc3 to
387bcad
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.
Related issue: #311
Related issue: #817
Fourth part of the 0.48.0 "files" stack, on top of #808 (
files-048/3-file-core). This is the TUI of part B of #311:.sqlfiles from anywhere on disk, each in a tab of its own, built on #808'stextfilereader and writer, its unsaved-text store and the workspace'sfiletab.What changes for users
:e <path>opens a file when the argument starts with/,~,./or../(on Windows alsoC:\,C:/,\\); anything else stays a saved query's name, so:e reports/dailystill opens that saved query. Relative paths start from the folder datarig was started from. The:line completes the path from the names in its folder (read off the UI thread, as the export path field does); until a name is picked,Entertakes the path as typed.Space f o(a newSpace fgroup, "File") opens the file browser in the launch folder, else home:.sqlnames as they are, the rest dimmed, any file opens. A path inside the saved queries' folder opens that saved query. One tab per file, told by the file itself, so a link or another spelling goes to its tab. A new file tab takes the active tab's connection, as a new console does. With no profile at all,:e <path>andSpace f owork from the welcome panel too.Query · <path>with~for home, clipped from the left when narrow, and "read-only file" for a file without write permission.Ctrl+Sand:wwrite the file after checking its stamp and hash.:w <path>andSpace f a(the browser; a name typed is a file in the folder shown) save a tab as a file; replacing another file asks "Replace the file?" andEnterkeeps it. A console saved as a file becomes a file tab, and its console goes to the trash as on close. A read-only file and a folder that cannot be written refuse the save, pointing to:w <path>.*shows text that is not in the file yet. That text is kept in the state folder (0600, feat(core): read and write .sql files from anywhere on disk #808's store) on the console autosave clock and removed once saved or closed, so quitting asks nothing and the next start brings the tab back with*; the kept text wins over the file. Closing a tab with*asks:ssave and close,dclose and drop,Enter/Esckeep. A second instance keeps no copies, so it asks on close and on quit.Ctrl+S saveandSpace f a save as a file(only the latter for a read-only file). At 80x24 the note andCtrl+S savefit, and the save as hint follows where there is room. English and Korean.rreload,ooverwrite,Esclater), naming the file. At restore, a file changed since the last stamp comes back with that question pending; a file gone comes back only with kept text (:wwrites it again), else it is left out with a notice.:e!reloads from disk and asks when that drops changes;Space t ubrings a closed file tab back, read again.errors.logor a notice; failure lines name the path only (pinned with a marker).docs/keybindings.mdregenerated (Space f o,Space f a,:e!, the:e/:wtexts).changes/added/files-from-disk.md.Failing first:
On the stack base
e0fc73d2(files-048/3-file-core),cargo test -p datarig-tui --test it -- flows_files: 15 failed, 0 passed. What each saw:For #817, on
d938dc3e(this branch before it),the_status_line_says_a_file_tab_is_not_savedfailed at its first check: the status line of the edited file tab wasNORMAL local-pg │ │ i type · Ctrl+E run · Tab next pane · : commands · Space ? help · Space more EN(no note, no keys that save).The CRLF pin with the saved query first (it opens on the base),
-- statements_of_a_crlf_file:From the review bot's three findings (fixed in
bcf0fbec), on977fdcf7, each test failed first:Tests
crates/tui/tests/it/flows_files.rs, new): the 15 above, andthe_command_line_completes_paths,space_f_o_opens_a_file_and_space_f_a_saves_a_tab_as_one,files_open_from_the_welcome_panel,a_second_instance_asks_before_closing_or_quitting_with_unsaved_files,restore_keeps_a_gone_file_with_its_text_and_asks_about_a_changed_one,e_bang_reloads_from_disk_and_asks_when_it_drops_changes,a_closed_file_tab_comes_back_read_again, and from the reviewa_clean_tab_whose_file_is_gone_keeps_its_text,a_second_instance_asks_before_quitting_with_a_file_in_conflict,a_file_tab_saved_as_a_query_becomes_that_saved_query.file_tab_screens, Unix: the paths are drawn with/), English at 80x24 and 120x40:file_clean,file_unsaved,file_read_only,file_close,file_conflict,file_open_browser,file_save_browser; each also in Korean throughcheck_localized.flows_scripts::a_file_tab_comes_back_with_its_file_and_keeps_the_keys_a_later_version_addsreplaces feat(core): read and write .sql files from anywhere on disk #808'sa_file_tab_this_build_does_not_open_stays_in_the_workspace: this build opens the tab, and the keys a later version adds are still written back.docs/keybindings.md(keybindings_doc, blessed).Binary size
Measured by CI's performance job at
bcf0fbec: the Linux binary is 34,695,152 bytes, 33.088 MiB against the 34 MiB budget (33.013 MiB at #808's head, so this part adds 0.075 MiB). The budget is unchanged.Not in this part
Ctrl+S save · Space f a save asas M3 draws it; the tab's*, its pane title and the close question carry that today (a Follow-up).n(a new, empty database file) in the SQLite browser comes infiles-048/5-new-db-file.