diff --git a/src/winio.c b/src/winio.c index 4330814bf5111a8e8e11ebd788f0fb04859d44e2..73c367c0be4fda0549182bd5596cc542b6561443 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2269,10 +2269,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int assert(strlenpt(converted) <= editwincols); #ifdef ENABLE_LINENUMBERS - if (ISSET(LINE_NUMBERS)) { + int needed_margin = digits(openfile->filebot->lineno) + 1; + + if (ISSET(LINE_NUMBERS) && needed_margin < COLS - 3) { /* If the line numbers now require more room, schedule a refresh. */ - if (digits(openfile->filebot->lineno) + 1 != margin) { - margin = digits(openfile->filebot->lineno) + 1; + if (needed_margin != margin) { + margin = needed_margin; editwincols = COLS - margin; refresh_needed = TRUE; }