Skip to content

Commit e3fc3f5

Browse files
committed
fix: wrong use of Copy(), which is one-based not zero-based, and remove translated appendix to snipped log message which may use critical chars and confuse SynEdit
Refs #48
1 parent 6215d19 commit e3fc3f5

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

source/main.pas

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5561,9 +5561,7 @@ procedure TMainForm.LogSQL(Msg: String; Category: TDBLogCategory=lcInfo; Connect
55615561
snip := (MaxLineWidth > 0) and (Len > MaxLineWidth);
55625562
IsSQL := LogItem.Category in [lcSQL, lcUserFiredSQL];
55635563
if snip then begin
5564-
Msg :=
5565-
Copy(Msg, 0, MaxLineWidth) +
5566-
'/* '+f_('large SQL query (%s), snipped at %s characters', [FormatByteNumber(Len), FormatNumber(MaxLineWidth)]) + ' */';
5564+
Msg := Copy(Msg, 1, MaxLineWidth) + '...';
55675565
end else if (not snip) and IsSQL then
55685566
Msg := Msg + Delimiter;
55695567
if not IsSQL then
@@ -6854,7 +6852,7 @@ procedure TMainForm.SynCompletionProposalExecute(Sender: TObject);
68546852
dbname := '';
68556853
tblname := LeftToken;
68566854
if Pos('.', tblname) > -1 then begin
6857-
dbname := Copy(tblname, 0, Pos('.', tblname)-1);
6855+
dbname := Copy(tblname, 1, Pos('.', tblname)-1);
68586856
tblname := Copy(tblname, Pos('.', tblname)+1, Length(tblname));
68596857
end;
68606858
// db and table name may already be quoted

source/sqlhelp.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ procedure TfrmSQLhelp.treeTopicsFocusChanged(Sender: TBaseVirtualTree; Node: PVi
141141
if VT.HasChildren[VT.FocusedNode] then
142142
Exit;
143143
FKeyword := VT.Text[VT.FocusedNode, VT.FocusedColumn];
144-
lblKeyword.Caption := Copy(FKeyword, 0, 100);
144+
lblKeyword.Caption := Copy(FKeyword, 1, 100);
145145
MemoDescription.Lines.Clear;
146146
MemoExample.Lines.Clear;
147147
Caption := DEFAULT_WINDOW_CAPTION;

source/texteditor.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ procedure TfrmTextEditor.btnLoadTextClick(Sender: TObject);
429429
Screen.Cursor := crHourglass;
430430
MemoText.Text := ReadTextFile(d.FileName, MainForm.GetEncodingByName(d.Encodings[d.EncodingIndex]));
431431
if (FMaxLength > 0) and (Length(MemoText.Text) > FMaxLength) then
432-
MemoText.Text := copy(MemoText.Text, 0, FMaxLength);
432+
MemoText.Text := Copy(MemoText.Text, 1, FMaxLength);
433433
AppSettings.WriteInt(asFileDialogEncoding, d.EncodingIndex, Self.Name);
434434
finally
435435
Screen.Cursor := crDefault;

0 commit comments

Comments
 (0)