remove useless iterator_at calls
This commit is contained in:
parent
c4f9253634
commit
76f55f5256
|
@ -129,7 +129,7 @@ void edit(const CommandParameters& params, Context& context)
|
||||||
int column = param_count > 2 ?
|
int column = param_count > 2 ?
|
||||||
std::max(0, str_to_int(parser[2]) - 1) : 0;
|
std::max(0, str_to_int(parser[2]) - 1) : 0;
|
||||||
|
|
||||||
context.editor().select(context.buffer().iterator_at({ line, column }));
|
context.editor().select(context.buffer().clamp({ line, column }));
|
||||||
if (context.has_window())
|
if (context.has_window())
|
||||||
context.window().center_selection();
|
context.window().center_selection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
void keep_selection(int index);
|
void keep_selection(int index);
|
||||||
void remove_selection(int index);
|
void remove_selection(int index);
|
||||||
void select(const BufferCoord& c, SelectMode mode = SelectMode::Replace)
|
void select(const BufferCoord& c, SelectMode mode = SelectMode::Replace)
|
||||||
{ auto it = m_buffer->iterator_at(c); select(Selection{ it, it }, mode); }
|
{ select(Selection{ c, c }, mode); }
|
||||||
void select(const Selection& sel,
|
void select(const Selection& sel,
|
||||||
SelectMode mode = SelectMode::Replace);
|
SelectMode mode = SelectMode::Replace);
|
||||||
void select(const Selector& selector,
|
void select(const Selector& selector,
|
||||||
|
|
|
@ -80,7 +80,7 @@ void goto_commands(Context& context)
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'k':
|
case 'k':
|
||||||
context.push_jump();
|
context.push_jump();
|
||||||
editor.select(editor.buffer().begin(), mode);
|
editor.select(BufferCoord{0,0}, mode);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
editor.select(select_to_eol, mode);
|
editor.select(select_to_eol, mode);
|
||||||
|
@ -91,8 +91,7 @@ void goto_commands(Context& context)
|
||||||
case 'j':
|
case 'j':
|
||||||
{
|
{
|
||||||
context.push_jump();
|
context.push_jump();
|
||||||
const Buffer& buf = editor.buffer();
|
editor.select(editor.buffer().line_count() - 1, mode);
|
||||||
editor.select(buf.iterator_at(buf.line_count() - 1), mode);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'e':
|
case 'e':
|
||||||
|
@ -103,7 +102,7 @@ void goto_commands(Context& context)
|
||||||
if (context.has_window())
|
if (context.has_window())
|
||||||
{
|
{
|
||||||
auto line = context.window().position().line;
|
auto line = context.window().position().line;
|
||||||
editor.select(editor.buffer().iterator_at(line), mode);
|
editor.select(line, mode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -111,7 +110,7 @@ void goto_commands(Context& context)
|
||||||
{
|
{
|
||||||
auto& window = context.window();
|
auto& window = context.window();
|
||||||
auto line = window.position().line + window.dimensions().line - 1;
|
auto line = window.position().line + window.dimensions().line - 1;
|
||||||
editor.select(editor.buffer().iterator_at(line), mode);
|
editor.select(line, mode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -119,7 +118,7 @@ void goto_commands(Context& context)
|
||||||
{
|
{
|
||||||
auto& window = context.window();
|
auto& window = context.window();
|
||||||
auto line = window.position().line + window.dimensions().line / 2;
|
auto line = window.position().line + window.dimensions().line / 2;
|
||||||
editor.select(editor.buffer().iterator_at(line), mode);
|
editor.select(line, mode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user