summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-12-15 14:33:09 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-12-15 14:33:09 +0000
commit39b43f4c3cb58c083671f0c4423dcdc79b0dcfed (patch)
tree64198cf4a398059f685fc3af93cb4daf9a897e43 /src/normal.cc
parent935bc3cec9707dcf95d978baa2bd323e22420b02 (diff)
Less uses of Editor, in favor of Context
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 474be405..ec8f32c0 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -140,7 +140,6 @@ void goto_commands(Context& context, int line)
if (key.modifiers != Key::Modifiers::None)
return;
- Editor& editor = context.editor();
switch (tolower(key.key))
{
case 'g':
@@ -157,12 +156,12 @@ void goto_commands(Context& context, int line)
case 'j':
{
context.push_jump();
- select_coord<mode>({editor.buffer().line_count() - 1, 0}, context.selections());
+ select_coord<mode>({context.buffer().line_count() - 1, 0}, context.selections());
break;
}
case 'e':
context.push_jump();
- select_coord<mode>(editor.buffer().back_coord(), context.selections());
+ select_coord<mode>(context.buffer().back_coord(), context.selections());
break;
case 't':
if (context.has_window())
@@ -285,7 +284,7 @@ void replace_with_char(Context& context, int)
Editor& editor = context.editor();
SelectionList sels = context.selections();
auto restore_sels = on_scope_end([&]{ context.selections() = std::move(sels); });
- select_all_matches(editor.buffer(), context.selections(), Regex{"."});
+ select_all_matches(context.buffer(), context.selections(), Regex{"."});
editor.insert(codepoint_to_str(key.key), InsertMode::Replace);
}, "replace with char", "enter char to replace with\n");
}
@@ -603,8 +602,7 @@ void join_select_spaces(Context& context, int)
void join(Context& context, int param)
{
- Editor& editor = context.editor();
- DynamicSelectionList sels{editor.buffer(), context.selections()};
+ DynamicSelectionList sels{context.buffer(), context.selections()};
auto restore_sels = on_scope_end([&]{ context.selections() = std::move(sels); });
join_select_spaces(context, param);
}
@@ -638,7 +636,7 @@ void indent(Context& context, int)
auto& editor = context.editor();
auto& buffer = context.buffer();
- DynamicSelectionList sels{editor.buffer(), context.selections()};
+ DynamicSelectionList sels{context.buffer(), context.selections()};
auto restore_sels = on_scope_end([&]{ context.selections() = std::move(sels); });
SelectionList res;
for (auto& sel : context.selections())
@@ -663,7 +661,7 @@ void deindent(Context& context, int)
auto& editor = context.editor();
auto& buffer = context.buffer();
- DynamicSelectionList sels{editor.buffer(), context.selections()};
+ DynamicSelectionList sels{context.buffer(), context.selections()};
auto restore_sels = on_scope_end([&]{ context.selections() = std::move(sels); });
SelectionList res;