fix up PDCurses cursor placement for prompts

This commit is contained in:
nhmall
2018-12-14 23:08:41 -05:00
parent 1be3ad0ddc
commit 16cda0882c
7 changed files with 222 additions and 43 deletions

View File

@@ -164,6 +164,7 @@ curses_character_input_dialog(const char *prompt, const char *choices,
CHAR_P def)
{
WINDOW *askwin = NULL;
WINDOW *message_window;
int answer, count, maxwidth, map_height, map_width;
char *linestr;
char askstr[BUFSZ + QBUFSZ];
@@ -180,6 +181,9 @@ curses_character_input_dialog(const char *prompt, const char *choices,
map_width = term_cols;
}
#ifdef PDCURSES
message_window = curses_get_nhwin(MESSAGE_WIN);
#endif
maxwidth = map_width - 2;
if (choices != NULL) {
@@ -241,8 +245,11 @@ curses_character_input_dialog(const char *prompt, const char *choices,
/*curses_stupid_hack = 0; */
while (1) {
#ifdef PDCURSES
answer = wgetch(message_window);
#else
answer = getch();
#endif
if (answer == ERR) {
answer = def;
break;

View File

@@ -619,7 +619,13 @@ raw_print(str) -- Print directly to a screen, or otherwise guarantee that
void
curses_raw_print(const char *str)
{
#ifdef PDCURSES
WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
curses_message_win_puts(str, FALSE);
#else
puts(str);
#endif
}
/*

View File

@@ -143,7 +143,7 @@ curses_block(boolean noscroll)
{
int height, width, ret = 0;
WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
char *resp = " \n\033"; /* space, enter, esc */
char *resp = " \r\n\033"; /* space, enter, esc */
curses_get_window_size(MESSAGE_WIN, &height, &width);
@@ -429,7 +429,11 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
wmove(win, my, mx);
curs_set(1);
wrefresh(win);
#ifdef PDCURSES
ch = wgetch(win);
#else
ch = getch();
#endif
curs_set(0);
switch(ch) {
case '\033': /* DOESCAPE */

View File

@@ -152,7 +152,6 @@
<ClCompile Include="$(SysShareDir)cppregex.cpp" />
<ClCompile Include="$(SysShareDir)nhlan.c" />
<ClCompile Include="$(SysShareDir)pcsys.c" />
<ClCompile Include="$(SysShareDir)pcunix.c" />
<ClCompile Include="$(SysShareDir)random.c" />
<ClCompile Include="$(SysWinntDir)ntsound.c" />
<ClCompile Include="$(SysWinntDir)nttty.c" />

View File

@@ -147,7 +147,6 @@
<ClCompile Include="$(SysShareDir)cppregex.cpp" />
<ClCompile Include="$(SysShareDir)nhlan.c" />
<ClCompile Include="$(SysShareDir)pcsys.c" />
<ClCompile Include="$(SysShareDir)pcunix.c" />
<ClCompile Include="$(SysShareDir)random.c" />
<ClCompile Include="$(SysWinntDir)ntsound.c" />
<ClCompile Include="$(SysWinntDir)stubs.c">