turn on buffer status pane cursor position display again
This commit is contained in:
parent
a39e1d3956
commit
1a34b8d7f7
@ -88,10 +88,11 @@ int BufferPane::rows_in_line(const Buffer::Iterator & start_of_line)
|
|||||||
int BufferPane::rows_in_line_with_iterator_offset(const Buffer::Iterator & start_of_line, const Buffer::Iterator & reference, int * iterator_row_offset)
|
int BufferPane::rows_in_line_with_iterator_offset(const Buffer::Iterator & start_of_line, const Buffer::Iterator & reference, int * iterator_row_offset)
|
||||||
{
|
{
|
||||||
int saved_row_offset = 0;
|
int saved_row_offset = 0;
|
||||||
walk_line(start_of_line, [&saved_row_offset, &reference, &iterator_row_offset](int row_offset, int screen_column, int virtual_column, int character_width, const Buffer::Iterator & i) {
|
walk_line(start_of_line, [this, &saved_row_offset, &reference, &iterator_row_offset](int row_offset, int screen_column, int virtual_column, int character_width, const Buffer::Iterator & i) {
|
||||||
uint32_t code_point = *i;
|
uint32_t code_point = *i;
|
||||||
if (i == reference)
|
if (i == reference)
|
||||||
{
|
{
|
||||||
|
m_cursor_virtual_column = virtual_column;
|
||||||
*iterator_row_offset = row_offset;
|
*iterator_row_offset = row_offset;
|
||||||
}
|
}
|
||||||
if ((code_point != '\n') && (code_point != 0xFFFFFFFFu))
|
if ((code_point != '\n') && (code_point != 0xFFFFFFFFu))
|
||||||
|
@ -15,6 +15,8 @@ public:
|
|||||||
void resize(int width, int height) override;
|
void resize(int width, int height) override;
|
||||||
void draw();
|
void draw();
|
||||||
void handle_key(uint32_t keyval);
|
void handle_key(uint32_t keyval);
|
||||||
|
size_t line() const { return m_iterator->line(); }
|
||||||
|
size_t column() const { return m_cursor_virtual_column; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum class CursorMovement : uint8_t
|
enum class CursorMovement : uint8_t
|
||||||
|
@ -4,9 +4,8 @@ void BufferStatusPane::draw()
|
|||||||
{
|
{
|
||||||
m_gl->draw_rect(win_x(0), win_y(m_font->get_line_height()), m_width, 1, 0.5, 0.5, 0.5, 1.0);
|
m_gl->draw_rect(win_x(0), win_y(m_font->get_line_height()), m_width, 1, 0.5, 0.5, 0.5, 1.0);
|
||||||
m_gl->draw_rect(win_x(0), win_y(0), m_width, m_font->get_line_height(), 0.0, 0.0, 0.0, 1.0);
|
m_gl->draw_rect(win_x(0), win_y(0), m_width, m_font->get_line_height(), 0.0, 0.0, 0.0, 1.0);
|
||||||
#if 0
|
|
||||||
char cursor_position[20];
|
char cursor_position[20];
|
||||||
sprintf(cursor_position, "%zu, %zu", m_buffer_pane->cursor()->line() + 1, m_buffer_pane->cursor()->column() + 1u);
|
sprintf(cursor_position, "%zu, %zu", m_buffer_pane->line() + 1, m_buffer_pane->column() + 1u);
|
||||||
int cursor_position_length = strlen(cursor_position);
|
int cursor_position_length = strlen(cursor_position);
|
||||||
int x = m_width - m_font->get_advance() * cursor_position_length;
|
int x = m_width - m_font->get_advance() * cursor_position_length;
|
||||||
for (int i = 0; i < cursor_position_length; i++)
|
for (int i = 0; i < cursor_position_length; i++)
|
||||||
@ -14,5 +13,4 @@ void BufferStatusPane::draw()
|
|||||||
m_gl->draw_character(win_x(x), win_y(0), cursor_position[i], *m_font);
|
m_gl->draw_character(win_x(x), win_y(0), cursor_position[i], *m_font);
|
||||||
x += m_font->get_advance();
|
x += m_font->get_advance();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user