diff options
Diffstat (limited to 'mardown/error.go')
| -rw-r--r-- | mardown/error.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/mardown/error.go b/mardown/error.go index bdcd9df..ad279fe 100644 --- a/mardown/error.go +++ b/mardown/error.go @@ -24,14 +24,20 @@ func (e *ParseError) Pretty() string { ind := "" for lxs.Next() && lxs.Current().Type != lexerBreak { contxt += lxs.Current().Value - ln := len(lxs.Current().Value) - if lxs.current == current-1 { - ln-- - ind += "^" - } - for range ln { - ind += "~" + if lxs.current <= current { + ch := "~" + if lxs.current == current { + ch = "^" + } + for range len(lxs.Current().Value) { + ind += ch + } } } + if lxs.current == current { + runes := []rune(ind) + runes[len(runes)-1] = '^' + ind = string(runes) + } return fmt.Sprintf("%v\n\n%s\n%s", e, contxt, ind) } |
