Fix text insertion point not following cursor
Always supply iterator position when inserting code points
This commit is contained in:
1 parent
314b39b81a
commit
a8b39f8884
3 files changed
+19
-28
No files matched your search
@@ -431,7 +431,7 @@ void BufferPane::insert_code_point(uint32_t code_point)
|
||||
code_point = '\n';
|
||||
m_cursor_screen_row++;
|
||||
}
|
||||
m_buffer->insert_code_point(code_point);
|
||||
m_buffer->insert_code_point(*m_iterator, code_point);
|
||||
}
|
||||
m_window->request_redraw();
|
||||
}
|
||||
@@ -573,14 +573,14 @@ void BufferPane::enter_insert_mode(Window::EnterInsertModeMode which)
|
||||
switch (which)
|
||||
{
|
||||
case Window::EnterInsertModeMode::START_OF_CHAR:
|
||||
m_buffer->enter_insert_mode(*m_iterator);
|
||||
m_buffer->enter_insert_mode();
|
||||
break;
|
||||
case Window::EnterInsertModeMode::END_OF_CHAR:
|
||||
if (**m_iterator != '\n')
|
||||
{
|
||||
m_iterator->go_forward();
|
||||
}
|
||||
m_buffer->enter_insert_mode(*m_iterator);
|
||||
m_buffer->enter_insert_mode();
|
||||
break;
|
||||
case Window::EnterInsertModeMode::START_OF_LINE:
|
||||
m_iterator->go_start_of_line();
|
||||
@@ -592,16 +592,16 @@ void BufferPane::enter_insert_mode(Window::EnterInsertModeMode which)
|
||||
break;
|
||||
case Window::EnterInsertModeMode::NEW_LINE_BEFORE:
|
||||
m_iterator->go_start_of_line();
|
||||
m_buffer->enter_insert_mode(*m_iterator);
|
||||
m_buffer->insert_code_point('\n');
|
||||
m_buffer->enter_insert_mode();
|
||||
m_buffer->insert_code_point(*m_iterator, '\n');
|
||||
m_buffer->exit_insert_mode();
|
||||
cursor_move(Window::CursorMovement::UP);
|
||||
enter_insert_mode(Window::EnterInsertModeMode::START_OF_CHAR);
|
||||
break;
|
||||
case Window::EnterInsertModeMode::NEW_LINE_AFTER:
|
||||
m_iterator->go_end_of_line(true);
|
||||
m_buffer->enter_insert_mode(*m_iterator);
|
||||
m_buffer->insert_code_point('\n');
|
||||
m_buffer->enter_insert_mode();
|
||||
m_buffer->insert_code_point(*m_iterator, '\n');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user