diff options
Diffstat (limited to 'src/ansi.c')
-rw-r--r-- | src/ansi.c | 71 |
1 files changed, 44 insertions, 27 deletions
@@ -125,8 +125,8 @@ static void DesignateCharset __P((int, int)); static void MapCharset __P((int)); static void MapCharsetR __P((int)); #endif -static void SaveCursor __P((void)); -static void RestoreCursor __P((void)); +static void SaveCursor __P((struct cursor *)); +static void RestoreCursor __P((struct cursor *)); static void BackSpace __P((void)); static void Return __P((void)); static void LineFeed __P((int)); @@ -203,7 +203,7 @@ register struct win *p; p->w_cursorkeys = 0; p->w_top = 0; p->w_bot = p->w_height - 1; - p->w_saved = 0; + p->w_saved.on = 0; p->w_x = p->w_y = 0; p->w_state = LIT; p->w_StringType = NONE; @@ -990,10 +990,10 @@ int c, intermediate; Report("\033[?%d;%dc", 1, 2); break; case '7': - SaveCursor(); + SaveCursor(&curr->w_saved); break; case '8': - RestoreCursor(); + RestoreCursor(&curr->w_saved); break; case 'c': ClearScreen(); @@ -1236,7 +1236,7 @@ int c, intermediate; LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); break; case 's': - SaveCursor(); + SaveCursor(&curr->w_saved); break; case 't': switch(a1) @@ -1277,7 +1277,7 @@ int c, intermediate; } break; case 'u': - RestoreCursor(); + RestoreCursor(&curr->w_saved); break; case 'I': if (!a1) @@ -1434,15 +1434,28 @@ int c, intermediate; if (use_altscreen) { if (i) - EnterAltScreen(curr); + { + if (!curr->w_alt.on) + SaveCursor(&curr->w_alt.cursor); + EnterAltScreen(curr); + } else - LeaveAltScreen(curr); + { + LeaveAltScreen(curr); + RestoreCursor(&curr->w_alt.cursor); + } if (a1 == 47 && !i) - curr->w_saved = 0; + curr->w_saved.on = 0; LRefreshAll(&curr->w_layer, 0); LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } break; + case 1048: + if (i) + SaveCursor(&curr->w_saved); + else + RestoreCursor(&curr->w_saved); + break; /* case 66: NKM: Numeric keypad appl mode */ /* case 68: KBUM: Keyboard usage mode (data process) */ case 1000: /* VT200 mouse tracking */ @@ -1758,34 +1771,36 @@ int n; #endif /* FONT */ static void -SaveCursor() +SaveCursor(cursor) +struct cursor *cursor; { - curr->w_saved = 1; - curr->w_Saved_x = curr->w_x; - curr->w_Saved_y = curr->w_y; - curr->w_SavedRend = curr->w_rend; + cursor->on = 1; + cursor->x = curr->w_x; + cursor->y = curr->w_y; + cursor->Rend = curr->w_rend; #ifdef FONT - curr->w_SavedCharset = curr->w_Charset; - curr->w_SavedCharsetR = curr->w_CharsetR; - bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets, + cursor->Charset = curr->w_Charset; + cursor->CharsetR = curr->w_CharsetR; + bcopy((char *) curr->w_charsets, (char *) cursor->Charsets, 4 * sizeof(int)); #endif } static void -RestoreCursor() +RestoreCursor(cursor) +struct cursor *cursor; { - if (!curr->w_saved) + if (!cursor->on) return; - LGotoPos(&curr->w_layer, curr->w_Saved_x, curr->w_Saved_y); - curr->w_x = curr->w_Saved_x; - curr->w_y = curr->w_Saved_y; - curr->w_rend = curr->w_SavedRend; + LGotoPos(&curr->w_layer, cursor->x, cursor->y); + curr->w_x = cursor->x; + curr->w_y = cursor->y; + curr->w_rend = cursor->Rend; #ifdef FONT - bcopy((char *) curr->w_SavedCharsets, (char *) curr->w_charsets, + bcopy((char *) cursor->Charsets, (char *) curr->w_charsets, 4 * sizeof(int)); - curr->w_Charset = curr->w_SavedCharset; - curr->w_CharsetR = curr->w_SavedCharsetR; + curr->w_Charset = cursor->Charset; + curr->w_CharsetR = cursor->CharsetR; curr->w_ss = 0; curr->w_FontL = curr->w_charsets[curr->w_Charset]; curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; @@ -2916,6 +2931,8 @@ struct win *p; int visual; { struct canvas *cv; + if (displays == NULL) + p->w_bell = BELL_DONE; for (display = displays; display; display = display->d_next) { for (cv = D_cvlist; cv; cv = cv->c_next) |