parent
c6508ee101
commit
ad9ad7e603
|
@ -186,11 +186,10 @@ BufferCoord Buffer::offset_coord(BufferCoord coord, CharCount offset, ColumnCoun
|
||||||
|
|
||||||
BufferCoordAndTarget Buffer::offset_coord(BufferCoordAndTarget coord, LineCount offset, ColumnCount tabstop)
|
BufferCoordAndTarget Buffer::offset_coord(BufferCoordAndTarget coord, LineCount offset, ColumnCount tabstop)
|
||||||
{
|
{
|
||||||
auto column = coord.target == -1 ? get_column(*this, tabstop, coord) : coord.target;
|
const auto column = coord.target == -1 ? get_column(*this, tabstop, coord) : coord.target;
|
||||||
auto line = Kakoune::clamp(coord.line + offset, 0_line, line_count()-1);
|
const auto line = Kakoune::clamp(coord.line + offset, 0_line, line_count()-1);
|
||||||
StringView content = m_lines[line];
|
const auto max_column = get_column(*this, tabstop, {line, m_lines[line].length()-1});
|
||||||
|
const auto final_column = std::max(0_col, std::min(column, max_column - 1));
|
||||||
auto final_column = std::max(0_col, std::min(column, content.column_length() - 2));
|
|
||||||
return {line, get_byte_to_column(*this, tabstop, {line, final_column}), column};
|
return {line, get_byte_to_column(*this, tabstop, {line, final_column}), column};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user