From 880199011075afd4f2d9bd16c7ce42a04741b5b7 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Fri, 26 Jan 2024 09:09:00 +0100 Subject: Fix clamp not handling negative locations --- src/dged/buffer.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/dged/buffer.c b/src/dged/buffer.c index 733d4a4..89e7dad 100644 --- a/src/dged/buffer.c +++ b/src/dged/buffer.c @@ -579,6 +579,8 @@ struct location buffer_clamp(struct buffer *buffer, int64_t line, int64_t col) { location.line = buffer_num_lines(buffer) - 1; location.col = buffer_num_chars(buffer, location.line); } + } else if (line < 0) { + return location; } else { location.line = line; uint32_t nchars = buffer_num_chars(buffer, location.line); -- cgit v1.2.3