Author Topic: Auto-indent, color functions even if paren is on next line, etc.  (Read 2210 times)

Pipecity

  • New Community Member
  • Posts: 1
  • Hero Points: 0
I would like to see the following list:
 - Have the Navigate function work correctly (so that if you click in the Def window it will remember the last position)
 - Auto-indent code section
 - Compare view between two different files
 - Display one tab for each window (if you duplicate one it doesn't show more than one)
 - Interpret function declarations even if the parentesis are located on the next line (for C/C++)
       (e.g. void
               FunctionName
               (
                 int i
               )
               ...
        )
 - Display all the occurencies when you select something

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Auto-indent, color functions even if paren is on next line, etc.
« Reply #1 on: August 25, 2009, 06:43:02 PM »
I actually have a patch to auto-indent a code section, but the changes in c.e are a little too extensive to share (and they're all inside #ifdef and also hidden behind def_chrisant_cmode so I can toggle between my patched behavior and stock behavior at will).

I found that SE tends to have separate code to analyze the context for each thing that needs it (e.g. c_brace, c_enter, etc).  This leads to a large text matrix, and high maintenance costs, among other things.  In another editor I had written a macro that implemented all the brace/enter/etc functionality by calling a single core function AlignCurrentLine().  I had a test file that another macro walked through to automatically test 37 different scenarios and verify they all worked correctly.  It made it easy(er) to keep the AlignCurrentLine() function and all its callers working properly even when I sometimes made changes that would otherwise have been risky.  This also meant that for example when I added support for a new indenting rule, I could just implement it in one place and it took effect in all formatter scenarios, and the autotest verified there were no regressions (or rather, it identified regressions and I fixed them ;)).

I have been considering porting my old AlignCurrentLine() function to SE and sharing it (which would include an AutoIndentCodeSection() function as well).  What's been holding me back is:  (1) it applies only to C/C++, (2) it is not 1:1 with SE (it is missing a couple formatting rules that SE supports, and vice versa), and (3) I figured I was unusual in wanting only auto-indenting without full beautification.