[Geany-devel] Changes to templates
mbrush at xxxxx
Tue Mar 15 20:08:23 UTC 2011
On 03/15/11 09:54, Colomban Wendling wrote:
> Le 15/03/2011 04:12, Matthew Brush a écrit :
>> Make a constant for the amount of indentation used for template
>> comments, so that they are consistent and also set to a more reasonable
>> value of 3 instead of 8. Related to feature request: Specify spacing
>> before fileheader - ID: 3193527.
> Sounds good -- though, we may want to make this a setting at some point.
> Committed, renaming GEANY_TEMPLATES_HEADER_INDENT to
> GEANY_TEMPLATES_INDENT since it's not only for headers anymore.
That makes sense.
>> Strip all leading and trailing whitespace on the text read from template
> What if somebody *wants* whitepaces/newlines at the end of her template?
> I can easily imagine one wants this, for example for function
> descriptions  or whatever (it's seems to be the case with the Geany's
> default function template).
> Moreover, Geany's default templates seems to work OK without the patch,
> don't they?
I noticed Geany's default templates end with 2 trailing newlines,
perhaps that should be changed to 1 to sort of "split the difference"?
I agree that in some cases it might not be desirable (I mentioned this
concern in my initial message) to completely strip leading/trailing
> Currently you "just" need to write your template carefully, with this
> change, it won't be possible at all.
> So... I'm not sure about this one.
>> Fix filetypes.c to use /* */ style comments rather than C++ style comments.
> I'd personally agree with this change, but it has a drawback: multi-line
> C comments can't be nested. So the comment/un-comment command becomes a
> little less useful since it'd break if commenting stuff including comments.
This is true, and I didn't think of this, however, I still don't agree
that for C filetype to insert "invalid" C code (by default).
> Maybe a better fix would be to allow a filetype to define both
> single-line and multi-line comments, and use them when appropriate?
> (e.g. multi-lines comment for template comments, single-lines for ^E)
Another way would be to let users embed the comments directly into the
templates, and not have it done automatically by software, letting the
user choose the indentation and comment style for those.
>> There is still the issue Lex brought up about the encoding of the text
>> being read from file and set into Scintilla.
> True, this should be fixed. I'll take a look at it.
I think there's a function in documents.c called read_text_file (or
similar), that if exposed in documents.h, could solve this issue. I
only had a cursory glance though, so I could be mistaken.
More information about the Devel