diff options
author | bapt <bapt@FreeBSD.org> | 2013-06-17 10:00:48 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2013-06-17 10:00:48 +0000 |
commit | 2b5579c9bdbbca29e7b2df1ee9a9e5d1cce2b06f (patch) | |
tree | d48b8f5f4c81e26e8dbb6597554286f1d6d53d3a /ui_getc.c | |
parent | a94245b3d36b447d1f761028da7e072210e64b43 (diff) | |
download | FreeBSD-src-2b5579c9bdbbca29e7b2df1ee9a9e5d1cce2b06f.zip FreeBSD-src-2b5579c9bdbbca29e7b2df1ee9a9e5d1cce2b06f.tar.gz |
Update dialog to 1.2-20130523
Diffstat (limited to 'ui_getc.c')
-rw-r--r-- | ui_getc.c | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -1,9 +1,9 @@ /* - * $Id: ui_getc.c,v 1.65 2011/10/20 23:45:48 tom Exp $ + * $Id: ui_getc.c,v 1.67 2013/03/24 23:53:19 tom Exp $ * * ui_getc.c - user interface glue for getc() * - * Copyright 2001-2010,2011 Thomas E. Dickey + * Copyright 2001-2012,2013 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License, version 2.1 @@ -284,6 +284,36 @@ dlg_flush_getc(void) } /* + * Report the last key entered by the user. The 'mode' parameter controls + * the way it is separated from other results: + * -2 (no separator) + * -1 (separator after the key name) + * 0 (separator is optionally before the key name) + * 1 (same as -1) + */ +void +dlg_add_last_key(int mode) +{ + if (dialog_vars.last_key) { + if (mode >= 0) { + if (mode > 0) { + dlg_add_last_key(-1); + } else { + if (dlg_need_separator()) + dlg_add_separator(); + dlg_add_last_key(-2); + } + } else { + char temp[80]; + sprintf(temp, "%d", last_getc); + dlg_add_string(temp); + if (mode == -1) + dlg_add_separator(); + } + } +} + +/* * Check if the stream has been unexpectedly closed, returning false in that * case. */ @@ -440,12 +470,9 @@ dlg_getc(WINDOW *win, int *fkey) if (!*fkey || *fkey != before_fkey) { switch (ch) { case CHR_LITERAL: - if (!literal) { - literal = TRUE; - keypad(win, FALSE); - continue; - } - break; + literal = TRUE; + keypad(win, FALSE); + continue; case CHR_REPAINT: (void) touchwin(win); (void) wrefresh(curscr); |