joeyuping / quick_latex_obsidian

MIT License
327 stars 21 forks source link

Typing "=" when cursor is before ")" causes it not to be typed and the cursor instead moves to after the ")". #70

Open wobbba opened 1 year ago

wobbba commented 1 year ago

Does not occur when the plugin is disabled so I'm pretty sure it must be the plugin's fault. This might be an intended feature, idk, but how do I turn it off?

joeyuping commented 1 year ago

hi ! @wobbba

sorry, I was not able to replicate the issue on my machine. As this plug-in does not have any trigger related to the = sign, I could not see how this could have happened...

If the problem still persist, you might like to check out the other community plugin called "Latex Suite" by artisticat1 which has many similar functionality as this one, as well as many other really neat features~

wobbba commented 1 year ago

That is very odd since it also happens with all other plugins disabled (even all core plugins). I can't think of anything else that could be the cause. I'm using plugin version 2.4.0 (still happening with 2.5.0) with Obsidian version 1.0.0 on Windows 10. There is also nothing suspicious in my custom shorthand.

Actually, I have now narrowed it down to the "Autoclose round brackets" feature. Disabling that fixes the problem. Having only that enabled, makes the problem appear. It's like it has the two characters mixed up since when I type a ) when the cursor is already in front of a ) then I'd expect the behaviour it shows with the = but instead it adds another ).

Maybe a typo in the source code?

EDIT: wait a second, now it's doing the closing bracket thing correctly. I'm confused. I changed literally nothing. Also if I highlight the ) and try to replace it with a = then it ignores that as well and just keeps the ). Very mysterious. Also this is a fresh install of the plugin.

EDIT2: If I highlight the ( and try to replace it with = it just jumps to after the (). Maybe it's an interaction with Obsidian's highlight-enclose feature? Like as it does with "" and **, it also does with == for some reason.

EDIT3: What? Now it's not doing the thing with highlighting the ( and jumping behind any more. Am I losing my mind? It now does the auto-enclose. Original problem persists though.

joeyuping commented 1 year ago

Hi! @wobbba

Thank you so much for sharing all the details! Although.... sorry I still could not replicate this issue... However, I updated the plugin to v2.5.1 with some changes to the "Autoclose round brackets" and other related functions. Please kindly see if that might happen to resolve your issue?

wobbba commented 1 year ago

Thanks but the issue persists. I found another thing: If the Autoclose curly brackets option is enabled, if I try to input a ? between two $$, it instead comes out as ${}$. I don't really know what we could try, maybe it is a problem with keyboard layout? I'm using German layout.

Yeah, I tested English layout and that is probably the problem. When I try to input an = I press Shift+0 which is closing round bracket in US layout. Does that ring a bell for you? Otherwise I'm gonna assume that this is an Obsidian-Problem that arises in the interaction with your code for some reason and create an issue there.

Anyway thank you for being so responsive and for creating this plugin!! :)

theFox6 commented 1 year ago

I have the same problem and I am using a German layout as well. It did work a few versions back though. Strangely enough the ) (shift+9) jumps behind the ) as well, not only = (shift+0).

This could be an issue with obsidian keymapping though.

b0ps commented 1 year ago

Im using german Keyboard Layout, And when I tested it right now, neither the '$(=)$'-problem, nor the '$?$'-problem occured, has this maybe been fixed in newer versions? :)

While testing this a little bit I found another weird behaviour: highlighting ')' and then inserting a '=' , now returns '=)=' ...? Still an improvement over the bugs described by @wobbba though.