From b68490ef11734c404f8a18f1babd8004aca2de06 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 18 Dec 2019 11:36:17 +1100 Subject: Cleanup replaced range selection logic Do not access Buffer::m_changes to find the inserted range, return it directly from Buffer::insert and Buffer::replace. This fixes a wrong behaviour where replacing at eof would lose the selected end of line (as the implementation does not actually replace that end of line) --- src/buffer_utils.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer_utils.hh') diff --git a/src/buffer_utils.hh b/src/buffer_utils.hh index 586cbb1d..a3e43068 100644 --- a/src/buffer_utils.hh +++ b/src/buffer_utils.hh @@ -20,7 +20,7 @@ inline BufferCoord erase(Buffer& buffer, const Selection& range) return buffer.erase(range.min(), buffer.char_next(range.max())); } -inline BufferCoord replace(Buffer& buffer, const Selection& range, StringView content) +inline BufferRange replace(Buffer& buffer, const Selection& range, StringView content) { return buffer.replace(range.min(), buffer.char_next(range.max()), content); } -- cgit v1.2.3