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
This commit is contained in:
Ansgar Becker
2026-03-06 10:55:38 +01:00
parent 6215d19ff5
commit e3fc3f5ff6
3 changed files with 4 additions and 6 deletions

View File

@@ -5561,9 +5561,7 @@ begin
snip := (MaxLineWidth > 0) and (Len > MaxLineWidth);
IsSQL := LogItem.Category in [lcSQL, lcUserFiredSQL];
if snip then begin
Msg :=
Copy(Msg, 0, MaxLineWidth) +
'/* '+f_('large SQL query (%s), snipped at %s characters', [FormatByteNumber(Len), FormatNumber(MaxLineWidth)]) + ' */';
Msg := Copy(Msg, 1, MaxLineWidth) + '...';
end else if (not snip) and IsSQL then
Msg := Msg + Delimiter;
if not IsSQL then
@@ -6854,7 +6852,7 @@ var
dbname := '';
tblname := LeftToken;
if Pos('.', tblname) > -1 then begin
dbname := Copy(tblname, 0, Pos('.', tblname)-1);
dbname := Copy(tblname, 1, Pos('.', tblname)-1);
tblname := Copy(tblname, Pos('.', tblname)+1, Length(tblname));
end;
// db and table name may already be quoted

View File

@@ -141,7 +141,7 @@ begin
if VT.HasChildren[VT.FocusedNode] then
Exit;
FKeyword := VT.Text[VT.FocusedNode, VT.FocusedColumn];
lblKeyword.Caption := Copy(FKeyword, 0, 100);
lblKeyword.Caption := Copy(FKeyword, 1, 100);
MemoDescription.Lines.Clear;
MemoExample.Lines.Clear;
Caption := DEFAULT_WINDOW_CAPTION;

View File

@@ -429,7 +429,7 @@ begin
Screen.Cursor := crHourglass;
MemoText.Text := ReadTextFile(d.FileName, MainForm.GetEncodingByName(d.Encodings[d.EncodingIndex]));
if (FMaxLength > 0) and (Length(MemoText.Text) > FMaxLength) then
MemoText.Text := copy(MemoText.Text, 0, FMaxLength);
MemoText.Text := Copy(MemoText.Text, 1, FMaxLength);
AppSettings.WriteInt(asFileDialogEncoding, d.EncodingIndex, Self.Name);
finally
Screen.Cursor := crDefault;