[anjuta-devel] Indentation in project wizard.



Hi,


I have thought on how to implement indentation in the project wizard.

We need 3 informations:
  * What is the size of the tab
  * What is the size of one indentation level
  * If we use tabs or only spaces
Currently, these informations are saved in each editor (scintilla or sourceview). I plan to move these settings in anjuta/editor/.


Then, I have 2 possibilities.

1. Write a function in autogen to generate the right indentation. You will have to write the following. Each tab in the L parameter will be replaced by the right indentation.

int
main (int argc, char *argv[])
{
[+INDENT L="    "+]int i;

[+INDENT L="    "+]if (i == 0)
[+INDENT L="    "+]{
[+INDENT L="        "+]i++;
[+INDENT L="    "+]}

I can do it with just a number, like below but I think it is less clear.

[+INDENT L=1+]int i;

[+INDENT L=1+]if (i == 0)
[+INDENT L=1+]{
[+INDENT L=2+]i++;
[+INDENT L=1+]}
...


2. Another solution would be to add (conditionally) a second pass that will replace all tabs are the beginning of each line by the right indentation. The advantage is that you just need to add the right number of tabs and the file stay quite easy to read. The disadvantage is that it is another pass, I think it will need a change both in the project and file wizard.


Do you have a preference or other ideas?


Regards,

Sébastien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]