/* switches some terminal flags on or off * * returns wether a redraw is necessary */ int set_mode(termstate_t * term, int on_off) { int i, _redraw = 0; for (i = 0; i <= term->used_par; i++) { if (term->ques) { switch(term->par[i]) { case 5: // Inverted screen on/off if (term->decscnm != on_off) { term->decscnm = on_off; invert_screen(term); _redraw = 1; } break; } } else { } } return _redraw; }
static void reset_tty(byte do_clear) { DState = ESnormal; if (*Flags & TTY_INVERTSCR) invert_screen(); *Flags = TTY_AUTOWRAP; Effects = 0; Top = 0; Bottom = SizeY; ColText = Color = DefColor = COL(WHITE,BLACK); Underline = COL(HIGH|WHITE,BLACK); HalfInten = COL(HIGH|BLACK,BLACK); Win->Flags |= WINDOWFL_CURSOR_ON; Win->CursorType = LINECURSOR; TabStop[0] = 0x01010100; TabStop[1] = TabStop[2] = TabStop[3] = TabStop[4] = 0x01010101; nPar = 0; G = saveG = 0; /* * default to latin1 charset if CONF__UNICODE is enabled */ #ifdef CONF__UNICODE setCharset(G0 = saveG0 = LAT1_MAP); #else setCharset(G0 = saveG0 = IBMPC_MAP); #endif G1 = saveG1 = GRAF_MAP; utf = utf_count = utf_char = 0; /* bell_pitch = DEFAULT_BELL_PITCH; bell_duration = DEFAULT_BELL_DURATION; kbd_table.ledmode = LED_SHOW_FLAGS; kbd_table.ledflagstate = kbd_table.default_ledflagstate; */ goto_xy(0,0); save_current(); if (do_clear) csi_J(2); }
/* set reverse video on characters s-e of console with selection. */ inline static void highlight(const int s, const int e) { invert_screen(sel_cons, s, e-s+2, 1); }
static void set_mode(byte on_off) { dat i; for (i=0; i<=nPar; i++) /* DEC private modes set/reset */ if (DState & ESques) switch (Par[i]) { case 1: /* Cursor keys send ^[Ox/^[[x */ CHANGE_BIT(TTY_ALTCURSKEYS, on_off); *Flags |= TTY_NEEDREFOCUS; break; case 3: /* 80/132 mode switch unimplemented */ break; case 5: /* Inverted screen on/off */ CHANGE_BIT(TTY_INVERTSCR, on_off); update_eff(); invert_screen(); break; case 6: /* Origin relative/absolute */ CHANGE_BIT(TTY_RELORIG, on_off); goto_axy(0,0); break; case 7: /* Autowrap on/off */ CHANGE_BIT(TTY_AUTOWRAP, on_off); break; case 8: /* Autorepeat on/off */ break; case 9: /* new style */ CHANGE_BIT(TTY_REPORTMOUSE, on_off); CHANGE_BIT(TTY_REPORTMOUSE2, tfalse); Act(ChangeField,Win) (Win, TWS_window_Attrib, WINDOW_WANT_MOUSE_MOTION|WINDOW_WANT_MOUSE, on_off ? WINDOW_WANT_MOUSE : 0); break; case 25: /* Cursor on/off */ Act(ChangeField,Win) (Win, TWS_window_Flags, WINDOWFL_CURSOR_ON, on_off ? WINDOWFL_CURSOR_ON : 0); *Flags |= TTY_UPDATECURSOR; break; case 999: /* new style, report also motions */ CHANGE_BIT(TTY_REPORTMOUSE, on_off); CHANGE_BIT(TTY_REPORTMOUSE2, on_off); Act(ChangeField,Win) (Win, TWS_window_Attrib, WINDOW_WANT_MOUSE|WINDOW_WANT_MOUSE_MOTION, on_off ? WINDOW_WANT_MOUSE|WINDOW_WANT_MOUSE_MOTION : 0); break; case 1000: /* classic xterm style */ CHANGE_BIT(TTY_REPORTMOUSE, tfalse); CHANGE_BIT(TTY_REPORTMOUSE2, on_off); Act(ChangeField,Win) (Win, TWS_window_Attrib, WINDOW_WANT_MOUSE|WINDOW_WANT_MOUSE_MOTION, on_off ? WINDOW_WANT_MOUSE|WINDOW_WANT_MOUSE_MOTION : 0); break; /* ANSI modes set/reset */ } else switch (Par[i]) { case 3: /* Monitor (display ctrls) */ CHANGE_BIT(TTY_DISPCTRL, on_off); break; case 4: /* Insert Mode on/off */ CHANGE_BIT(TTY_INSERT, on_off); break; case 20: /* Lf, Enter == CrLf/Lf */ CHANGE_BIT(TTY_CRLF, on_off); break; } }