-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fixes #1327 #1331
fixes #1327 #1331
Conversation
src/matching/matcher.ts
Outdated
@@ -17,11 +17,6 @@ export class PairMatcher { | |||
// useful for text objects. | |||
"<" : { match: ">", nextMatchIsForward: true }, | |||
">" : { match: "<", nextMatchIsForward: false }, | |||
// These are useful for deleting closing and opening quotes, but don't seem to negatively | |||
// affect how text objects such as `ci"` work, which was my worry. | |||
'"' : { match: '"', nextMatchIsForward: false }, |
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.
Can you leave these inside PairMatcher? Because we use PairMatcher's pairings in other places, like surround.
Can you just give them an attribute like directionless: true
? which you check for down below instead?
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.
sure, but you shouldn't be using quotes in the pairmatcher for surround...there is no open or close, so how is doing a surround with " different than a surround with any other normal character?
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.
Actually you're right, I just duplicated that code in surround.vim. Yeahhhhhh.
I still would like it to be here for completeness though. :)
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.
agreed :)
Perfect, thanks! |
@rufusroflpunch this isn't the cleanest way to fix the problem but I think it is fine, what do you think?
The problem is we use nextPairedCharacter in the matcher in a few other places, and if it is not in the pairings, then it returns instantly. However, when we added quotes, this meant nextPairedCharacter would now iterate the document looking for a forward or backward matching char, this could probably be made to work correctly since in these cases quotes are typically pairs, but this solution seemed easier to me for now...