From 00089a7c01d7e7f348f667e834a7d15a9366e757 Mon Sep 17 00:00:00 2001 From: xDShot Date: Wed, 31 Aug 2016 12:06:46 +0300 Subject: [PATCH 1/2] Update ini.micro --- runtime/syntax/ini.micro | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/ini.micro b/runtime/syntax/ini.micro index 26daea39..edc26251 100644 --- a/runtime/syntax/ini.micro +++ b/runtime/syntax/ini.micro @@ -1,11 +1,9 @@ syntax "ini" "\.(ini|desktop|lfl|override)$" "(mimeapps\.list|pinforc|setup\.cfg)$" "weechat/.+\.conf$" header "^\[[A-Za-z]+\]$" -color brightcyan "\<(true|false)\>" -color cyan "^[[:space:]]*[^=]*=" -color brightmagenta "^[[:space:]]*\[.*\]$" -color red "[=;]" -color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'" -color brightblack "(^|[[:space:]])#([^{].*)?$" -color ,green "[[:space:]]+$" -color ,red " + +| + +" +color constant "\b(true|false)\b" +color identifier "^[[:space:]]*[^=]*=" +color special "^[[:space:]]*\[.*\]$" +color statement "[=;]" +color comment "(^|[[:space:]])#([^{].*)?$" +color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'" From 59d2fa81dda74621f79e091a0a8473a384f88d16 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 31 Aug 2016 08:51:24 -0400 Subject: [PATCH 2/2] Unselect for cursor movement actions Fixes #250 --- cmd/micro/actions.go | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 249c6f2c..e1b66c90 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -44,6 +44,15 @@ func PostActionCall(funcName string, view *View) bool { return relocate } +func (v *View) deselect(index int) bool { + if v.Cursor.HasSelection() { + v.Cursor.Loc = v.Cursor.CurSelection[index] + v.Cursor.ResetSelection() + return true + } + return false +} + // Center centers the view on the cursor func (v *View) Center(usePlugin bool) bool { if usePlugin && !PreActionCall("Center", v) { @@ -70,10 +79,7 @@ func (v *View) CursorUp(usePlugin bool) bool { return false } - if v.Cursor.HasSelection() { - v.Cursor.Loc = v.Cursor.CurSelection[0] - v.Cursor.ResetSelection() - } + v.deselect(0) v.Cursor.Up() if usePlugin { @@ -88,10 +94,7 @@ func (v *View) CursorDown(usePlugin bool) bool { return false } - if v.Cursor.HasSelection() { - v.Cursor.Loc = v.Cursor.CurSelection[1] - v.Cursor.ResetSelection() - } + v.deselect(1) v.Cursor.Down() if usePlugin { @@ -290,6 +293,8 @@ func (v *View) StartOfLine(usePlugin bool) bool { return false } + v.deselect(0) + v.Cursor.Start() if usePlugin { @@ -304,6 +309,8 @@ func (v *View) EndOfLine(usePlugin bool) bool { return false } + v.deselect(0) + v.Cursor.End() if usePlugin { @@ -369,6 +376,8 @@ func (v *View) CursorEnd(usePlugin bool) bool { return false } + v.deselect(0) + v.Cursor.Loc = v.Buf.End() if usePlugin { @@ -1089,6 +1098,8 @@ func (v *View) CursorPageUp(usePlugin bool) bool { return false } + v.deselect(0) + if v.Cursor.HasSelection() { v.Cursor.Loc = v.Cursor.CurSelection[0] v.Cursor.ResetSelection() @@ -1107,6 +1118,8 @@ func (v *View) CursorPageDown(usePlugin bool) bool { return false } + v.deselect(0) + if v.Cursor.HasSelection() { v.Cursor.Loc = v.Cursor.CurSelection[1] v.Cursor.ResetSelection()