Indentation guides were originally introduced to Scintilla as a way
of viewing indentation whitespace that was less intrusive than View
Whitespace mode. It then made it easier to see the structure of code
and follow structures that are longer than the window height. However,
because it began by making whitespace visible, indentation guides do
not appear on lines that are completely empty. Some example code

       if (a) {
       |
       |       c();
       |
       |       e();
       |
       }

   Assume the lines are named a .. g. With current Scintilla
indentation guides will only appear for lines b, d, and f if there is
more than one indentation level of whitespace on these lines. To make
indentation guides appear on these lines even with no real whitespace
characters, the surrounding lines can be examined. If looking forward
line c can be used to produce 'assumed' indentation whitespace for
line b. However for line f, you need to look backwards. Looking
backwards may not be what you want for Python where you may have

       def a():
       |
       |       c()
       |
       def e():
       |

  You may prefer that line d not show an indentation guide to provide
a more significant break between definitions. Another issue is that an
empty definition does not have any lines with indentation to copy so
in addition empty lines that follow a fold header get one indentation
level more assumed indentation than the header line.

       if (a) {
       |
       }

  Some applications may want to continue with the current behaviour
so this may go in by changing SCI_SETINDENTATIONGUIDES to take a value
from 0 to 3 rather than a boolean: SC_IV_NONE, SC_IV_REAL,
SC_IV_LOOKFORWARD, SC_IV_LOOKBOTH. Changing the type of an API is
somewhat incompatible so if this causes significant trouble it can be
two properties (on/off),(real/forward/both) which is how SciTE would
deal with it (so the menu item remains a toggle but the way it is
displayed can be chosen per language).

  SC_IV_LOOKFORWARD actually also looks back but only if the previous
non-empty line is a fold header.

  While it may be possible to base the assumed whitespace completely
on the fold structure, this is made difficult by conventions that do
not add indentation levels for structures such as namespaces and
extern "C".

  Not yet committed in case there is a need to make this two properties.

  Neil
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to