浏览代码

"If virtual space is enabled, and tabs are not being used for indentation (typing in virtual space doesn't create tabs), then we don't actually have to set any indentation if the new line is empty; we can just move the caret out into virtual space."

This is actually not true. Pressing tab when in virtual space makes Scintilla move the caret back into non-virtual space, unlike when for example a letter is pressed. So if the user starts with typing a tab after the auto indent they have to redo the indentation themselves.
Martijn Laan 1 年之前
父节点
当前提交
7af99e0efb
共有 1 个文件被更改,包括 3 次插入14 次删除
  1. 3 14
      Projects/Src/CompForm.pas

+ 3 - 14
Projects/Src/CompForm.pas

@@ -4941,20 +4941,9 @@ begin
       end;
       if PreviousLine >= 0 then begin
         PreviousIndent := FActiveMemo.GetLineIndentation(PreviousLine);
-        { If virtual space is enabled, and tabs are not being used for
-          indentation (typing in virtual space doesn't create tabs), then we
-          don't actually have to set any indentation if the new line is
-          empty; we can just move the caret out into virtual space. }
-        if (svsUserAccessible in FActiveMemo.VirtualSpaceOptions) and
-           not FActiveMemo.UseTabCharacter and
-           (FActiveMemo.Lines.RawLineLengths[NewLine] = 0) then begin
-          FActiveMemo.CaretVirtualSpace := PreviousIndent;
-        end
-        else begin
-          FActiveMemo.SetLineIndentation(NewLine, NewIndent + PreviousIndent);
-          FActiveMemo.CaretPosition := FActiveMemo.GetPositionFromLineExpandedColumn(NewLine,
-            PreviousIndent);
-        end;
+        FActiveMemo.SetLineIndentation(NewLine, NewIndent + PreviousIndent);
+        FActiveMemo.CaretPosition := FActiveMemo.GetPositionFromLineExpandedColumn(NewLine,
+          PreviousIndent);
       end;
     end;
   end;