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 ?
|
||||
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())
|
||||
context.window().center_selection();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
void keep_selection(int index);
|
||||
void remove_selection(int index);
|
||||
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,
|
||||
SelectMode mode = SelectMode::Replace);
|
||||
void select(const Selector& selector,
|
||||
|
|
|
@ -80,7 +80,7 @@ void goto_commands(Context& context)
|
|||
case 'g':
|
||||
case 'k':
|
||||
context.push_jump();
|
||||
editor.select(editor.buffer().begin(), mode);
|
||||
editor.select(BufferCoord{0,0}, mode);
|
||||
break;
|
||||
case 'l':
|
||||
editor.select(select_to_eol, mode);
|
||||
|
@ -91,8 +91,7 @@ void goto_commands(Context& context)
|
|||
case 'j':
|
||||
{
|
||||
context.push_jump();
|
||||
const Buffer& buf = editor.buffer();
|
||||
editor.select(buf.iterator_at(buf.line_count() - 1), mode);
|
||||
editor.select(editor.buffer().line_count() - 1, mode);
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
|
@ -103,7 +102,7 @@ void goto_commands(Context& context)
|
|||
if (context.has_window())
|
||||
{
|
||||
auto line = context.window().position().line;
|
||||
editor.select(editor.buffer().iterator_at(line), mode);
|
||||
editor.select(line, mode);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
|
@ -111,7 +110,7 @@ void goto_commands(Context& context)
|
|||
{
|
||||
auto& window = context.window();
|
||||
auto line = window.position().line + window.dimensions().line - 1;
|
||||
editor.select(editor.buffer().iterator_at(line), mode);
|
||||
editor.select(line, mode);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
|
@ -119,7 +118,7 @@ void goto_commands(Context& context)
|
|||
{
|
||||
auto& window = context.window();
|
||||
auto line = window.position().line + window.dimensions().line / 2;
|
||||
editor.select(editor.buffer().iterator_at(line), mode);
|
||||
editor.select(line, mode);
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
|
|
Loading…
Reference in New Issue
Block a user