synedit: fixed caret position when searching within tabs and UTF-8 strings

git-svn-id: trunk@11679 -
This commit is contained in:
mattias 2007-07-30 17:25:16 +00:00
parent d476d654ea
commit dbdbc446b0
3 changed files with 11 additions and 5 deletions

View File

@ -9211,7 +9211,10 @@ begin
ptEnd.Y := Lines.Count;
ptEnd.X := Length(Lines[ptEnd.Y - 1]) + 1;
if bFromCursor then
if bBackward then ptEnd := CaretXY else ptStart := CaretXY;
if bBackward then
ptEnd := {$IFDEF SYN_LAZARUS}LogicalCaretXY{$ELSE}CaretXY{$ENDIF}
else
ptStart := {$IFDEF SYN_LAZARUS}LogicalCaretXY{$ELSE}CaretXY{$ENDIF};
if bBackward then ptCurrent := ptEnd else ptCurrent := ptStart;
end;
// initialize the search engine
@ -9245,9 +9248,9 @@ begin
// Select the text, so the user can see it in the OnReplaceText event
// handler or as the search result.
BlockBegin := ptFoundStart;
if bBackward then CaretXY := BlockBegin;
if bBackward then LogicalCaretXY := BlockBegin;
BlockEnd := ptFoundEnd;
if not bBackward then CaretXY := ptFoundEnd;
if not bBackward then LogicalCaretXY := ptFoundEnd;
// If it's a 'search' only we can leave the procedure now.
if not (bReplace or bReplaceAll) then exit;
// Prompt and replace or replace all. If user chooses to replace

View File

@ -1168,7 +1168,7 @@ var
OldOptions: TSynSearchOptions;
begin
if LazFindReplaceDialog.FindText = '' then
StartFindAndReplace(False)
StartFindAndReplace(False)
else if snIncrementalFind in FSourceNoteBook.States then begin
FSourceNoteBook.fIncrementalSearchStartPos:=FEditor.LogicalCaretXY;
end else begin
@ -1243,7 +1243,8 @@ begin
//debugln('TSourceEditor.DoFindAndReplace A LazFindReplaceDialog.FindText="',dbgstr(LazFindReplaceDialog.FindText),'" ssoEntireScope=',dbgs(ssoEntireScope in LazFindReplaceDialog.Options),' ssoBackwards=',dbgs(ssoBackwards in LazFindReplaceDialog.Options));
try
Result:=EditorComponent.SearchReplace(
LazFindReplaceDialog.FindText,LazFindReplaceDialog.ReplaceText,LazFindReplaceDialog.Options);
LazFindReplaceDialog.FindText,LazFindReplaceDialog.ReplaceText,
LazFindReplaceDialog.Options);
except
on E: ERegExpr do begin
MessageDlg(lisUEErrorInRegularExpression,

View File

@ -2233,6 +2233,8 @@ begin
//DebugLn(['HandleGTKKeyUpDown TargetWidget=',GetWidgetDebugReport(TargetWidget)]);
gdk_event_key_get_string(AEvent, EventString);
//DebugLn(['HandleGTKKeyUpDown TargetWidget=',GetWidgetDebugReport(TargetWidget),' ',DbgStr(EventString),' state=',AEvent^.state,' keyval=',AEvent^.keyval]);
FillChar(Msg, SizeOf(Msg), 0);
Flags := 0;