From 4b4b376b36079abb18475dfb0f7de48e21d67665 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 27 May 2020 20:10:04 +0200 Subject: [PATCH] fix #42 - The expression parser used by GDB commander doesn't support tabs --- CHANGELOG.md | 2 ++ src/u_synmemo.pas | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b96a69..c269741d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ## Bugs fixed +- GDB commander: automatic break on exception did not work if the cprogram was compiled with LDC2. (#41) +- GDB commander: expressions obtained by mouse motion were not correct when the source used tabulations to indent. (#42) - Messages: force auto scrolling to bottom once and if the messages context is modified. - Terminal: after launching dexed, the current directory was not constrained even when the settings to follow the current project or document path were activated. (#5) diff --git a/src/u_synmemo.pas b/src/u_synmemo.pas index abbcb0ee..31429232 100644 --- a/src/u_synmemo.pas +++ b/src/u_synmemo.pas @@ -203,7 +203,8 @@ type fMultiDocSubject: TObject; fDefaultFontSize: Integer; fPositions: TSynMemoPositions; - fMousePos: TPoint; + fMousePhysical: TPoint; + fMouseLogical: TPoint; fCallTipWin: TEditorCallTipWindow; fDDocWin: TEditorHintWindow; fDDocDelay: Integer; @@ -2769,7 +2770,7 @@ begin if assigned(fDebugger) and fDebugger.running then begin lexWholeText([TLexOption.lxoNoComments]); - exp := getExpressionAt(fLexToks, fMousePos); + exp := getExpressionAt(fLexToks, fMouseLogical); ev1 := fDebugger.evaluate(exp); if ev1.isEmpty then ev1 := '???'; @@ -3518,15 +3519,15 @@ var i, len, llen: Integer; begin result := 0; - if fMousePos.y-1 > Lines.Count-1 then + if fMousePhysical.y-1 > Lines.Count-1 then exit; - llen := Lines[fMousePos.y-1].length; - if fMousePos.X > llen then + llen := Lines[fMousePhysical.y-1].length; + if fMousePhysical.X > llen then exit; len := getSysLineEndLen; - for i:= 0 to fMousePos.y-2 do + for i:= 0 to fMousePhysical.y-2 do result += Lines[i].length + len; - result += fMousePos.x; + result += fMousePhysical.x; end; procedure TDexedMemo.patchClipboardIndentation; @@ -3727,8 +3728,9 @@ begin (((dx < 0) and (dx > -5) or (dx > 0) and (dx < 5)) or ((dy < 0) and (dy > -5) or (dy > 0) and (dy < 5))) then fCanShowHint:=true; - fOldMousePos := Point(X, Y); - fMousePos := PixelsToRowColumn(fOldMousePos); + fOldMousePos := Point(X, Y); + fMousePhysical := PixelsToRowColumn(fOldMousePos); + fMouseLogical := PixelsToLogicalPos(fOldMousePos); if ssLeft in Shift then highlightCurrentIdentifier;