On Fri, 11 Jul 2008 15:00:38 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
Not only this, IMO it is necessary to distinguish between tab width and indentation width. Does Scintilla support this differentiation?
There's SCI_SETINDENT vs. SCI_SETTABWIDTH, but I haven't tried it: http://scintilla.sourceforge.net/ScintillaDoc.html#SCI_SETINDENT
Thanks for the link.
Is the support for "tab width" and "indentation width" a different Scintilla configuration? Or is it necessary to add this to the Geany core?
What should the difference be?
As I could read in the Scintilla docs (your link), Scintilla supports both, real tab-width and indentation-with.
The difference is (or should be), that tabs are some kind of "compression". Tabs are normally used without a special file type in mind.
Indentation is a more logical thing. The indentation depends on the file type and the logical content (surrounding the cursor). So indentation uses whitespaces (and so tabs) to indent the line to this logical position.
For example: Writing a simple C-function, the indentation is a multiple of 4.
void foo ( int i ) { if ( i>0 ) ....
Another example is Emacs. It uses indentation for "hanging arguments" too.
void foo ( int i ) { if ( i>0 ) some_function_call(long_parameter_name_as_example, second_long_parameter);
Pressing "indent" in Emacs at "second_long_parameter" indents the line according to the first parameter. This is not a multiple of 4. Thats what I mean with "logical thing".
When tabs are enabled, most editors I know uses tabs within whitespaces to realise the indentation. In the above example, the indentation would be done with three tabs and three spaces.
To obtain tabs (if enabled) it would be good if 8 (or x) spaces are replaced with a tab right after the indentation (Ctrl-I). What is the right way to do this? Can you point me to an file/function which should be patched?
I don't know what you mean, I'm not sure why we need to replace spaces/tabs.
It's just for consistency reasons. If tabs are enabled, they should be used.
To resume this thread:
Geany currently configures tabs with SCI_SETTABWIDTH. To separate tabs and indentation, the configuration dialog should ask for the indentation width and set SCI_SETINDENT with this value. There must be a hook to change SCI_SETINDENT for each filetype. Futhernore, it would be nice, if the configuration dialog would support SCI_SETTABINDENTS(bool) too.
Thanks for your answers. I think I'll have a look at this as soon as I have some spare time.