From 0b310b64adc770f0f2688d4b0d8ee30e740d7582 Mon Sep 17 00:00:00 2001 From: Delapouite Date: Thu, 21 Sep 2017 12:26:22 +0200 Subject: [PATCH] Add count support for indent / deindent --- src/normal.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 6fad0772..df6e686f 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1027,10 +1027,11 @@ void keep_pipe(Context& context, NormalParams) }); } template -void indent(Context& context, NormalParams) +void indent(Context& context, NormalParams params) { + CharCount count = params.count ? params.count : 1; CharCount indent_width = context.options()["indentwidth"].get(); - String indent = indent_width == 0 ? "\t" : String{' ', indent_width}; + String indent = indent_width == 0 ? String{'\t', count} : String{' ', indent_width * count}; auto& buffer = context.buffer(); Vector sels; @@ -1054,12 +1055,14 @@ void indent(Context& context, NormalParams) } template -void deindent(Context& context, NormalParams) +void deindent(Context& context, NormalParams params) { + ColumnCount count = params.count ? params.count : 1; ColumnCount tabstop = context.options()["tabstop"].get(); ColumnCount indent_width = context.options()["indentwidth"].get(); if (indent_width == 0) indent_width = tabstop; + indent_width = indent_width * count; auto& buffer = context.buffer(); Vector sels;