New indentation code in KDevelop 2

Eray Ozkural (exa) erayo at cs.bilkent.edu.tr
Sat Dec 8 16:24:02 UTC 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 08 December 2001 12:29, August Hörandl wrote:
> "Eray Ozkural (exa)" wrote:
> > This was one of the things that held me back from using kdevelop instead
> > of emacs. Hope the emacs fans like the new autoindent code.
>
> the only better thing would be a k(x)emacs editor part ;-)
>

Yes, I realized that when I was midway. With the new interfaces it shouldn't 
be that difficult to embed emacs and then communicate using gnuclient (though 
I have no idea how gnuclient is used)

> - shouldn't there be something like AI in the status line ?
>

Could you elaborate? Ah, okay, it should be easier to switch AutoIndent mode 
on/off and it should be displayed on the status line. Hmm, perhaps for other 
editor modes, too.

> - i get results like:
>       ...
>       for(int j = 0; j < col; j++) {
>          int xx = x + j*dw;
>          p.drawPoint(xx+f(xx,y), y);
>          }
>          }
>          p.end();
>
>   it seems you missed something like the belaow at line 1135 in
> kwdoc.cpp,
>   and around line 1091 which seems to duplicate the code ?

The code is duplicate, because the part that's really duplicate is small, so 
it didn't make much difference.

>    if (textLine->getChar(textLine->lastChar())=='}') // closing brace
>      indentPos -= indentLength;
>

I did only the open brace, but yes, closed brace might be done too. I've got 
to think how that could be done.

That should be firstChar() rather than lastChar() it seems.

Emacs seems to match all braces, parentheses first btw. I don't. So, I have 
to do some dirt.

>   btw: why is that lastchar() ? what about

I was being cheap. Really, can't implement an incremental parser in kdevelop.

>   { int x;
>     code;
>

Arrgh. Tried that, even xemacs does nothing about it. You'll have to hit 
enter from time to time :)

> - sometimes TAB just does nothing
>    this seems to be to be related to the above lastchar(),
>    there are easily invisible ' ' after the }
>

If indentation is correct, then emacs does nothing, I wanted to do it 
similar. The indent code is way too lacking of course.

> - indent-region is missing
>

Noted. It's just the same thing as user pressing TAB, Down, TAB, Down, ....

> - undo doesnt work after indent
>

Noted. That's a bug. I didn't record things properly.

> but i like that direction - keep that good work

Thanks for testing and your nice comments!

Keep hacking,

- -- 
Eray Ozkural (exa) <erayo at cs.bilkent.edu.tr>
Comp. Sci. Dept., Bilkent University, Ankara
www: http://www.cs.bilkent.edu.tr/~erayo
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8Ei9mfAeuFodNU5wRAgZzAJwN/NZle2jl0AFZ2Pk/4GO7l9KAIQCgkVMT
isZ8Sa9Lg5okEU5S8wLGxSw=
=kYyW
-----END PGP SIGNATURE-----




More information about the KDevelop-devel mailing list