Repository navigation
Keep the editor's unsaved and on-disk questions readable for long paths - #545
Draft
raiseCatError wants to merge 1 commit into
Draft
raiseCatError wants to merge 1 commit into
raiseCatError wants to merge 1 commit into
Conversation
The editor dialog cut its whole message from the right, so a file whose shown path was longer than the panel lost 'has unsaved changes.' or 'changed on disk'. When the message starts with the file's path, the path now gives way from the left and keeps its file name. This also explains why the existing Esc dialog test failed locally when NMSH_TEST_TMPDIR gave a longer temp root than CI's.
This branch has not been deployed
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.
What changed
The editor's dialog cut its whole message from the right to fit the panel. When the file's shown path was long, the user lost the question itself. In an 80-column panel, a path of about 57 characters or more turned "has unsaved changes." into "has unsaved chang…" or hid it completely. The same happened to "changed on disk since you opened it."
When a dialog message starts with the file's path and doesn't fit,
fitFileMessageinsrc/viewer/EditorPanel.tsnow shortens the path from the left. The file name and the rest of the sentence stay whole, for example…/nmsh-edit-Tu2zes/b.txt has unsaved changes.Messages that fit, messages that don't start with the path, and very narrow panels behave as before.Why
This came out of investigating four tests that fail locally on pristine
dev(c690de0) but pass in hosted CI.panel: Esc with unsaved changes asks; …failed on this Mac only becauseNMSH_TEST_TMPDIRgave a 34-character temp root instead of CI's short one. That pushed the test file's path past the limit. The test was right; the rendering was wrong for any long path. The other three failures are environmental (noLANGlocale, and a temp root over the runner's 32-character limit), so this PR doesn't change them.Tests
panel: a long file path gives way from the left, so the unsaved and on-disk questions stay readable. It uses a deliberately long folder name, so it doesn't depend on the temp path. It fails without the fix and passes with it.tests/textEditor.test.tspasses in full (14/14) with both a 31-character and a long temp root. Before the fix the existing Esc test failed 3/3 with the long root.tsc --noEmitandgit diff --checkare clean.npm run verify(withLANG=en_US.UTF-8and a short root): 4500 passed, 71 failed. All 71 are live-frontend timeouts that ran while load averages reached 65, with other sessions running suites on the same 8 GB Mac. 58 of the frontends they report on had printed 0 bytes after 20 s while still alive, so they never got through startup. Two of the failing files,ctrlZJobControland thesessionPresetsstartup test, pass on their own. None of them touch the editor panel. Hosted CI is the independent gate here.Needs human testing
This was checked against rendered rows, not in a terminal. To try it in a real terminal (Ghostty or Terminal.app at about 80 columns): run
/editon a file with a long path, type a character, then press Esc. The question should read…<end of path>/file has unsaved changes.with Save / Discard changes / Keep editing below it.