avoid_eol: use direct line access
This commit is contained in:
parent
58ff97d51d
commit
12d3b64a1b
|
@ -23,8 +23,9 @@ Editor::Editor(Buffer& buffer)
|
||||||
static void avoid_eol(const Buffer& buffer, BufferCoord& coord)
|
static void avoid_eol(const Buffer& buffer, BufferCoord& coord)
|
||||||
{
|
{
|
||||||
const auto column = coord.column;
|
const auto column = coord.column;
|
||||||
if (column != 0 and column == buffer[coord.line].length() - 1)
|
const auto& line = buffer[coord.line];
|
||||||
coord = buffer.char_prev(coord);
|
if (column != 0 and column == line.length() - 1)
|
||||||
|
coord.column = line.byte_count_to(line.char_length() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void avoid_eol(const Buffer& buffer, Range& sel)
|
static void avoid_eol(const Buffer& buffer, Range& sel)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user