GNU bug report logs -
#60280
29.0.60; c-ts-mode: Indent content on newline
Previous Next
Full log
View this message in rfc822 format
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:
> The content doesn't seem to indent on newline after the user press
> <Return> as in c-mode. And the user requires to press TAB explicitly
> for this happen (and indentation happens only on non empty content).
>
> Say for example, for the following code, if I press <Return> (| is the
> point)
>
> if (success)|
>
> I get:
>
> if (success)
> |
>
> but I expect the following (with gnu style and 2 space indentation):
>
> if (success)
> |
>
>
> This is very much broken in do-while loops:
>
> Say if I do:
>
> do
> {
> }
>
> and do TAB (after selecting the whole code), indentation doesn't happen
> (with gnu style), but it seems to happen right once I complete writing
> while(0); (or so). (Or is this a different bug?)
This is because when you haven’t typed out the complete statement, the
parser couldn’t naturally don’t have the complete statement in the parse
tree, so the indent rules didn’t match. Once you completed the
statement, everything works as intended. We would need to add some
clever heuristics to match even when the parse tree is incomplete.
I’ll try to do it when I found some time, thought the priority would be
lower than other stuff.
Yuan
This bug report was last modified 1 year and 282 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.