Commit 9b33d517 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in get_key_buffer(), simplify the check for a lost input source, since

the errno check is unreliable


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3311 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 12 additions and 11 deletions
+12 -11
...@@ -63,7 +63,8 @@ CVS code - ...@@ -63,7 +63,8 @@ CVS code -
row, hang up regardless of the value of errno. This fixes a row, hang up regardless of the value of errno. This fixes a
problem where nano doesn't terminate properly under xterm if problem where nano doesn't terminate properly under xterm if
the user su's to root, runs nano, and then closes the terminal the user su's to root, runs nano, and then closes the terminal
window. (DLR, found by John <acocaracha@gmail.com>) window. errno isn't set properly to EIO then. (DLR, found by
John <acocaracha@gmail.com>)
parse_kbinput() parse_kbinput()
- Interpret Shift-Begin, Shift-Delete, Shift-End, Shift-Home, - Interpret Shift-Begin, Shift-Delete, Shift-End, Shift-Home,
Shift-Insert, and Shift-Suspend as Begin, Delete, End, Home, Shift-Insert, and Shift-Suspend as Begin, Delete, End, Home,
......
...@@ -1044,10 +1044,10 @@ RETSIGTYPE handle_sigwinch(int signal) ...@@ -1044,10 +1044,10 @@ RETSIGTYPE handle_sigwinch(int signal)
if (result == -1) if (result == -1)
return; return;
/* Could check whether the COLS or LINES changed, and return /* We could check whether the COLS or LINES changed, and return
* otherwise. EXCEPT, that COLS and LINES are ncurses global * otherwise. However, COLS and LINES are curses global variables,
* variables, and in some cases ncurses has already updated them. * and in some cases curses has already updated them. But not in
* But not in all cases, argh. */ * all cases. Argh. */
COLS = win.ws_col; COLS = win.ws_col;
LINES = win.ws_row; LINES = win.ws_row;
......
...@@ -142,12 +142,12 @@ void get_key_buffer(WINDOW *win) ...@@ -142,12 +142,12 @@ void get_key_buffer(WINDOW *win)
while ((input = wgetch(win)) == ERR) { while ((input = wgetch(win)) == ERR) {
errcount++; errcount++;
/* If errno is EIO, it means that the input source that we were /* If we've failed to get a character over MAX_BUF_SIZE times in
* using is gone, so die gracefully. If we've failed to get a * a row, assume that the input source we were using is gone and
* character over MAX_BUF_SIZE times in a row, it can mean the * die gracefully. We could check if errno is set to EIO
* same thing regardless of the value of errno, so die * ("Input/output error") and die gracefully in that case, but
* gracefully then too. */ * it's not always set properly. Argh. */
if (errno == EIO || errcount > MAX_BUF_SIZE) if (errcount > MAX_BUF_SIZE)
handle_hupterm(0); handle_hupterm(0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment