-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add wrapindent option to allow wrapping and hanging indents #3107
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
base: master
Are you sure you want to change the base?
Conversation
|
@metastork |
|
Hi @Neko-Box-Coder, thanks for taking a look. Have updated the branch from the upstream master, hope this works ok. Having used this feature for the past few months, everything seems to work fine, except for a minor niggle - if using It hasn't really bothered me but I'd be happy to solve this, either in this branch or in a future pull request, if you think it's worth doing. |
75ce71e to
93d199c
Compare
|
@metastork Thanks, I have quickly looked at the changes and it seems good. It would be great if you could sort out the cursor traversal when I can do a detailed review and test when you fix the issue. If you can't, I can give it a go as well. |
Signed-off-by: metastork <[email protected]>
Probably to do with |
…hen wrapindent is set
|
@Neko-Box-Coder Thank you for the suggestions, that was helpful! (and trickier than expected :) Have made another commit that should fix the diagonal cursor jumping when
|
Neko-Box-Coder
left a comment
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.
Currently, there are 2 behaviors that are wrong from my testing
-
Going up between paragraphs does not retain the cursor Visual X position as pointed out in the code
-
If
wrapindentis>0, if you go down from the beginning in the first row to the second row, the cursor will just goes to the end of the first row instead of going to the beginning of the second row.
For example, let's say we have wrapindent of 4 and the capital letter C is our cursor, and small letters x are the text
Cxxxxxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
If my cursor goes down, I would expect it to be
xxxxxxxxxxxxxxxx
Cxxxxxxxxxxx
xxxxxxxxxxxx
But instead, it is
xxxxxxxxxxxxxCxx
xxxxxxxxxxxx
xxxxxxxxxxxx
Maybe there needs to be a check or change in logic for the AdjustXCursorOnWrapindent.
|
Thank you, you're right, good suggestions, will take a look and submit some fixes for those and some other edge cases. |
Thanks for your help and detailed testing, there was indeed a bug in the implementation that had some knock-on effects such as these (getLocFromVLoc also needed to check for leading white space, not just getVLocFromLoc. In the latest commit this should now be working properly in all scenarios. Please do have a look some time and let me know any suggestions. |
|
Nice, the cursor up and down is now working between paragraphs (1.) This is my test case: Other than that, it seems working to me. |
Neko-Box-Coder
left a comment
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.
|
This is what I'm getting with i.e. if the first word in a visual line doesn't fit in the window, this word is not wrapped, and even overwrites the adjacent pane. Also, with |


Possible implementation of feature request described in #2935 to allow configurable wrapping indents / hanging indents. Hope it corresponds with the project's coding styles and contribution guidelines.
Pull request adds the option
wrapindent, which is -1 by default, where there is no change from the current default behaviour of no wrapping indents. Oncewrapindentis set to 0 or greater, the new wrapped line respectively inherits or adds to the indent level of the parent line.This seems to work fine for wordwrap: true / false, and softwrap: true. However, with wordwrap: false, it might occasionally add an additional empty space, if the line wrap is on a whitespace character, which might only be a minor quibble.