diff options
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -244,7 +244,9 @@ static void menu_update(Ted *ted) { char *end; long line_number = strtol(contents, &end, 0); TextBuffer *buffer = ted->prev_active_buffer; - if (line_number > 0 && *end == '\0' && line_number <= (long)buffer->nlines) { + if (*contents != '\0' && *end == '\0') { + if (line_number < 1) line_number = 1; + if (line_number > buffer->nlines) line_number = (long)buffer->nlines; BufferPos pos = {(u32)line_number - 1, 0}; if (line_buffer->line_buffer_submitted) { |