adjust cursor movement to optionally allow moving to EOL
This commit is contained in:
1 parent
4ebe81c062
commit
261cc9abf8
4 files changed
+24
-15
No files matched your search
+7
-7
@@ -300,7 +300,7 @@ void Window::cursor_move(int which)
|
||||
m_target_column = m_cursor->column;
|
||||
break;
|
||||
case CURSOR_RIGHT:
|
||||
moved = m_cursor->go_right(1);
|
||||
moved = m_cursor->go_right(1, false);
|
||||
m_target_column = m_cursor->column;
|
||||
break;
|
||||
case CURSOR_UP:
|
||||
@@ -314,7 +314,7 @@ void Window::cursor_move(int which)
|
||||
m_target_column = 0u;
|
||||
break;
|
||||
case CURSOR_EOL:
|
||||
moved = m_cursor->go_end_of_line();
|
||||
moved = m_cursor->go_end_of_line(false);
|
||||
m_target_column = 0x7FFFFFFFu;
|
||||
break;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void Window::cursor_move(int which)
|
||||
case CURSOR_UP:
|
||||
{
|
||||
PieceTable::Cursor c = *m_cursor;
|
||||
c.go_end_of_line();
|
||||
c.go_end_of_line(false);
|
||||
row_offset = m_cursor->column / m_columns - c.column / m_columns - 1 - current_row_offset;
|
||||
}
|
||||
break;
|
||||
@@ -337,7 +337,7 @@ void Window::cursor_move(int which)
|
||||
{
|
||||
PieceTable::Cursor c = *m_cursor;
|
||||
c.go_up(1, 0u);
|
||||
c.go_end_of_line();
|
||||
c.go_end_of_line(false);
|
||||
row_offset = c.column / m_columns - current_row_offset + 1 + m_cursor->column / m_columns;
|
||||
}
|
||||
break;
|
||||
@@ -347,7 +347,7 @@ void Window::cursor_move(int which)
|
||||
case CURSOR_EOL:
|
||||
{
|
||||
PieceTable::Cursor c = *m_cursor;
|
||||
c.go_end_of_line();
|
||||
c.go_end_of_line(false);
|
||||
row_offset = c.column / m_columns - current_row_offset;
|
||||
}
|
||||
break;
|
||||
@@ -373,7 +373,7 @@ std::pair<int, PieceTable::Cursor> Window::calculate_start_position()
|
||||
if (cursor.go_up(1, 0u))
|
||||
{
|
||||
PieceTable::Cursor c = cursor;
|
||||
c.go_end_of_line();
|
||||
c.go_end_of_line(false);
|
||||
row -= c.column / m_columns + 1;
|
||||
}
|
||||
else
|
||||
@@ -424,7 +424,7 @@ void Window::draw_buffer()
|
||||
(character != '\t'))
|
||||
draw_buffer_character(screen_column, screen_row, character);
|
||||
}
|
||||
if (!cursor.go_right(1))
|
||||
if (!cursor.go_right(1, false))
|
||||
{
|
||||
bool last_row = !cursor.go_down(1, 0);
|
||||
if (last_vertical_crosshair_row < row)
|
||||
|
||||
Reference in new issue
Block a user