From 0558de12c6b35d369a12e584f0316d2e3e77c168 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sun, 11 Dec 2016 23:01:10 +1100 Subject: [PATCH 1/2] Added removewhitespaces setting --- cmd/micro/actions.go | 3 ++- cmd/micro/settings.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 8b31b0ab..1d48f95c 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -463,7 +463,8 @@ func (v *View) InsertNewline(usePlugin bool) bool { v.Cursor.Right() } - if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) { + // Remove the whitespaces if removewhitespaces setting is on + if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) && v.Buf.Settings["removewhitespaces"].(bool) { line := v.Buf.Line(v.Cursor.Y - 1) v.Buf.Remove(Loc{0, v.Cursor.Y - 1}, Loc{Count(line), v.Cursor.Y - 1}) } diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index 648858c3..a32e6427 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -176,6 +176,7 @@ func GetOption(name string) interface{} { func DefaultGlobalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, + "removewhitespaces": true, "autosave": false, "colorcolumn": float64(0), "colorscheme": "default", @@ -208,6 +209,7 @@ func DefaultGlobalSettings() map[string]interface{} { func DefaultLocalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, + "removewhitespaces": true, "autosave": false, "colorcolumn": float64(0), "cursorline": true, From a311e071062f08f27d58c998f101f5627ba78569 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Fri, 23 Dec 2016 09:44:57 +1100 Subject: [PATCH 2/2] Changed removewhitespaces setting to keepautoindent --- cmd/micro/actions.go | 4 ++-- cmd/micro/settings.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 1d48f95c..3da1bc7e 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -463,8 +463,8 @@ func (v *View) InsertNewline(usePlugin bool) bool { v.Cursor.Right() } - // Remove the whitespaces if removewhitespaces setting is on - if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) && v.Buf.Settings["removewhitespaces"].(bool) { + // Remove the whitespaces if keepautoindent setting is off + if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) && !v.Buf.Settings["keepautoindent"].(bool) { line := v.Buf.Line(v.Cursor.Y - 1) v.Buf.Remove(Loc{0, v.Cursor.Y - 1}, Loc{Count(line), v.Cursor.Y - 1}) } diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index a32e6427..09f052d5 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -176,7 +176,7 @@ func GetOption(name string) interface{} { func DefaultGlobalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, - "removewhitespaces": true, + "keepautoindent": false, "autosave": false, "colorcolumn": float64(0), "colorscheme": "default", @@ -209,7 +209,7 @@ func DefaultGlobalSettings() map[string]interface{} { func DefaultLocalSettings() map[string]interface{} { return map[string]interface{}{ "autoindent": true, - "removewhitespaces": true, + "keepautoindent": false, "autosave": false, "colorcolumn": float64(0), "cursorline": true,