Jedit 4.3pre16: automatic identation in C++ mode witchin switch/case blocks
Submitted by Monday, 23 February, 2009 - 16:02
on
Hello.
I'm using jedit 4.3pre16 on slackware 12.2 linux, and I had following problem:
When I was typing something something like
--
switch(index){
case(Choices::done):
--
jedit kept moving (case(Choices::done) line to the left (i.e. was unindenting the line) every time I typed colon (*any* colon - even the one in the middle of Choices::done).
I was able to partially fix it by copying cplusplus.xml to ~/.jedit/modes, adding it to ~/.jedit/modes/catalog and replacing
---
?!).*$" />
---
with
---
?!).*$" />
---
But I got another problem.
Now when I type something like:
---
switch(index){
case(Choices::done):
break;
case(Choices::cancel):{
---
jedit keeps moving "case(Choices::cancel):{" to the right (i.e. indenting) when I type "{".
This obviously happens because jedit "thinks" that break is not within indentation block and defines proper indentation level.
How can I fix that? I've tried replacing
---
---
with regexp that would exclude "case" (something like "(?!\bcase\b.*\(.*\):){"), but this didn't work (it looks like indentOpenBrackets doesn't take regexp as argument).
Any ideas?