summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-05-27 14:22:21 +0200
committerMaxime Coste <frrrwww@gmail.com>2013-05-30 13:59:38 +0200
commit7f8d5c1fd0808e7151f5465ede8a5548f05b2f6f (patch)
treec0714c9e97d921a7bb7565a3f2a11fc063fcf3f1 /src
parent93dd1ff3c7008c82b3db1263de5548c3f3b48f57 (diff)
Remove Range::content
Diffstat (limited to 'src')
-rw-r--r--src/editor.cc2
-rw-r--r--src/main.cc3
-rw-r--r--src/normal.cc3
-rw-r--r--src/selection.cc5
-rw-r--r--src/selection.hh1
5 files changed, 5 insertions, 9 deletions
diff --git a/src/editor.cc b/src/editor.cc
index afdbafef..5ccb7889 100644
--- a/src/editor.cc
+++ b/src/editor.cc
@@ -129,7 +129,7 @@ std::vector<String> Editor::selections_content() const
{
std::vector<String> contents;
for (auto& sel : m_selections)
- contents.push_back(sel.content());
+ contents.push_back(m_buffer->string(sel.min(), utf8::next(sel.max())));
return contents;
}
diff --git a/src/main.cc b/src/main.cc
index 752374ac..fc196564 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -67,7 +67,8 @@ void register_env_vars()
{ return to_string(context.buffer().timestamp()); });
shell_manager.register_env_var("selection",
[](const String& name, const Context& context)
- { return context.editor().main_selection().content(); });
+ { const Range& sel = context.editor().main_selection();
+ return context.buffer().string(sel.min(), utf8::next(sel.max())); });
shell_manager.register_env_var("selections",
[](const String& name, const Context& context)
{ auto sels = context.editor().selections_content();
diff --git a/src/normal.cc b/src/normal.cc
index 3506e4fa..f09900db 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -135,7 +135,8 @@ void goto_commands(Context& context)
}
case 'f':
{
- String filename = context.editor().main_selection().content();
+ const Range& sel = context.editor().main_selection();
+ String filename = context.buffer().string(sel.min(), utf8::next(sel.max()));
static constexpr char forbidden[] = { '\'', '\\', '\0' };
for (auto c : forbidden)
if (contains(filename, c))
diff --git a/src/selection.cc b/src/selection.cc
index d616aa8b..60ebe441 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -14,11 +14,6 @@ void Range::merge_with(const Range& range)
m_first = std::max(m_first, range.m_first);
}
-String Range::content() const
-{
- return m_first.buffer().string(min(), utf8::next(max()));
-}
-
void Range::check_invariant() const
{
#ifdef KAK_DEBUG
diff --git a/src/selection.hh b/src/selection.hh
index d7fb8f6b..7f7e3db9 100644
--- a/src/selection.hh
+++ b/src/selection.hh
@@ -29,7 +29,6 @@ public:
const BufferIterator& min() const { return std::min(m_first, m_last); }
const BufferIterator& max() const { return std::max(m_first, m_last); }
- String content() const;
void check_invariant() const;
private: