Remove Range::content
This commit is contained in:
parent
93dd1ff3c7
commit
7f8d5c1fd0
|
@ -129,7 +129,7 @@ std::vector<String> Editor::selections_content() const
|
||||||
{
|
{
|
||||||
std::vector<String> contents;
|
std::vector<String> contents;
|
||||||
for (auto& sel : m_selections)
|
for (auto& sel : m_selections)
|
||||||
contents.push_back(sel.content());
|
contents.push_back(m_buffer->string(sel.min(), utf8::next(sel.max())));
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ void register_env_vars()
|
||||||
{ return to_string(context.buffer().timestamp()); });
|
{ return to_string(context.buffer().timestamp()); });
|
||||||
shell_manager.register_env_var("selection",
|
shell_manager.register_env_var("selection",
|
||||||
[](const String& name, const Context& context)
|
[](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",
|
shell_manager.register_env_var("selections",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context)
|
||||||
{ auto sels = context.editor().selections_content();
|
{ auto sels = context.editor().selections_content();
|
||||||
|
|
|
@ -135,7 +135,8 @@ void goto_commands(Context& context)
|
||||||
}
|
}
|
||||||
case 'f':
|
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' };
|
static constexpr char forbidden[] = { '\'', '\\', '\0' };
|
||||||
for (auto c : forbidden)
|
for (auto c : forbidden)
|
||||||
if (contains(filename, c))
|
if (contains(filename, c))
|
||||||
|
|
|
@ -14,11 +14,6 @@ void Range::merge_with(const Range& range)
|
||||||
m_first = std::max(m_first, range.m_first);
|
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
|
void Range::check_invariant() const
|
||||||
{
|
{
|
||||||
#ifdef KAK_DEBUG
|
#ifdef KAK_DEBUG
|
||||||
|
|
|
@ -29,7 +29,6 @@ public:
|
||||||
const BufferIterator& min() const { return std::min(m_first, m_last); }
|
const BufferIterator& min() const { return std::min(m_first, m_last); }
|
||||||
const BufferIterator& max() const { return std::max(m_first, m_last); }
|
const BufferIterator& max() const { return std::max(m_first, m_last); }
|
||||||
|
|
||||||
String content() const;
|
|
||||||
|
|
||||||
void check_invariant() const;
|
void check_invariant() const;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user