Merged
Conversation
Fixes issue with the usage of a slightly incorrect buffer height value (v.Height should be v.Height-1 if statusline is displayed). Also, to avoid too many duplications, the code reorganized a little: buffer display params (width, height, gutter offset and others) are calculated in a single place.
Fix displaying tabs and wide runes which don't fit in the window. Don't overwrite the vertical divider and the adjacent window. - For tabs: display only as many of the tab's spaces as fit in the window. - For wide runes: if a rune doesn't fit, don't display it in this line at all. If softwrap is on, display this rune in the next line. Fixes micro-editor#1979
VLoc allows any location in the buffer to be represented as a visual location in the linewrapped buffer. In particular, this is useful for implementing moving cursor up and down within a wrapped line.
Modified behavior of CursorUp, CursorDown, CursorPageUp etc: if softwrap is enabled, cursor moves by visual lines, not logical lines. TODO: implement it also for Home and End keys: move cursor to the visual start or end of a line. I haven't implemented it for now, because I'm not sure what should be the behavior of StartOfTextToggle then (considering that Home key is bound to StartOfTextToggle by default). Fixes micro-editor#1598
Now that we have LocFromVLoc, we can radically simplify the code of LocFromVisual. Less duplication, less potential bugs.
Don't highlight space characters at the right edge which are used just for padding after line break in word wrapping, i.e. don't correspond to any real characters in the buffer. This makes it look nicer e.g. when selecting word-wrapped text.
BufView returns not only the buffer's width and height but also its x,y position. It may be useful e.g. for checking if a mouse click was on the actual buffer or ourside it, e.g. on the gutter.
Let's return absolute X, Y values, rather than relative to the bufwindow.
Thank you so much! This will be awesome! |
Member
|
This is great! Thank you for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A number of improvements for softwrap and more:
wordwrapoption, disabled by defaultVLocabstraction for representing an arbitrary location in the buffer as a visual location in the linewrapped bufferThese changes depend on each other, so I've put them in a single PR.
Fixes #1598
Fixes #264
Fixes #1644
Fixes #645
Fixes #1979