* tuiIO.c (tui_cont_sig): Update cursor position on the screen to
leave it in the command window. (tui_redisplay_readline): Save cursor position to restore the cursor after we go back from background. * tuiData.h (TuiCommandInfo): Add start_line member.
This commit is contained in:
parent
c6f60bcd2c
commit
d75e970c9d
|
@ -252,6 +252,7 @@ typedef struct _TuiCommandInfo
|
||||||
{
|
{
|
||||||
int curLine; /* The current line position */
|
int curLine; /* The current line position */
|
||||||
int curch; /* The current cursor position */
|
int curch; /* The current cursor position */
|
||||||
|
int start_line;
|
||||||
}
|
}
|
||||||
TuiCommandInfo, *TuiCommandInfoPtr;
|
TuiCommandInfo, *TuiCommandInfoPtr;
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ tui_puts (const char *string)
|
||||||
}
|
}
|
||||||
getyx (w, cmdWin->detail.commandInfo.curLine,
|
getyx (w, cmdWin->detail.commandInfo.curLine,
|
||||||
cmdWin->detail.commandInfo.curch);
|
cmdWin->detail.commandInfo.curch);
|
||||||
|
cmdWin->detail.commandInfo.start_line = cmdWin->detail.commandInfo.curLine;
|
||||||
|
|
||||||
/* We could defer the following. */
|
/* We could defer the following. */
|
||||||
wrefresh (w);
|
wrefresh (w);
|
||||||
|
@ -144,7 +145,7 @@ tui_redisplay_readline (void)
|
||||||
c_pos = -1;
|
c_pos = -1;
|
||||||
c_line = -1;
|
c_line = -1;
|
||||||
w = cmdWin->generic.handle;
|
w = cmdWin->generic.handle;
|
||||||
start_line = cmdWin->detail.commandInfo.curLine;
|
start_line = cmdWin->detail.commandInfo.start_line;
|
||||||
wmove (w, start_line, 0);
|
wmove (w, start_line, 0);
|
||||||
prev_col = 0;
|
prev_col = 0;
|
||||||
height = 1;
|
height = 1;
|
||||||
|
@ -177,7 +178,7 @@ tui_redisplay_readline (void)
|
||||||
}
|
}
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
{
|
{
|
||||||
getyx (w, cmdWin->detail.commandInfo.curLine,
|
getyx (w, cmdWin->detail.commandInfo.start_line,
|
||||||
cmdWin->detail.commandInfo.curch);
|
cmdWin->detail.commandInfo.curch);
|
||||||
}
|
}
|
||||||
getyx (w, line, col);
|
getyx (w, line, col);
|
||||||
|
@ -186,13 +187,16 @@ tui_redisplay_readline (void)
|
||||||
prev_col = col;
|
prev_col = col;
|
||||||
}
|
}
|
||||||
wclrtobot (w);
|
wclrtobot (w);
|
||||||
getyx (w, cmdWin->detail.commandInfo.curLine,
|
getyx (w, cmdWin->detail.commandInfo.start_line,
|
||||||
cmdWin->detail.commandInfo.curch);
|
cmdWin->detail.commandInfo.curch);
|
||||||
if (c_line >= 0)
|
if (c_line >= 0)
|
||||||
wmove (w, c_line, c_pos);
|
{
|
||||||
|
wmove (w, c_line, c_pos);
|
||||||
|
cmdWin->detail.commandInfo.curLine = c_line;
|
||||||
|
cmdWin->detail.commandInfo.curch = c_pos;
|
||||||
|
}
|
||||||
|
cmdWin->detail.commandInfo.start_line -= height - 1;
|
||||||
|
|
||||||
cmdWin->detail.commandInfo.curLine -= height - 1;
|
|
||||||
|
|
||||||
wrefresh (w);
|
wrefresh (w);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
@ -307,6 +311,12 @@ tui_cont_sig (int sig)
|
||||||
|
|
||||||
/* Force a refresh of the screen. */
|
/* Force a refresh of the screen. */
|
||||||
tuiRefreshAll ();
|
tuiRefreshAll ();
|
||||||
|
|
||||||
|
/* Update cursor position on the screen. */
|
||||||
|
wmove (cmdWin->generic.handle,
|
||||||
|
cmdWin->detail.commandInfo.start_line,
|
||||||
|
cmdWin->detail.commandInfo.curch);
|
||||||
|
wrefresh (cmdWin->generic.handle);
|
||||||
}
|
}
|
||||||
signal (sig, tui_cont_sig);
|
signal (sig, tui_cont_sig);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue