curses ^P - support msg_window:full
curses uses 'reversed' (LIFO) style when displaying previous messages. Use the existing (previously tty-only) 'msg_window' option to also support 'full' (FIFO). The actual code needed as just a couple of lines; tweaking options parsing and the documentation was more work.
This commit is contained in:
@@ -827,6 +827,12 @@ curses_init_options()
|
||||
iflags.wc2_petattr = A_REVERSE;
|
||||
}
|
||||
|
||||
/* curses doesn't support 's' (single message at a time; successive
|
||||
^P's go back to earlier messages) and 'c' (combination; single
|
||||
on first and second of consecutive ^P's, full on third) */
|
||||
if (iflags.prevmsg_window != 'f')
|
||||
iflags.prevmsg_window = 'r';
|
||||
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
if (iflags.wc_mouse_support) {
|
||||
mousemask(BUTTON1_CLICKED, NULL);
|
||||
|
||||
@@ -284,20 +284,22 @@ curses_teardown_messages(void)
|
||||
void
|
||||
curses_prev_mesg()
|
||||
{
|
||||
int count;
|
||||
int count, fifo_count;
|
||||
winid wid;
|
||||
long turn = 0;
|
||||
anything Id;
|
||||
nhprev_mesg *mesg;
|
||||
menu_item *selected = NULL;
|
||||
boolean do_lifo = (iflags.prevmsg_window != 'f');
|
||||
|
||||
wid = curses_get_wid(NHW_MENU);
|
||||
curses_create_nhmenu(wid);
|
||||
Id = zeroany;
|
||||
|
||||
for (count = 0; count < num_messages; count++) {
|
||||
mesg = get_msg_line(TRUE, count);
|
||||
if ((turn != mesg->turn) && (count != 0)) {
|
||||
for (count = 0, fifo_count = num_messages - 1; count < num_messages;
|
||||
++count, --fifo_count) {
|
||||
mesg = get_msg_line(TRUE, do_lifo ? count : fifo_count);
|
||||
if (turn != mesg->turn && count != 0) {
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE);
|
||||
}
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user