screen: suppress line numbers when the terminal is very narrow

To prevent the display from getting messed up, making nano unusable.
master
Benno Schulenberg 2016-10-20 16:37:56 +02:00
parent de2aa4f24a
commit 4d996e4c39
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}