-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve and unify CopyLine
, CutLine
, DeleteLine
, DuplicateLine
actions
#3335
base: master
Are you sure you want to change the base?
Commits on Jun 9, 2024
-
Fix Cursor{Up,Down} after DeleteLine and CutLine
After executing CutLine or DeleteLine action, the cursor is at the beginning of a line (as expected) but then moving the cursor up or down moves it to an unexpected location in the middle of the next or previous line. Fix this by updating the cursor's LastVisualX.
Configuration menu - View commit details
-
Copy full SHA for 19c69f9 - Browse repository at this point
Copy the full SHA 19c69f9View commit details -
Fix Cursor{Up,Down} after CopyLine
After executing the CopyLine action, moving cursor up or down unexpectedly moves cursor to the beginning of the line, since its LastVisualX value is lost in the selection/deselection manipulations. Fix this by restoring the original LastVisualX.
Configuration menu - View commit details
-
Copy full SHA for df8d528 - Browse repository at this point
Copy the full SHA df8d528View commit details -
Fix CopyLine at the last empty line of buffer
When the cursor is at the last line of buffer and it is an empty line, CopyLine does not copy this line, which is correct, but it shows a bogus "Copied line" message. Fix this by adding a check for that, same as in CutLine and DeleteLine.
Configuration menu - View commit details
-
Copy full SHA for 8bc6756 - Browse repository at this point
Copy the full SHA 8bc6756View commit details -
Make lastCutTime actually work
The CutLine action has a feature: if we execute it multiple times to cut multiple lines, new cut lines are added to the previously cut lines in the clipboard instead of replacing the clipboard, unless those previously cut lines have been already pasted or the last cut was more than 10 seconds ago. This last bit doesn't really work: newly cut lines are appended to the clipboard regardless of when was the last cut. So fix it.
Configuration menu - View commit details
-
Copy full SHA for 52ed431 - Browse repository at this point
Copy the full SHA 52ed431View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2860efb - Browse repository at this point
Copy the full SHA 2860efbView commit details -
Reorganize Copy and CopyLine actions
Make Copy return false if there is no selection, and change the default binding for Ctrl-c from CopyLine|Copy to Copy|CopyLine accordingly, to make the semantics more meaningful: copying selection always fails if there is no selection.
Configuration menu - View commit details
-
Copy full SHA for 830768b - Browse repository at this point
Copy the full SHA 830768bView commit details -
Reorganize Cut and CutLine actions
Change behavior of the Cut action: don't implicitly call CutLine if there is no selection. Instead, make it return false in this case and change the default Ctrl-x binding to Cut|CutLine, to make it clear, explicit and in line with Copy and CopyLine actions.
Configuration menu - View commit details
-
Copy full SHA for a317aef - Browse repository at this point
Copy the full SHA a317aefView commit details -
Configuration menu - View commit details
-
Copy full SHA for c1bbd7b - Browse repository at this point
Copy the full SHA c1bbd7bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f7bdb1 - Browse repository at this point
Copy the full SHA 9f7bdb1View commit details -
CopyLine, CutLine, DeleteLine: respect selection
When there is a selection containing multiple lines, CutLine, DeleteLine and CopyLine actions currently cut/delete/copy just the "current" line, as usual. This behavior is at least confusing, since when there is a selection, the cursor is not displayed, so the user doesn't know which line is the current one. So change the behavior. When there is a multi-line selection, cut/delete/copy all lines covered by the selection, not just the current line. Note that it will cut/delete/copy whole lines, not just the selection itself, i.e. if the first and/or the last line of the selection is only partially within the selection, we will cut/delete/copy the entire first and last lines nonetheless.
Configuration menu - View commit details
-
Copy full SHA for fdacb28 - Browse repository at this point
Copy the full SHA fdacb28View commit details -
CutLine: make infobar message more useful
Since CutLine may add lines to the clipboard instead of replacing the clipboard, improve its info message to show how many lines are in the clipboard in total, not just how many lines were added to it last time.
Configuration menu - View commit details
-
Copy full SHA for e6825f0 - Browse repository at this point
Copy the full SHA e6825f0View commit details -
Make Cut, Copy, CopyLine don't mess with CutLine's multi line cuts
Weird behavior is observed e.g. if we cut some lines with CutLine, then copy some selection with Copy, then cut some other lines with CutLine, and then paste. The pasted cliboard contains not just the lines that were cut at the last step, but also the selection that was copied before that. Fix that by resetting the CutLine's repeated line cuts whenever we copy anything to the clipboard via any other action (Cut, Copy or CopyLine).
Configuration menu - View commit details
-
Copy full SHA for 04143c7 - Browse repository at this point
Copy the full SHA 04143c7View commit details -
CutLine: return if cliboard read failed
If we ever encounter this clipboard.Read() failure, return false immediately. Otherwise, InfoBar.Error(err) will have no effect (it will be immediately overwritten by InfoBar.Message()) so we won't even know that there was an error.
Configuration menu - View commit details
-
Copy full SHA for 33a1bb1 - Browse repository at this point
Copy the full SHA 33a1bb1View commit details -
DuplicateLine: move selection duplication to separate Duplicate action
- Add a new Duplicate action which just duplicates the selection (and returns false if there is no selection). - Change the behavior of the DuplicateLine action to only duplicate the current line, not the selection. - Change the default action bound to Ctrl-d from DuplicateLine to Duplicate|DuplicateLine, so that the default behavior doesn't change. This allows the user to rebind keybindings in a more flexible way, i.e. to choose whether a key should duplicate just lines, or just selections, or both, - in a similar fashion to Copy, Cut, Delete actions.
Configuration menu - View commit details
-
Copy full SHA for 25f71ee - Browse repository at this point
Copy the full SHA 25f71eeView commit details -
DuplicateLine: respect selections
Similarly to CutLine, DeleteLine and CopyLine actions, if there is a selection, duplicate not just the current line but all the lines covered (fully or partially) by the selection.
Configuration menu - View commit details
-
Copy full SHA for 6f724bc - Browse repository at this point
Copy the full SHA 6f724bcView commit details
Commits on Jun 12, 2024
-
CutLine: remove lastCutTime feature
The lastCutTime feature (reset the clipboard instead of appending to the clipboard if the last CutLine was more than 10 seconds ago) was implemented 8 years ago but was always buggy and never really worked, until we have accidentally found and fixed the bug just now. No one ever complained or noticed that, which means it is not a very useful feature. Fixing it changes the existing behavior (essentially adds a new feature which did not really exist before) and there is no reason to assume that this new behavior will be welcome by users. So it's better to remove this feature.
Configuration menu - View commit details
-
Copy full SHA for 68d6f43 - Browse repository at this point
Copy the full SHA 68d6f43View commit details
Commits on Jun 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bf65847 - Browse repository at this point
Copy the full SHA bf65847View commit details