Permalink
Browse files

Do not auto-uppercase previous SQL word when it could be a table name…

… from current database. Closes #412.
  • Loading branch information...
ansgarbecker committed Nov 28, 2018
1 parent 3298238 commit 32ebea38a143cbbd3ef2e187c35deb9b6bacf558
Showing with 15 additions and 13 deletions.
  1. +15 −13 source/main.pas
@@ -6191,19 +6191,21 @@ procedure TMainForm.SynMemoQueryKeyPress(Sender: TObject; var Key: Char);
CurrentRowCol := Editor.CharIndexToRowCol(CurrentCharIndex);
StartOfTokenRowCol := Editor.PrevWordPosEx(CurrentRowCol);
Editor.GetHighlighterAttriAtRowColEx(StartOfTokenRowCol, Token, TokenTypeInt, Start, Attri);
if TtkTokenKind(TokenTypeInt) in [tkDatatype, tkFunction, tkKey] then begin
OldCaretXY := Editor.CaretXY;
OldSelStart := Editor.SelStart;
OldSelEnd := Editor.SelEnd;
Editor.UndoList.BeginBlock;
Editor.SelStart := Editor.RowColToCharIndex(StartOfTokenRowCol);
Editor.SelEnd := Editor.SelStart + Length(Token);
Editor.SelText := UpperCase(Token);
Editor.CaretXY := OldCaretXY;
Editor.SelStart := OldSelStart;
Editor.SelEnd := OldSelEnd;
Editor.UndoList.EndBlock;
end;
if SynSQLSynUsed.TableNames.IndexOf(Token) > 0 then
Exit;
if not (TtkTokenKind(TokenTypeInt) in [tkDatatype, tkFunction, tkKey]) then
Exit;
OldCaretXY := Editor.CaretXY;
OldSelStart := Editor.SelStart;
OldSelEnd := Editor.SelEnd;
Editor.UndoList.BeginBlock;
Editor.SelStart := Editor.RowColToCharIndex(StartOfTokenRowCol);
Editor.SelEnd := Editor.SelStart + Length(Token);
Editor.SelText := UpperCase(Token);
Editor.CaretXY := OldCaretXY;
Editor.SelStart := OldSelStart;
Editor.SelEnd := OldSelEnd;
Editor.UndoList.EndBlock;
end;
end;

0 comments on commit 32ebea3

Please sign in to comment.