From ff1e736afe32d919aab8923831932cd503352900 Mon Sep 17 00:00:00 2001 From: nosami Date: Wed, 18 Sep 2019 06:21:46 +0100 Subject: [PATCH] Fix = formatting. Fixes #263 --- XSVim/Properties/AssemblyInfo.fs | 2 +- XSVim/XSVim.fs | 23 +++++------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/XSVim/Properties/AssemblyInfo.fs b/XSVim/Properties/AssemblyInfo.fs index aafc432..677d56f 100644 --- a/XSVim/Properties/AssemblyInfo.fs +++ b/XSVim/Properties/AssemblyInfo.fs @@ -5,7 +5,7 @@ open System.Runtime.CompilerServices [] module AddinVersion = [] - let version = "0.65.10.81" + let version = "0.65.11.81" [] diff --git a/XSVim/XSVim.fs b/XSVim/XSVim.fs index 5c5429d..b03c326 100755 --- a/XSVim/XSVim.fs +++ b/XSVim/XSVim.fs @@ -971,24 +971,11 @@ module Vim = vimState | EqualIndent -> // Always work top to bottom - let start, finish = min start finish, max start finish - let finish = - if editor.[finish-1] = '\n' then - finish - 1 - else - finish - let startLine = editor.GetLineByOffset(start) - let endLine = editor.GetLineByOffset(finish).LineNumber - - for line in [startLine.LineNumber..endLine] do - let currentIndent = editor.GetLineIndent (line) - let newIndent = editor.IndentationTracker.GetIndentationString(line-1) - editor.ReplaceText(editor.GetLine(line).Offset, currentIndent.Length, newIndent) - - editor.CaretOffset <- - let startLine = editor.GetLineByOffset(start) - startLine.Offset + editor.GetLineIndent(startLine).Length - vimState + setSelection vimState editor command start finish + dispatchCommand CodeFormatting.CodeFormattingCommands.FormatBuffer + editor.ClearSelection() + EditActions.MoveCaretToLineStart editor + processCommands config 1 vimState (runOnce Move StartOfLine) false | Substitute -> let newState = delete vimState start finish switchToInsertMode editor newState isInitial