summaryrefslogtreecommitdiff
path: root/lib/libcurses/lib_endwin.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-11-26 04:02:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-11-26 04:02:03 +0000
commitbda33b7e716d56bf1a9ecccb7e2543889f9ab1d3 (patch)
tree7bc4bcdf70ecc1d045693a309e96b304e1b49c33 /lib/libcurses/lib_endwin.c
parentcd15e61d557c4704743905eae7b88ae927cf0394 (diff)
ncurses 4.1 + changes to work with our terminfo libs (instead of
the ncurses ones). Changes are #ifdef EXTERN_TERMINFO. Post 4.1 patches will be applied in a separate commit.
Diffstat (limited to 'lib/libcurses/lib_endwin.c')
-rw-r--r--lib/libcurses/lib_endwin.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/libcurses/lib_endwin.c b/lib/libcurses/lib_endwin.c
index bda6e1949b8..f3fce19e72a 100644
--- a/lib/libcurses/lib_endwin.c
+++ b/lib/libcurses/lib_endwin.c
@@ -27,31 +27,42 @@
**
*/
-#include "curses.priv.h"
-#include "term.h"
+#include <curses.priv.h>
+#include <term.h>
+
+MODULE_ID("Id: lib_endwin.c,v 1.10 1997/02/02 00:36:41 tom Exp $")
int
endwin(void)
{
- T(("endwin() called"));
+ T((T_CALLED("endwin()")));
SP->_endwin = TRUE;
_nc_mouse_wrap(SP);
- mvcur(-1, -1, screen_lines - 1, 0);
+ /* SP->_curs{row,col} may be used later in _nc_mvcur_wrap,save_curs */
+ mvcur(-1, -1, SP->_cursrow = screen_lines - 1, SP->_curscol = 0);
curs_set(1); /* set cursor to normal mode */
if (SP->_coloron == TRUE && orig_pair)
putp(orig_pair);
- _nc_mvcur_wrap(); /* wrap up cursor addressing */
+ _nc_mvcur_wrap(); /* wrap up cursor addressing */
- if (curscr && (curscr->_attrs != A_NORMAL))
- vidattr(curscr->_attrs = A_NORMAL);
+ if (SP && (SP->_current_attr != A_NORMAL))
+ vidattr(A_NORMAL);
- fflush(SP->_ofp);
+ /*
+ * Reset terminal's tab counter. There's a long-time bug that
+ * if you exit a "curses" program such as vi or more, tab
+ * forward, and then backspace, the cursor doesn't go to the
+ * right place. The problem is that the kernel counts the
+ * escape sequences that reset things as column positions.
+ * Utter a \r to reset this invisibly.
+ */
+ _nc_outch('\r');
- return(reset_shell_mode());
+ returnCode(reset_shell_mode());
}