Преглед изворни кода

Improve [Code] autocomple initiation: do not initiate when just indenting the line, do initiate when a word char is added at the start of the line. The first is similar to what it already did for other sections. Can perhaps be smarted instead of just requiring non whitespace?

Martijn Laan пре 1 година
родитељ
комит
62778baaca
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      Projects/Src/Compil32/CompForm.pas

+ 5 - 1
Projects/Src/Compil32/CompForm.pas

@@ -4846,7 +4846,7 @@ end;
 function TCompileForm.InitiateAutoCompleteOrCallTipAllowedAtPos(const AMemo: TCompScintEdit;
   const WordStartLinePos, PositionBeforeWordStartPos: Integer): Boolean;
 begin
-  Result := (PositionBeforeWordStartPos >= WordStartLinePos) and
+  Result := (PositionBeforeWordStartPos < WordStartLinePos) or
             not FMemosStyler.IsCommentOrPascalStringStyle(AMemo.GetStyleAtPosition(PositionBeforeWordStartPos));
 end;
 
@@ -4932,6 +4932,10 @@ begin
       begin
         Section := FMemosStyler.GetSectionFromLineState(FActiveMemo.Lines.State[Line]);
         if Section = scCode then begin
+          { Space can only initiate autocompletion after non whitespace }
+          if (Key = ' ') and OnlyWhiteSpaceBeforeWord(FActiveMemo, LinePos, WordStartPos) then
+            Exit;
+
           var PositionBeforeWordStartPos := FActiveMemo.GetPositionBefore(WordStartPos);
           if Key <> #0 then begin
             FActiveMemo.StyleNeeded(PositionBeforeWordStartPos); { Make sure the typed character has been styled }