summaryrefslogtreecommitdiff
path: root/src/context.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-14 00:59:36 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-14 19:49:04 +0100
commitbf98b38afd5338f6be617cfaf4bb251eb011e2b0 (patch)
tree7832efaa75e4a6da23d57cf2672d60ce59c779d7 /src/context.cc
parentdb423e4a88be8799ce0cfae33ddbf4c6bae97e5f (diff)
Use a plain SelectionList for Context, remove DynamicSelectionList
Diffstat (limited to 'src/context.cc')
-rw-r--r--src/context.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/context.cc b/src/context.cc
index 9dcc87e4..e909f1f5 100644
--- a/src/context.cc
+++ b/src/context.cc
@@ -21,7 +21,7 @@ Buffer& Context::buffer() const
{
if (not has_buffer())
throw runtime_error("no buffer in context");
- return (*m_selections).registry();
+ return const_cast<Buffer&>((*m_selections).buffer());
}
Window& Context::window() const
@@ -175,7 +175,7 @@ void Context::change_buffer(Buffer& buffer)
if (has_client())
client().change_buffer(buffer);
else
- m_selections = DynamicSelectionList{ { buffer, Selection{} } };
+ m_selections = SelectionList{buffer, Selection{}};
if (has_input_handler())
input_handler().reset_normal_mode();
}
@@ -184,14 +184,13 @@ SelectionList& Context::selections()
{
if (not m_selections)
throw runtime_error("no selections in context");
+ (*m_selections).update();
return *m_selections;
}
const SelectionList& Context::selections() const
{
- if (not m_selections)
- throw runtime_error("no selections in context");
- return *m_selections;
+ return const_cast<Context&>(*this).selections();
}
std::vector<String> Context::selections_content() const