improve ^F and ^B by handling 'window' and 'wrap' options #13
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.
Take 'window' option into account when determining how many lines to scroll for ^F and ^B, using the logic described in
:help 'window'
Also fix a small bug where ^F and ^B would not scroll the correct number of lines if the 'wrap' option was set and there were wrapped lines visible on the screen
This leaves one small issue unaddressed: in default vim, if you give ^F or ^B a count, and there are wrapped lines in the file, vim will effectively do ^F or ^B multiple times, scrolling a number of lines equal to the number of lines visible after each iteration - 1. This is significant because with 'wrap' set, the number of lines visible at each point in the file might be different, so in default vim, 3^F might not scroll exactly (3 * (line('w$') - line('w0') - 1)) lines like smoothie#backwards() and smoothie#forwards would.