projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
db33e2a
)
fix padding calculation in listAround
author
Simon Marlow
<simonmar@microsoft.com>
Thu, 19 Apr 2007 14:40:05 +0000
(14:40 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Thu, 19 Apr 2007 14:40:05 +0000
(14:40 +0000)
compiler/ghci/InteractiveUI.hs
patch
|
blob
|
history
diff --git
a/compiler/ghci/InteractiveUI.hs
b/compiler/ghci/InteractiveUI.hs
index
3713c4c
..
7442ad4
100644
(file)
--- a/
compiler/ghci/InteractiveUI.hs
+++ b/
compiler/ghci/InteractiveUI.hs
@@
-1659,9
+1659,9
@@
listAround span do_highlight = do
contents <- BS.readFile (unpackFS file)
let
lines = BS.split '\n' contents
contents <- BS.readFile (unpackFS file)
let
lines = BS.split '\n' contents
- these_lines = take (line2 - line1 + 1 + 2*padding) $
- drop (line1 - 1 - padding) $ lines
- fst_line = max 1 (line1 - padding)
+ these_lines = take (line2 - line1 + 1 + pad_before + pad_after) $
+ drop (line1 - 1 - pad_before) $ lines
+ fst_line = max 1 (line1 - pad_before)
line_nos = [ fst_line .. ]
highlighted | do_highlight = zipWith highlight line_nos these_lines
line_nos = [ fst_line .. ]
highlighted | do_highlight = zipWith highlight line_nos these_lines
@@
-1677,7
+1677,10
@@
listAround span do_highlight = do
col1 = srcSpanStartCol span
line2 = srcSpanEndLine span
col2 = srcSpanEndCol span
col1 = srcSpanStartCol span
line2 = srcSpanEndLine span
col2 = srcSpanEndCol span
- padding = 1
+
+ pad_before | line1 == 1 = 0
+ | otherwise = 1
+ pad_after = 1
highlight no line
| no == line1 && no == line2
highlight no line
| no == line1 && no == line2