diff options
| -rw-r--r-- | src/dged/buffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dged/buffer.c b/src/dged/buffer.c index c537fb3..84d2f75 100644 --- a/src/dged/buffer.c +++ b/src/dged/buffer.c @@ -788,8 +788,9 @@ struct location buffer_end(struct buffer *buffer) { if (buffer->lazy_row_add) { return (struct location){.line = nlines, .col = 0}; } else { - return (struct location){.line = nlines - 1, - .col = buffer_line_length(buffer, nlines - 1)}; + nlines = nlines == 0 ? 0 : nlines - 1; + return (struct location){.line = nlines, + .col = buffer_line_length(buffer, nlines)}; } } |
