Small formatting issue

Toad v17.1.717.3711

DECLARE
  num   CONSTANT NUMBER
    := CASE 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         WHEN 1 THEN 1
         ELSE 0
       END ;
  num2   CONSTANT NUMBER
    := CASE 1 WHEN 1 THEN 1 --
                            WHEN 1 THEN 1 --
                                          WHEN 1 THEN 1 --
                                                        WHEN 1 THEN 1 --
                                                                      WHEN 1 THEN 1 --
                                                                                    WHEN 1 THEN 1 --
                                                                                                  WHEN 1 THEN 1 --
                                                                                                                WHEN 1 THEN 1 --
                                                                                                                              WHEN 1 THEN 1 --
                                                                                                                                            WHEN 1 THEN 1 --
                                                                                                                                                          WHEN 1 THEN 1 --
                                                                                                                                                                        ELSE 0 END ;
BEGIN
  NULL;
END;

If I use auto format for the above a space gets added for some reason after the CASE END. The same issue happens with a shorter one as well but where the WHENs doesn't line up. Doesn't seem to happen outside the declare section. The specific length where this happens probably depends on the formatting max width (180 for me).

<FormatterOptions>
  <Version>397</Version>
  <LegacyOptionsGUI>5.397.0</LegacyOptionsGUI>
  <QP5>5.404</QP5>
  <OutputTabs>2</OutputTabs>
  <IndentSize>2</IndentSize>
  <RightMargin>180</RightMargin>
  <AssignFavorWrapping>0</AssignFavorWrapping>
  <CommentsRightJustifyTrailing>0</CommentsRightJustifyTrailing>
  <CommentsRightJustifyLineComment>0</CommentsRightJustifyLineComment>
  <ExprArrangeOnCol>99</ExprArrangeOnCol>
  <DmlColumnAliasAlignment>0</DmlColumnAliasAlignment>
  <DmlTableRefAliasAlignment>0</DmlTableRefAliasAlignment>
  <Tagline>0</Tagline>
</FormatterOptions>

I can't reproduce this effect, even after playing with some of my formatting options.
Anyone else seeing this?

Whenever a CASE statement wants to format onto a single (in case of few cases or in case of a wide page setting) then any '--' style comments - which by nature have to run up to their terminating newline - will cause the remainder of the code line to be continued on the next line, at the current offset.
When output to a single line is not possible then the cases will be stacked, and then the '--' comments naturally fit near the right of each case.

Yeah, it may be better to let '--' comments trigger stacking, rather than trying to preserve a weird sliced single line pattern ... Creating issue QP-4274.

Thanks,
Andre

Great, I do find that pretty annoying when trying to make things look nice. Same thing happens with something like this.

SELECT *
  FROM DUAL
 WHERE 1 = 1 --
             OR 1 = 1 --
                      OR 1 = 1 --
                               OR 1 = 1 --
                                        OR 1 = 1 --
                                                 OR 1 = 1 --
                                                          OR 1 = 1 --

-- If you want them to line up you need to do something like this

SELECT *
  FROM DUAL
 WHERE 1 = 1 --
             --
        OR 1 = 1 --
                 --
        OR 1 = 1 --
                 --
        OR 1 = 1 --
                 --
        OR 1 = 1 --
                 --
        OR 1 = 1 --
                 --
        OR 1 = 1 --

To be clear though the report was actually just the extra space that gets added between "END" and ";" in both the case statements I included.