From 9afb1257b47809d625d0dd17a3e9cad5a7670b7a Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 23 Mar 2016 17:15:10 -0400 Subject: [PATCH] Include newlines in selection --- src/view.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/view.go b/src/view.go index c9b4b3ab..1e54841a 100644 --- a/src/view.go +++ b/src/view.go @@ -424,6 +424,18 @@ func (v *View) Display() { charNum++ x++ } + if v.cursor.HasSelection() && + (charNum >= v.cursor.selectionStart && charNum <= v.cursor.selectionEnd || + charNum <= v.cursor.selectionStart && charNum >= v.cursor.selectionEnd) { + + selectStyle := tcell.StyleDefault.Reverse(true) + + if _, ok := colorscheme["selection"]; ok { + selectStyle = colorscheme["selection"] + } + v.s.SetContent(x+tabchars, lineN, ' ', nil, selectStyle) + } + x = 0 st, ok := v.matches[charNum] if ok {