From 77d8a2217f9b4fd9cc27e2a8c99852d4ac3c0f6d Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 18 May 2016 09:33:49 -0400 Subject: [PATCH] Fix selection graphics for indentchar --- cmd/micro/view.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 209dc406..f9ba58fa 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -546,8 +546,18 @@ func (v *View) DisplayView() { if style, ok := colorscheme["indent-char"]; ok { lineIndentStyle = style } + if v.Cursor.HasSelection() && + (charNum >= v.Cursor.curSelection[0] && charNum < v.Cursor.curSelection[1] || + charNum < v.Cursor.curSelection[0] && charNum >= v.Cursor.curSelection[1]) { + + lineIndentStyle = tcell.StyleDefault.Reverse(true) + + if style, ok := colorscheme["selection"]; ok { + lineIndentStyle = style + } + } indentChar := []rune(settings["indentchar"].(string)) - screen.SetContent(x+tabchars, lineN, indentChar[0], nil, lineIndentStyle) + screen.SetContent(x-v.leftCol+tabchars, lineN, indentChar[0], nil, lineIndentStyle) tabSize := int(settings["tabsize"].(float64)) for i := 0; i < tabSize-1; i++ { tabchars++