X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/a263e4f607af0edf3aadcde29be577660d84fe2d..11cd814b19dd4278d51ab15c14e81fb8ee96777c:/terminal.c diff --git a/terminal.c b/terminal.c index db024adf..cb00ea6e 100644 --- a/terminal.c +++ b/terminal.c @@ -201,7 +201,7 @@ static void power_on(Terminal *term) term->in_vbell = FALSE; term->cursor_on = 1; term->big_cursor = 0; - term->save_attr = term->curr_attr = ATTR_DEFAULT; + term->default_attr = term->save_attr = term->curr_attr = ATTR_DEFAULT; term->term_editing = term->term_echoing = FALSE; term->app_cursor_keys = term->cfg.app_cursor; term->app_keypad_keys = term->cfg.app_keypad; @@ -850,26 +850,29 @@ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) */ seltop = sb ? -term->savelines : topline; - if (term->selstart.y >= seltop && - term->selstart.y <= botline) { - term->selstart.y--; - if (term->selstart.y < seltop) { - term->selstart.y = seltop; - term->selstart.x = 0; + if (term->selstate != NO_SELECTION) { + if (term->selstart.y >= seltop && + term->selstart.y <= botline) { + term->selstart.y--; + if (term->selstart.y < seltop) { + term->selstart.y = seltop; + term->selstart.x = 0; + } } - } - if (term->selend.y >= seltop && term->selend.y <= botline) { - term->selend.y--; - if (term->selend.y < seltop) { - term->selend.y = seltop; - term->selend.x = 0; + if (term->selend.y >= seltop && term->selend.y <= botline) { + term->selend.y--; + if (term->selend.y < seltop) { + term->selend.y = seltop; + term->selend.x = 0; + } } - } - if (term->selanchor.y >= seltop && term->selanchor.y <= botline) { - term->selanchor.y--; - if (term->selanchor.y < seltop) { - term->selanchor.y = seltop; - term->selanchor.x = 0; + if (term->selanchor.y >= seltop && + term->selanchor.y <= botline) { + term->selanchor.y--; + if (term->selanchor.y < seltop) { + term->selanchor.y = seltop; + term->selanchor.x = 0; + } } } @@ -1697,7 +1700,7 @@ void term_out(Terminal *term) term_update(term); } } - term->disptop = 0; + term->seen_disp_event = TRUE; } break; case '\b': /* BS: Back space */ @@ -2376,7 +2379,7 @@ void term_out(Terminal *term) for (i = 0; i < term->esc_nargs; i++) { switch (def(term->esc_args[i], 0)) { case 0: /* restore defaults */ - term->curr_attr = ATTR_DEFAULT; + term->curr_attr = term->default_attr; break; case 1: /* enable bold */ compatibility(VT100AVO); @@ -2782,21 +2785,27 @@ void term_out(Terminal *term) case ANSI('F', '='): /* set normal foreground */ compatibility(SCOANSI); if (term->esc_args[0] >= 0 && term->esc_args[0] < 16) { - term->curr_attr &= ~ATTR_FGMASK; - term->curr_attr |= - (sco2ansicolour[term->esc_args[0] & 0x7] | + long colour = + (sco2ansicolour[term->esc_args[0] & 0x7] | ((term->esc_args[0] & 0x8) << 1)) << ATTR_FGSHIFT; + term->curr_attr &= ~ATTR_FGMASK; + term->curr_attr |= colour; + term->default_attr &= ~ATTR_FGMASK; + term->default_attr |= colour; } break; case ANSI('G', '='): /* set normal background */ compatibility(SCOANSI); if (term->esc_args[0] >= 0 && term->esc_args[0] < 16) { - term->curr_attr &= ~ATTR_BGMASK; - term->curr_attr |= - (sco2ansicolour[term->esc_args[0] & 0x7] | + long colour = + (sco2ansicolour[term->esc_args[0] & 0x7] | ((term->esc_args[0] & 0x8) << 1)) << ATTR_BGSHIFT; + term->curr_attr &= ~ATTR_BGMASK; + term->curr_attr |= colour; + term->default_attr &= ~ATTR_BGMASK; + term->default_attr |= colour; } break; case ANSI('L', '='): @@ -4786,8 +4795,6 @@ int term_ldisc(Terminal *term, int option) int term_data(Terminal *term, int is_stderr, const char *data, int len) { - assert(len > 0); - bufchain_add(&term->inbuf, data, len); if (!term->in_term_out) {