deindent now deindent non completely indented lines
If indent is 4 spaces, and a line has only 3 leading spaces, they will get removed. a-< can be used to avoid this behaviour.
This commit is contained in:
parent
04ae48c346
commit
9a1d50d9a2
|
@ -127,6 +127,10 @@ Changes
|
|||
|
||||
* _>_: indent selected lines
|
||||
* _<_: deindent selected lines
|
||||
* _alt->_: indent selected lines, including empty lines
|
||||
* _<_: deindent selected lines
|
||||
* _alt-<_: deindent selected lines, do not remove incomplete
|
||||
indent (3 leading spaces when indent is 4)
|
||||
|
||||
* _|_: pipe each selections through the given external filter program
|
||||
and replace with it's output.
|
||||
|
|
|
@ -580,6 +580,7 @@ void indent(Context& context, int)
|
|||
editor.insert(indent, InsertMode::Insert);
|
||||
}
|
||||
|
||||
template<bool deindent_incomplete = true>
|
||||
void deindent(Context& context, int)
|
||||
{
|
||||
CharCount tabstop = context.options()["tabstop"].get<int>();
|
||||
|
@ -605,7 +606,11 @@ void deindent(Context& context, int)
|
|||
else if (c == ' ')
|
||||
++width;
|
||||
else
|
||||
{
|
||||
if (deindent_incomplete and width != 0)
|
||||
res.emplace_back(line, BufferCoord{line, column-1});
|
||||
break;
|
||||
}
|
||||
if (width == indent_width)
|
||||
{
|
||||
res.emplace_back(line, BufferCoord{line, column});
|
||||
|
@ -1027,6 +1032,7 @@ KeyMap keymap =
|
|||
{ '<', deindent },
|
||||
{ '>', indent },
|
||||
{ alt('>'), indent<true> },
|
||||
{ alt('<'), deindent<false> },
|
||||
|
||||
{ ctrl('i'), jump<Forward> },
|
||||
{ ctrl('o'), jump<Backward> },
|
||||
|
|
Loading…
Reference in New Issue
Block a user