From ceb19957330ed7478df475b3b03f5950b2b8bf31 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 24 Jul 2010 02:02:14 +0200 Subject: [PATCH] Add fallback backspace in case tgetstr("le") fails. --- src/editline.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/editline.c b/src/editline.c index 1cf62e6..ab2fa71 100644 --- a/src/editline.c +++ b/src/editline.c @@ -238,10 +238,12 @@ static void tty_info(void) if ((term = getenv("TERM")) == NULL) term = "dumb"; if (-1 != tgetent(buff, term)) { - if ((backspace = tgetstr("le", &bp)) != NULL) - backspace = strdup(backspace); - tty_cols = tgetnum("co"); - tty_rows = tgetnum("li"); + if ((backspace = tgetstr("le", &bp)) != NULL) + backspace = strdup(backspace); + else + backspace = "\b"; + tty_cols = tgetnum("co"); + tty_rows = tgetnum("li"); } /* Make sure to check width & rows and fallback to TIOCGWINSZ if available. */ #endif