The attached patch fixes that the cursor jumps sometimes when toggling comments. The cause was slightly confused math. It also works fine with empty lines.
There's another issue with comment toggling which I don't address: If the cursor is at in front of a comment block (e.g. ">....|/*", > is start of the line, . is a space, | is the cursor), toggle will uncomment the comment that comes before this one, i.e. a completely unrelated one. This is because the toggle logic goes back in the doc to find the comment marker. Fixing this appeared non-trivial to me.
Best regards.
Here's the actual patch :)
On Fri, 12 Mar 2010 20:05:01 +0100, Thomas wrote:
The attached patch fixes that the cursor jumps sometimes when toggling comments. The cause was slightly confused math. It also works fine with empty lines.
Finally applied in SVN. Thanks a lot.
There's another issue with comment toggling which I don't address: If the cursor is at in front of a comment block (e.g. ">....|/*", > is start of the line, . is a space, | is the cursor), toggle will uncomment the comment that comes before this one, i.e. a completely unrelated one. This is because the toggle logic goes back in the doc to find the comment marker. Fixing this appeared non-trivial to me.
I guess this might be quite a small issue, hard to happen usually.
Regards, Enrico
Am 26.03.2010 00:02, schrieb Enrico Tröger:
On Fri, 12 Mar 2010 20:05:01 +0100, Thomas wrote:
The attached patch fixes that the cursor jumps sometimes when toggling comments. The cause was slightly confused math. It also works fine with empty lines.
Finally applied in SVN. Thanks a lot.
Thank you too :)
There's another issue with comment toggling which I don't address: If the cursor is at in front of a comment block (e.g. ">....|/*",> is start of the line, . is a space, | is the cursor), toggle will uncomment the comment that comes before this one, i.e. a completely unrelated one. This is because the toggle logic goes back in the doc to find the comment marker. Fixing this appeared non-trivial to me.
I guess this might be quite a small issue, hard to happen usually.
Regards, Enrico
It happened to me alot, I often toggle multiple lines and untoggle them later again without any selection. Often enough I'm not exactly within the comment but simply at the line begin or after indentation so untoggle fails. I guess once you know about the problem you get used to it, but if you don't you might not know why the code you edit isn't working anymore.
Best regards.