Remove Cursor and move line-tracking into Iterator
This commit is contained in:
1 parent
39088f6518
commit
968db413e6
8 files changed
+212
-261
No files matched your search
@@ -5,7 +5,9 @@ BufferPane::BufferPane(Window * window, std::shared_ptr<Buffer> buffer)
|
||||
{
|
||||
m_cursor_row = 0;
|
||||
m_scroll_offset = 5;
|
||||
#if 0
|
||||
m_cursor = buffer->add_cursor();
|
||||
#endif
|
||||
}
|
||||
|
||||
void BufferPane::resize(int width, int height)
|
||||
@@ -15,6 +17,7 @@ void BufferPane::resize(int width, int height)
|
||||
m_rows = std::max(1, (m_height + m_window->font()->get_line_height() - 1) / m_window->font()->get_line_height());
|
||||
}
|
||||
|
||||
#if 0
|
||||
void BufferPane::update_cursor_row()
|
||||
{
|
||||
int so = effective_scroll_offset();
|
||||
@@ -51,9 +54,11 @@ int BufferPane::screen_rows_above_cursor(int stop_at)
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
#endif
|
||||
|
||||
void BufferPane::draw()
|
||||
{
|
||||
#if 0
|
||||
if (m_cursor->valid())
|
||||
{
|
||||
update_cursor_row();
|
||||
@@ -81,8 +86,10 @@ void BufferPane::draw()
|
||||
{
|
||||
draw_cursor(col_x(0), row_y(0), false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
void BufferPane::draw_buffer_line(int screen_row, const Buffer::Cursor & cursor)
|
||||
{
|
||||
Buffer::Cursor iter_cursor = cursor;
|
||||
@@ -121,6 +128,7 @@ void BufferPane::draw_cursor(int x, int y, bool insert_mode)
|
||||
int height = m_window->font()->get_line_height();
|
||||
m_window->gl()->draw_rect(win_x(x), win_y(y), width, height, 1.0, 0.2, 1.0, 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BufferPane::handle_key(uint32_t keyval)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ public:
|
||||
BufferPane(Window * window, std::shared_ptr<Buffer> buffer);
|
||||
void resize(int width, int height) override;
|
||||
void draw();
|
||||
std::shared_ptr<Buffer::Cursor> cursor() { return m_cursor; }
|
||||
void handle_key(uint32_t keyval);
|
||||
|
||||
protected:
|
||||
@@ -28,6 +27,7 @@ protected:
|
||||
EOL,
|
||||
};
|
||||
|
||||
#if 0
|
||||
int effective_scroll_offset()
|
||||
{
|
||||
return std::min(m_scroll_offset, (m_rows - 1) / 2);
|
||||
@@ -38,6 +38,7 @@ protected:
|
||||
void draw_buffer_line(int screen_row, const Buffer::Cursor & cursor);
|
||||
void draw_buffer_character(int screen_column, int screen_row, uint32_t character);
|
||||
void draw_cursor(int x, int y, bool insert_mode);
|
||||
#endif
|
||||
int col_x(int col)
|
||||
{
|
||||
return col * m_window->font()->get_advance();
|
||||
@@ -54,7 +55,9 @@ protected:
|
||||
int m_columns;
|
||||
int m_scroll_offset;
|
||||
int m_cursor_row;
|
||||
#if 0
|
||||
std::shared_ptr<Buffer::Cursor> m_cursor;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@ 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(0), m_width, m_font->get_line_height(), 0.0, 0.0, 0.0, 1.0);
|
||||
#if 0
|
||||
char cursor_position[20];
|
||||
sprintf(cursor_position, "%zu, %zu", m_buffer_pane->cursor()->line() + 1, m_buffer_pane->cursor()->column() + 1u);
|
||||
int cursor_position_length = strlen(cursor_position);
|
||||
@@ -13,4 +14,5 @@ void BufferStatusPane::draw()
|
||||
m_gl->draw_character(win_x(x), win_y(0), cursor_position[i], *m_font);
|
||||
x += m_font->get_advance();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user