From 0b47502e62464db8fb2e17b3d338f52bb3dde83e Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 6 Jan 2018 16:04:18 -0500 Subject: [PATCH] Fix minor issue with indent/outdent selection Fixes #984 --- cmd/micro/actions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 4a9b5a7b..3a9ded10 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -811,13 +811,15 @@ func (v *View) IndentSelection(usePlugin bool) bool { end := v.Cursor.CurSelection[1] if end.Y < start.Y { start, end = end, start + v.Cursor.SetSelectionStart(start) + v.Cursor.SetSelectionEnd(end) } startY := start.Y endY := end.Move(-1, v.Buf).Y endX := end.Move(-1, v.Buf).X + tabsize := len(v.Buf.IndentString()) for y := startY; y <= endY; y++ { - tabsize := len(v.Buf.IndentString()) v.Buf.Insert(Loc{0, y}, v.Buf.IndentString()) if y == startY && start.X > 0 { v.Cursor.SetSelectionStart(start.Move(tabsize, v.Buf)) @@ -871,6 +873,8 @@ func (v *View) OutdentSelection(usePlugin bool) bool { end := v.Cursor.CurSelection[1] if end.Y < start.Y { start, end = end, start + v.Cursor.SetSelectionStart(start) + v.Cursor.SetSelectionEnd(end) } startY := start.Y