From 8df75f5ab00edff5b30ec2b6dca9992eae81b4fe Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 28 Dec 2016 13:24:52 -0500 Subject: [PATCH] add Buffer::Iterator::INVALID_CODE_POINT constant --- src/core/Buffer.h | 7 ++++++- src/gui/BufferPane.cc | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/Buffer.h b/src/core/Buffer.h index f1ac5d1..0f0b6a6 100644 --- a/src/core/Buffer.h +++ b/src/core/Buffer.h @@ -14,6 +14,11 @@ public: class Iterator { public: + enum : uint32_t + { + INVALID_CODE_POINT = 0xFFFFFFFFu, + }; + Iterator(Buffer * buffer) { m_buffer = buffer; @@ -51,7 +56,7 @@ public: } else { - return 0xFFFFFFFFu; + return INVALID_CODE_POINT; } } bool operator==(const Iterator & other) const diff --git a/src/gui/BufferPane.cc b/src/gui/BufferPane.cc index 4aaf5df..9642f4e 100644 --- a/src/gui/BufferPane.cc +++ b/src/gui/BufferPane.cc @@ -79,7 +79,7 @@ int BufferPane::rows_in_line(const Buffer::Iterator & start_of_line) int saved_row_offset = 0; walk_line(start_of_line, [&saved_row_offset](int row_offset, int screen_column, int virtual_column, int character_width, const Buffer::Iterator & i) { uint32_t code_point = *i; - if ((code_point != '\n') && (code_point != 0xFFFFFFFFu)) + if ((code_point != '\n') && (code_point != Buffer::Iterator::INVALID_CODE_POINT)) { saved_row_offset = row_offset; } @@ -97,7 +97,7 @@ int BufferPane::rows_in_line_with_iterator_offset(const Buffer::Iterator & start m_cursor_virtual_column = virtual_column; *iterator_row_offset = row_offset; } - if ((code_point != '\n') && (code_point != 0xFFFFFFFFu)) + if ((code_point != '\n') && (code_point != Buffer::Iterator::INVALID_CODE_POINT)) { saved_row_offset = row_offset; } @@ -226,7 +226,7 @@ int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_ /* TODO: highlight multi-column characters */ draw_cursor(x, y, m_buffer->insert_mode()); } - if ((code_point == '\n') || (code_point == 0xFFFFFFFFu)) + if ((code_point == '\n') || (code_point == Buffer::Iterator::INVALID_CODE_POINT)) { } else