Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@lieryan
Copy link
Contributor

@lieryan lieryan commented Jun 29, 2019

The text objects command like daC and diM previously worked using character-wise selection. This is rarely what the user want, as it means that pasting with (p) does not work if your cursor is not on column 0 and paste with reindent (]p) does not work at all.

This PR changes these text objects to be line-wise, which aligns it with other similar builtin motion commands like dap/dip (delete a/inner paragraph).

All tests seems to pass, though I'm not quite sure how to add a new test for this.

@lieryan lieryan force-pushed the lieryan-pymode-selection branch from b760bef to a59310e Compare October 17, 2019 16:47
@diraol
Copy link
Contributor

diraol commented Apr 21, 2020

Hi @lieryan !

Sorry for this massive late feedback. I've had tough personal issues last year that made me stay away from this project (even from my work). I still don't have too much time to dedicate to the project, but I'll try to get back to it.

Can you please provide a minimal working example for me to test the behavior before and after your change?

Like, a simple .py file and the sequence of commands to perform to see how your PR is changing what is going on?

Thank you very much for your contribution! Oh, and please, also add yourself to the Authors file!

@lieryan
Copy link
Contributor Author

lieryan commented Apr 25, 2020

Hi, thanks for coming back. I've added actual test for the textobject.vim to test the behaviour of what this PR implements.

So a test example would be:

def func1():
    a = 1
def func2():
    b = 2

If you used the daM on func2() and the you moved your cursor to, say the ( character in func1() and then you pasted with P, previously because the text objects are character text object, the buffer content would look like:

def func1def func2():
    b = 2():
    a = 1

After the change, the buffer content will now look like (note the position of func1() and func2() are swapped from original file):

def func2():
    b = 2
def func1():
    a = 1

This works similar to other line-wise text objects like dap (delete a paragraph).

@lieryan lieryan force-pushed the lieryan-pymode-selection branch 2 times, most recently from b194e79 to 242c2de Compare April 25, 2020 23:38
lieryan added 4 commits April 26, 2020 09:43
For some reason, vim will still add packages even when -u is specified.
This flag tells vim to avoid loading those packages. This should improve
test isolation.
@lieryan lieryan force-pushed the lieryan-pymode-selection branch from 242c2de to ff89053 Compare April 25, 2020 23:43
@diraol diraol merged commit 295e84d into python-mode:develop Sep 4, 2020
@diraol
Copy link
Contributor

diraol commented Sep 4, 2020

Thank you very much for your contribution! :) (better late than never!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.