-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Copy/cut entire line if nothing is selected (Editor) #22480
base: master
Are you sure you want to change the base?
Conversation
I do not understand why the fast linux tests pass, while the slow one don't. Any idea? |
Hey @The-Ludwig, thanks a lot for your contribution! And sorry for the late reply, we were quite busy fixing several bugs that surfaced after releasing 6.0.0. @dalthviz, could you review this one give @The-Ludwig a hand with our tests? Thanks! |
So, I gave the CI failure a check and seems like the failing test was being forced to pass by setting text in the clipboard directly. The test fails since the changes here cause that calling |
@The-Ludwig, please merge with master to get the fix done by @dalthviz in PR #22618. |
Did so! :) |
Description of Changes
Kooha-2024-09-10-17-26-08.webm
This addition allows to copy and cut a whole line in the editor, with
Ctr+C
andCtr+X
as suggested in #21264.This is similar to the behavior e.g. VSCode has.
Why
select_current_line_and_sep
is needed.The most basic implementation is very straightforward (look after my first two commitss e08c076 and fdfd925). This PR is a bit longer, since we usually want to include the lineseperator from the current line, not the lineseperator from the previous line when copying/cutting whole lines. The exception there is if there is only one line or we are at the last line of the document.
Differences to standard editors like VSCode
This feature is already quite usable and improves my personal workflow greatly. To get exactly the same behavior as VSCode,
CodeEditor.Paste
needs to be modified. VSCode remembers if the clipboard was filled by not having anything selected and then selecting the whole line, and then on pasting inserts the line above the current line and adds the lineseperator at the end correctly.I do not know what best-practise to save a state in this codebase is and the implementation of
CodeEditor.Paste
is a bit above my head right now. I need more experienced spyder developers to look at this in an upcoming PR.Issue(s) Resolved
Fixes #21264
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct:
Ludwig Neste