Pistos / diakonos

Diakonos is a console text editor for the masses.
https://git.sr.ht/~pistos/diakonos
Other
137 stars 11 forks source link

C++ Indentation #53

Closed ali-bahjati closed 10 years ago

ali-bahjati commented 10 years ago

I really love diakonos! :D

But there is a problem annoying me , and that's C++ indentation in it, it's so bad

when I use "{" right after my if,for,function def, .... there's no indentation

and if I have a single "if" statement without "{}" next line should be indented (It could be a bit complicated by the way ) , see image below (from VIM) :

3

diakonos would be perfect with this!

Many thanks...!

Pistos commented 10 years ago

Thank you for trying Diakonos.

Please provide some samples of expected indentation. Either in Markdown code blocks in a comment, or in a gist.

ali-bahjati commented 10 years ago

Here you go : ( this is almost all I need! :D ) https://gist.github.com/ali-bahjati/b44fe8d999d912560234

Pistos commented 10 years ago

@ali-bahjati By the way, until I improve this, you can manually indent using Alt-I and Alt-Shift-I. This is what I use when the smart indentation doesn't do what I want.

Pistos commented 10 years ago

@ali-bahjati Okay, I have made a number of fixes to indentation. Please try the latest master branch, including updates to the default diakonos.conf file. When I tried it, it indented everything just like in your sample file, except for one or two things. Please confirm.

ali-bahjati commented 10 years ago

Many thanks for what you've done! There are few things that are not fixed (as you mentioned!); First of all, when I type a closing brace (}), I should press tab for applying indentation! It'll be good when it become automated! The other thing is that following sample (picture) still doesn't work: image

(but it is not really important)

Many Thanks...!

Pistos commented 10 years ago

@ali-bahjati I have added a feature so that typing } at the end of the line triggers indentation. Try it out (master branch). I will work on that other bug shown by your sample.

Pistos commented 10 years ago

The reason this else is not indented far left (0th column) is because it is the else of the if. If it were any other text, it would not be indented. This is starting to get into lexing and parsing, something I wanted to avoid in Diakonos for a while now. I think I will leave this as unimplemented, and just ask that you use Alt-I in these special cases.

ali-bahjati commented 10 years ago

It's now great! Thanks...