Fix cursor go_up()/go_down(), turn on unit tests

This commit is contained in:
josh committed 2016-11-07 22:42:54 -05:00
1 parent 5c9f7a7645
commit abb11a0b8c
4 files changed
+34 -11

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ class Buffer
public:
Buffer(const char * filename = nullptr);
bool write_to_file(const char * filename);
auto add_cursor() { return m_gap_buffer->add_cursor(); }
protected:
bool m_eol_at_eof;
+2
View File
@@ -223,6 +223,7 @@ bool GapBuffer::Cursor::go_up(size_t target_column)
c2.go_start_of_line();
*this = c2;
m_line--;
m_column = 0u;
forward_to_column(target_column);
return true;
}
@@ -237,6 +238,7 @@ bool GapBuffer::Cursor::go_down(size_t target_column)
}
*this = c2;
m_line++;
m_column = 0u;
forward_to_column(target_column);
return true;
}
+2
View File
@@ -76,6 +76,8 @@ public:
uint32_t operator*() const { return *m_iterator; }
uint8_t * address() const { return m_iterator.address(); }
bool valid() const { return m_iterator.valid(); }
size_t line() const { return m_line; }
size_t column() const { return m_column; }
protected:
Iterator m_iterator;