Vimtex: tsd on right parenthesis does not toggle auto-size variant

Created on 10 Apr 2017  路  7Comments  路  Source: lervag/vimtex

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$

Most helpful comment

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

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

All 7 comments

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?

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...

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...

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

Are you sure that vadad still works?

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

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... :)

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

David-Fu picture David-Fu  路  5Comments

LuxGiammi picture LuxGiammi  路  3Comments

krissen picture krissen  路  5Comments

adimanea picture adimanea  路  5Comments

vsbuffalo picture vsbuffalo  路  3Comments