Skip to content
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

tsd on right parenthesis does not toggle auto-size variant #772

Closed
kiryph opened this issue Apr 10, 2017 · 7 comments
Closed

tsd on right parenthesis does not toggle auto-size variant #772

kiryph opened this issue Apr 10, 2017 · 7 comments

Comments

@kiryph
Copy link
Contributor

kiryph commented Apr 10, 2017

test tex file:

\documentclass{article}

\begin{document}
$(hello)$
$[hello]$
$\{hello\}$
\end{document}

Cursor on ), ] or \} and pressing tsd does not change to $\left(hello\right)$.

It works in following cases as long as the cursor is not on the last character (the e of \rangle, the t of \rvert and the final r of \rfloor).

$\langle hello\rangle$
$\lvert hello\rvert$
$\lfloor hello\rfloor$
@clason
Copy link
Contributor

clason commented Apr 10, 2017

To be precise, it does toggle auto-size, but on the surrounding delimiters (if they exist):

((hello))

toggles to

\left((hello)\right)

So unlike the opening delimiter, the closing delimiter is not counted as part of the expression. Maybe some save_pos vs. save_pos + 1 somewhere?

@lervag
Copy link
Owner

lervag commented Apr 10, 2017

Ah, so. I knew this would come up. I've "exploited" this behaviour in order to make the text objects easy to "increase" when repeated (in visual mode). But I guess that's cheating...

@lervag
Copy link
Owner

lervag commented Apr 10, 2017

To be more specific: If you do vadadad for ((( a ))), it will first select the inner pair, then the middle, then the outer. To do this, I exploit that the last character of the ending delimiter is not considered part of the text object. I thought I would get away with it, but alas, no.

So, I'll have to think of a different strategy...

@lervag
Copy link
Owner

lervag commented Apr 10, 2017

Ok, I'm pushing a fix now. I think it solves this issue while retaining the correct behaviour for vadad, etc.

@lervag lervag closed this as completed in 8843015 Apr 10, 2017
@kiryph
Copy link
Contributor Author

kiryph commented Apr 10, 2017

Are you sure that vadad still works?

Try this ( this (hello) ha ) for vadad and tsd on all braces.

@lervag
Copy link
Owner

lervag commented Apr 11, 2017

Haha, that's turned out to be a completely different bug. If you test before you update: Note that this only occurs if you test on line 1 of the input file. If you add some lines in front, things work as expected.

But I fixed it now. I hope... :)

@kiryph
Copy link
Contributor Author

kiryph commented Apr 11, 2017

Yes, it works now. Great to see this fixed.

As always: thank you very much for your fast fix and support of vimtex.

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

No branches or pull requests

3 participants