File dialogs - #41
Merged
Merged
Conversation
filePanel reserved two rows under the listing for the filename field in save-as mode, but browse scrolled with the full, unreduced panel height. The two disagreed by exactly two rows, so holding the cursor down in a long listing pushed the selection below what was actually drawn, off the bottom of the panel. Factor the row count into one method and have both call sites use it, so they can no longer drift apart. Closes #5
commitName compared an absolute path built from a.exp.dir (refresh already runs it through filepath.Abs) against a.ed.Path exactly as the user typed it, which stays relative for a document opened as `justwrite nota.md`. The two named the same file but never compared equal, so saving under the file's own name asked to overwrite the file already open. Closes #6
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
v0.1.3 milestone: "The file dialogs. Two one-line fixes, verifiable by hand in ten seconds."
fix: scroll the save-as listing by the rows it actually draws—filePanelreserved two rows under the listing for the filename field in save-as mode, butbrowsescrolled with the full, unreduced panel height, so the cursor could scroll below what was actually drawn. Factored the row count into onelistRows()method both call sites now share.fix: absolutize the open document's path before the overwrite guard—commitNamecompared an absolute path built froma.exp.diragainsta.ed.Pathexactly as typed, which stays relative for a document opened asjustwrite nota.md. Saving under the file's own name asked to overwrite the file already open.Closes #5, #6
Test plan
go build ./...,go vet ./...,gofmt -l .cleango test ./...andgo test -race ./...passTestSaveAsScrollStaysInsideWhatItDraws,TestSaveAsOverTheOpenFileAsksNothing— both verified to fail on the pre-fix code and pass on the fix