diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-05-18 13:45:56 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-05-18 13:45:56 +0000 |
commit | e560c6b5a0c2ef4437ebca0c78c1775a09ba31c9 (patch) | |
tree | 99cd5c71741b881f7d6ca3c74315df1fc9ec7f40 | |
parent | 180e4344fab89e3e2c1aaaaaf1509c79f4bdb562 (diff) | |
download | haskell-e560c6b5a0c2ef4437ebca0c78c1775a09ba31c9.tar.gz |
improve break-by-coordinate
when setting a breakpoint by coordinate, if there are no spans
covering the specified coordinate, then we take the leftmost of the
spans to the right of the coordinate. This means that ':break c' will
work if c is not a function, because the first span will be on c's
right hand side.
-rw-r--r-- | compiler/ghci/InteractiveUI.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 78b65bfbc5..486d40380d 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -1677,7 +1677,8 @@ findBreakByCoord :: Maybe FastString -> (Int,Int) -> TickArray findBreakByCoord mb_file (line, col) arr | not (inRange (bounds arr) line) = Nothing | otherwise = - listToMaybe (sortBy rightmost contains) + listToMaybe (sortBy rightmost contains) `mplus` + listToMaybe (sortBy leftmost_smallest after_here) where ticks = arr ! line @@ -1689,6 +1690,10 @@ findBreakByCoord mb_file (line, col) arr | Just f <- mb_file = GHC.srcSpanFile span == f | otherwise = True + after_here = [ tick | tick@(nm,span) <- ticks, + GHC.srcSpanStartLine span == line, + GHC.srcSpanStartCol span >= col ] + leftmost_smallest (_,a) (_,b) = a `compare` b leftmost_largest (_,a) (_,b) = (GHC.srcSpanStart a `compare` GHC.srcSpanStart b) |