Skip to content

fix(fast_wrap): Handle pattern matches at end of line - #552

Open
nlipiarski wants to merge 1 commit into
windwp:masterfrom
nlipiarski:fix_fastwrap_lineends
Open

nlipiarski wants to merge 1 commit into
windwp:masterfrom
nlipiarski:fix_fastwrap_lineends

Conversation

@nlipiarski

@nlipiarski nlipiarski commented Sep 11, 2026 •

Copy link
Copy Markdown

Summary

Fixes #408

When using fastwrap with manual_position enabled, if the last character of a line matched the patterned you are not given the option to select where to insert the closing character. Too see why this is an issue, consider the following example:

local value = func(array[|index)

with | representing the cursor. Activating fastwrap in this scenario will automatically place the closing ] after the ) and the user cannot supply a different location. As has been discussed, this is a regression caused by #475. To resolve the problem, I updated the position logic to always include an end character option that represents "end of the line" and to have a normal marker for matches that are the last character in the line. This is similar to what was proposed in #408.

Test plan

I performed some pretty extensive manual testing with manual_position on and off and similarly with avoid_move_to_end on and off. If there are any specific cases we'd like tested please let me know.

@nlipiarski
nlipiarski force-pushed the fix_fastwrap_lineends branch 3 times, most recently from 0fa3c5f to ac0185d Compare September 11, 2026 20:28
@nlipiarski
nlipiarski force-pushed the fix_fastwrap_lineends branch from ac0185d to c6e9988 Compare September 11, 2026 20:42
@nlipiarski
nlipiarski marked this pull request as ready for review September 11, 2026 20:44
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.

$ in fast wrap to always insert end pair at the end? (and a more flexible hint system idea)

1 participant