-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Improve and unify CopyLine, CutLine, DeleteLine, DuplicateLine actions
#3335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+152
−67
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
19c69f9
Fix Cursor{Up,Down} after DeleteLine and CutLine
dmaluka df8d528
Fix Cursor{Up,Down} after CopyLine
dmaluka 8bc6756
Fix CopyLine at the last empty line of buffer
dmaluka 52ed431
Make lastCutTime actually work
dmaluka 2860efb
CutLine: remove unneeded if check
dmaluka 830768b
Reorganize Copy and CopyLine actions
dmaluka a317aef
Reorganize Cut and CutLine actions
dmaluka c1bbd7b
CutLine: cosmetic refactoring
dmaluka 9f7bdb1
Cosmetic change: move Cut above CutLine
dmaluka fdacb28
CopyLine, CutLine, DeleteLine: respect selection
dmaluka e6825f0
CutLine: make infobar message more useful
dmaluka 04143c7
Make Cut, Copy, CopyLine don't mess with CutLine's multi line cuts
dmaluka 33a1bb1
CutLine: return if cliboard read failed
dmaluka 25f71ee
DuplicateLine: move selection duplication to separate Duplicate action
dmaluka 6f724bc
DuplicateLine: respect selections
dmaluka 68d6f43
CutLine: remove lastCutTime feature
dmaluka bf65847
help/keybindings: document CutLine behavior
dmaluka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a. Mention this somewhere in the documentation
b. Maybe have an option to toggle this on or off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding spaces, it is the gofmt style.
Neither did I. And I agree with you.
If we are talking about the append-to-clipboard feature as such, I agree we should document and/or make it optional, and I'm inclined to think that we should do both. But it seems better (more flexible) not to add an option but to add a separate action. Rename the current
CutLineimplementation toCutLineAppendorCutLineSmart(both names suck, but I can't think of anything better at the moment), add a newCutLineimplementation providing the "classical" line cut functionality without this fancy behavior, and update the default Ctrl-x and Ctrl-k bindings accordingly, to not change their default behavior.And if we are talking specifically about this
lastCutTimesub-feature (resetting the append-to-clipboard after 10 minutes), AFAICS it was buggy and never worked from the beginning. (Someone though it was a good idea to implement it, but didn't bother to test it, lol.) And I'm not sure it's a useful feature. So, since it has never really worked anyway, I'm inclined to think we should just remove it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR that originally added it: #64 + #70.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird how some places in the same file we have spaces but not this one. I don't code much in golang and it is a very minor thing so I don't mind, just pointing it out.
Yeah, this seems good to me.
CutLineAppendis fine I think.Yeah, it was never working so we can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently there is some logic in that. Like, use spaces in standalone statements but don't use them in function arguments (but only if there is more than one function argument), etc.
I'd prefer to always use spaces, but our rule is: just follow whatever style is expected by
gofmt, instead of wasting time on discussions which style is better.Or
ClipLine, maybe?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
ClipLinedoesn't explictly describe what it is doing. If we have the same thing for copy line (where it appends to the clipboard), the wordClipLineis confusing.I still think
CutLineAppend(Or some variation of it if you don't like it) describes what it is doing best, and we can even have the same naming style forCopyLine(that appends to clipboard) as well if we want toThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I suggested
ClipLinebecause it sounded cool and succinct to me, but frankly I'm not really familiar with the meaning of the word "clip" (I'm not a native speaker). Doesn't it actually have two different meanings: one like "append" but the other one like "cut"?Anyway... now I'm thinking: maybe let's not complicate things and leave the current
CutLinebehavior as is (just document it somewhere; and remove the 10 seconds part). If the user wants the simple behavior instead, the user can just useCopyLine,DeleteLine, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means "cut" to me. I can see how it can mean "append" but wouldn't click for me unless I used it.
Yeah, that's fine with me as well (to be honest I don't use cutline that much 😅)
Ideally, the ability to switch off this behavior would be great but I think this behavior works fine for most scenarios. (We can add it if people really want to switch it off)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure it was. It was just my expectation which didn't fit. My fault...
Yep, I'm fine with that too, since I didn't used it so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the
lastCutTimefeature and added documentation for theCutLinebehavior.