Rubberduck icon indicating copy to clipboard operation
Rubberduck copied to clipboard

Indenter. VBA Statement continuation lines aligned farther and farther to right

Open CoderRPM opened this issue 1 month ago • 0 comments

Rubberduck version information

Version 2.5.9.6316 OS: Microsoft Windows NT 10.0.22631.0, x64 Host Product: Microsoft Office x64 Host Version: 16.0.17531.20152 Host Executable: EXCEL.EXE

Description Problem when using indenter at any level (Proj, Mod, or Proc) on a statement with multiple continuation lines (terminated with space-underscore " _").

In SOME, BUT NOT ALL circumstances, a continuation line will be indented MUCH farther to the right than the preceding continuation line.

When this strangeness occurs for a statement with multiple continuation lines, each subsequent continuation line steps farther and farther to the right and eventually falls off the right side of the window. Scrolling right shows they are still there. Just out of the window.

Somewhat strangely, in at least one example, the last two continuation lines reverted left to the indent level of the first continuation line. (see attached Clip).

Indenter Settings Indent alignment options: I have "Align Continuations" checked. Does not seem to matter if I check or un-check "Ignore Operators".

To Reproduce

  1. Create a REALLY LONG text string in something like an EXCEL MsgBox statement or assign this long text thing to a string variable.
  2. Then use suitably placed double quotes ("), ampersands (&), and the space-underscore line continuation indicator ( _) to break it into pieces sized to keep all of the pieces within the window,
  3. Use any method of convenience to invoke the indenter: Hot Key combination, or use the command bar RubberDuck dropdown.
  4. Use any choice of indenter scope: Project, Module, or Procedure.
  5. Inspect Code
  6. See error

Expected behavior I would prefer to have indenter pick an indent distance for the FIRST continuation line of a statement based on the rules selected by the currently specified Indent Options.

I would like subsequent continuation lines for the statement to generally align at that same indent distance.

Screenshots image

Logfile I will generate a trace log if you think it would be useful.

CoderRPM avatar Jun 04 '24 19:06 CoderRPM