IDE: fix hint window hiding when hovering over it and going away from the target word.

git-svn-id: trunk@54451 -
This commit is contained in:
ondrej 2017-03-21 19:15:30 +00:00
parent d5739c0615
commit fa015f899a
2 changed files with 13 additions and 9 deletions

View File

@ -11131,9 +11131,8 @@ begin
//Find start of identifier //Find start of identifier
AtomRect := Rect(-1,-1,-1,-1); AtomRect := Rect(-1,-1,-1,-1);
SrcEdit.EditorComponent.GetWordBoundsAtRowCol(CaretPos, AtomStartPos, AtomEndPos); SrcEdit.EditorComponent.GetWordBoundsAtRowCol(CaretPos, AtomStartPos, AtomEndPos);
AtomRect.TopLeft := SrcEdit.EditorComponent.RowColumnToPixels(Point(AtomStartPos, CaretPos.y+1)); AtomRect.TopLeft := SrcEdit.EditorComponent.RowColumnToPixels(Point(AtomStartPos, CaretPos.y));
AtomRect.BottomRight := SrcEdit.EditorComponent.RowColumnToPixels(Point(AtomEndPos, CaretPos.y+1)); AtomRect.BottomRight := SrcEdit.EditorComponent.RowColumnToPixels(Point(AtomEndPos, CaretPos.y+1));
Inc(AtomRect.Bottom, SrcEdit.EditorComponent.LineHeight);
SrcEdit.ActivateHint(AtomRect, BaseURL, SmartHintStr, AutoShown, False); SrcEdit.ActivateHint(AtomRect, BaseURL, SmartHintStr, AutoShown, False);
end; end;

View File

@ -48,7 +48,7 @@ uses
// LCL // LCL
Controls, Forms, ComCtrls, StdCtrls, Graphics, Dialogs, Extctrls, Menus, Controls, Forms, ComCtrls, StdCtrls, Graphics, Dialogs, Extctrls, Menus,
LCLProc, LCLType, LResources, LCLIntf, FileUtil, LazFileUtils, LCLProc, LCLType, LResources, LCLIntf, FileUtil, LazFileUtils,
ClipBrd, HelpIntfs, Messages, ClipBrd, HelpIntfs, Messages, LMessages,
// LazControls // LazControls
ExtendedNotebook, ExtendedNotebook,
// LazUtils // LazUtils
@ -1924,13 +1924,13 @@ begin
begin begin
FAutoHintMousePos := Mouse.CursorPos; FAutoHintMousePos := Mouse.CursorPos;
if not(HintIsVisible and (FLastHint = AHint)) then if not(HintIsVisible and (FLastHint = AHint)) then
ShowHint(ScreenRect.TopLeft,AHint,AMouseOffset); ShowHint(Point(ScreenRect.Left, ScreenRect.Bottom),AHint,AMouseOffset);
end else end else
begin begin
if HintIsVisible and (FLastHint = AHint) then if HintIsVisible and (FLastHint = AHint) then
HideIfVisible HideIfVisible
else else
ShowHint(ScreenRect.TopLeft,AHint,AMouseOffset); ShowHint(Point(ScreenRect.Left, ScreenRect.Bottom),AHint,AMouseOffset);
end; end;
FAutoHideHintTimer.Enabled := AAutoShown; FAutoHideHintTimer.Enabled := AAutoShown;
end; end;
@ -2044,13 +2044,14 @@ begin
if OkX then FAutoHintMousePos.x := Cur.x; if OkX then FAutoHintMousePos.x := Cur.x;
if OkY then FAutoHintMousePos.y := Cur.y; if OkY then FAutoHintMousePos.y := Cur.y;
if (not IsRectEmpty(FScreenRect)) and PtInRect(FScreenRect, Cur) then if (not IsRectEmpty(FScreenRect)) then
begin begin
// Do not close, if mouse still over the same word, that triggered the hint // Do not close, if mouse still over the same word, that triggered the hint
if PtInRect(FScreenRect, Cur) then
Exit; Exit;
end else end else
begin begin
// Do not close if mouse moves towards the hint. Allow mouse to enter hint // Fallback if FScreenRect is empty
OkX := OkX or OkX := OkX or
( (FAutoHintMousePos.x <= hw.Left + MaxJitter) and ( (FAutoHintMousePos.x <= hw.Left + MaxJitter) and
(Cur.x > FAutoHintMousePos.x - MaxJitter) and (Cur.x <= hw.Left + hw.Width + MaxJitter) (Cur.x > FAutoHintMousePos.x - MaxJitter) and (Cur.x <= hw.Left + hw.Width + MaxJitter)
@ -10666,8 +10667,12 @@ begin
if FHints.PtIsOnHint(Mouse.CursorPos) then begin // ignore any action over Hint if FHints.PtIsOnHint(Mouse.CursorPos) then begin // ignore any action over Hint
if FHints.CurHintWindow.Active then if FHints.CurHintWindow.Active then
exit; exit;
if (Msg = WM_MOUSEMOVE) {$IFDEF WINDOWS} or (Msg = WM_NCMOUSEMOVE)or if (Msg = WM_MOUSEMOVE)
((Msg >= WM_MOUSEFIRST) and (Msg <= WM_MOUSELAST)) {$ENDIF} or (Msg = LM_MOUSELEAVE)
{$IFDEF WINDOWS}
or (Msg = WM_NCMOUSEMOVE)
or ((Msg >= WM_MOUSEFIRST) and (Msg <= WM_MOUSELAST))
{$ENDIF}
then then
exit; exit;
end; end;