Skip to content
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

Improvements to paragraph text objects. #1996

Merged
merged 4 commits into from Sep 3, 2017

Conversation

brandonbloom
Copy link
Contributor

See individual commit messages and associated issues for details.

@Chillee
Copy link
Member

Chillee commented Sep 2, 2017

It's not clear to me that the test is actually a failure and not just a result of you fixing the bug. Feel free to replace that test with a newTest.

@brandonbloom
Copy link
Contributor Author

Nope, I definitely broke sentences, which treat whitespace-only lines differently. Will fix it and add some tests.

@brandonbloom
Copy link
Contributor Author

For my own reference as I fix this, this is in the vim help:

							*paragraph*
A paragraph begins after each empty line, and also at each of a set of
paragraph macros, specified by the pairs of characters in the 'paragraphs'
option.  The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to
the macros ".IP", ".LP", etc.  (These are nroff macros, so the dot must be in
the first column).  A section boundary is also a paragraph boundary.
Note that a blank line (only containing white space) is NOT a paragraph
boundary.
Also note that this does not include a '{' or '}' in the first column.  When
the '{' flag is in 'cpoptions' then '{' in the first column is used as a
paragraph boundary |posix|.

And:

ap			"a paragraph", select [count] paragraphs (see
			|paragraph|).
			Exception: a blank line (only containing white space)
			is also a paragraph boundary.
			When used in Visual mode it is made linewise.

							*v_ip* *ip*
ip			"inner paragraph", select [count] paragraphs (see
			|paragraph|).
			Exception: a blank line (only containing white space)
			is also a paragraph boundary.
			When used in Visual mode it is made linewise.

Normal sentence and paragraph motions differ in behavior from
text-objects. The (){} commands treat whitespace as part of paragraphs,
but ap and ip should treat whitespace lines as if they were completely
empty.
Also handle ip for "blank paragraphs" correctly.

Fixes VSCodeVim#1994
@brandonbloom
Copy link
Contributor Author

OK, I've fixed sentence handling and made even more fixes to "inner" paragraph handling. This time, I used "find all references" to ensure I didn't affect any other code paths.

@Chillee
Copy link
Member

Chillee commented Sep 3, 2017

Looks good to me!

@Chillee Chillee merged commit 4bbf62c into VSCodeVim:master Sep 3, 2017
@brandonbloom brandonbloom deleted the para-lines branch September 8, 2017 18:35
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.

None yet

2 participants