mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Fix `restart-reset-terminal': terminal now restored to a sensible state when
reusing a window to restart a session. [originally from svn r6577] [this svn revision also touched putty-wishlist]
This commit is contained in:
parent
54741e1271
commit
dd73d2a836
2
putty.h
2
putty.h
@ -787,7 +787,7 @@ void term_free(Terminal *);
|
|||||||
void term_size(Terminal *, int, int, int);
|
void term_size(Terminal *, int, int, int);
|
||||||
void term_paint(Terminal *, Context, int, int, int, int, int);
|
void term_paint(Terminal *, Context, int, int, int, int, int);
|
||||||
void term_scroll(Terminal *, int, int);
|
void term_scroll(Terminal *, int, int);
|
||||||
void term_pwron(Terminal *);
|
void term_pwron(Terminal *, int);
|
||||||
void term_clrsb(Terminal *);
|
void term_clrsb(Terminal *);
|
||||||
void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
|
void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
|
||||||
int,int,int,int,int);
|
int,int,int,int,int);
|
||||||
|
25
terminal.c
25
terminal.c
@ -94,10 +94,12 @@ static termline *lineptr(Terminal *, int, int, int);
|
|||||||
static void unlineptr(termline *);
|
static void unlineptr(termline *);
|
||||||
static void do_paint(Terminal *, Context, int);
|
static void do_paint(Terminal *, Context, int);
|
||||||
static void erase_lots(Terminal *, int, int, int);
|
static void erase_lots(Terminal *, int, int, int);
|
||||||
|
static int find_last_nonempty_line(Terminal *, tree234 *);
|
||||||
static void swap_screen(Terminal *, int, int, int);
|
static void swap_screen(Terminal *, int, int, int);
|
||||||
static void update_sbar(Terminal *);
|
static void update_sbar(Terminal *);
|
||||||
static void deselect(Terminal *);
|
static void deselect(Terminal *);
|
||||||
static void term_print_finish(Terminal *);
|
static void term_print_finish(Terminal *);
|
||||||
|
static void scroll(Terminal *, int, int, int, int);
|
||||||
#ifdef OPTIMISE_SCROLL
|
#ifdef OPTIMISE_SCROLL
|
||||||
static void scroll_display(Terminal *, int, int, int);
|
static void scroll_display(Terminal *, int, int, int);
|
||||||
#endif /* OPTIMISE_SCROLL */
|
#endif /* OPTIMISE_SCROLL */
|
||||||
@ -1170,10 +1172,12 @@ static void term_schedule_vbell(Terminal *term, int already_started,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up power-on settings for the terminal.
|
* Set up power-on settings for the terminal.
|
||||||
|
* If 'clear' is false, don't actually clear the primary screen, and
|
||||||
|
* position the cursor below the last non-blank line (scrolling if
|
||||||
|
* necessary).
|
||||||
*/
|
*/
|
||||||
static void power_on(Terminal *term)
|
static void power_on(Terminal *term, int clear)
|
||||||
{
|
{
|
||||||
term->curs.x = term->curs.y = 0;
|
|
||||||
term->alt_x = term->alt_y = 0;
|
term->alt_x = term->alt_y = 0;
|
||||||
term->savecurs.x = term->savecurs.y = 0;
|
term->savecurs.x = term->savecurs.y = 0;
|
||||||
term->alt_t = term->marg_t = 0;
|
term->alt_t = term->marg_t = 0;
|
||||||
@ -1217,8 +1221,17 @@ static void power_on(Terminal *term)
|
|||||||
swap_screen(term, 1, FALSE, FALSE);
|
swap_screen(term, 1, FALSE, FALSE);
|
||||||
erase_lots(term, FALSE, TRUE, TRUE);
|
erase_lots(term, FALSE, TRUE, TRUE);
|
||||||
swap_screen(term, 0, FALSE, FALSE);
|
swap_screen(term, 0, FALSE, FALSE);
|
||||||
|
if (clear)
|
||||||
erase_lots(term, FALSE, TRUE, TRUE);
|
erase_lots(term, FALSE, TRUE, TRUE);
|
||||||
|
term->curs.y = find_last_nonempty_line(term, term->screen) + 1;
|
||||||
|
if (term->curs.y == term->rows) {
|
||||||
|
term->curs.y--;
|
||||||
|
scroll(term, 0, term->rows - 1, 1, TRUE);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
term->curs.y = 0;
|
||||||
|
}
|
||||||
|
term->curs.x = 0;
|
||||||
term_schedule_tblink(term);
|
term_schedule_tblink(term);
|
||||||
term_schedule_cblink(term);
|
term_schedule_cblink(term);
|
||||||
}
|
}
|
||||||
@ -1283,9 +1296,9 @@ void term_seen_key_event(Terminal *term)
|
|||||||
/*
|
/*
|
||||||
* Same as power_on(), but an external function.
|
* Same as power_on(), but an external function.
|
||||||
*/
|
*/
|
||||||
void term_pwron(Terminal *term)
|
void term_pwron(Terminal *term, int clear)
|
||||||
{
|
{
|
||||||
power_on(term);
|
power_on(term, clear);
|
||||||
if (term->ldisc) /* cause ldisc to notice changes */
|
if (term->ldisc) /* cause ldisc to notice changes */
|
||||||
ldisc_send(term->ldisc, NULL, 0, 0);
|
ldisc_send(term->ldisc, NULL, 0, 0);
|
||||||
term->disptop = 0;
|
term->disptop = 0;
|
||||||
@ -1442,7 +1455,7 @@ Terminal *term_init(Config *mycfg, struct unicode_data *ucsdata,
|
|||||||
term->tabs = NULL;
|
term->tabs = NULL;
|
||||||
deselect(term);
|
deselect(term);
|
||||||
term->rows = term->cols = -1;
|
term->rows = term->cols = -1;
|
||||||
power_on(term);
|
power_on(term, TRUE);
|
||||||
term->beephead = term->beeptail = NULL;
|
term->beephead = term->beeptail = NULL;
|
||||||
#ifdef OPTIMISE_SCROLL
|
#ifdef OPTIMISE_SCROLL
|
||||||
term->scrollhead = term->scrolltail = NULL;
|
term->scrollhead = term->scrolltail = NULL;
|
||||||
@ -3076,7 +3089,7 @@ static void term_out(Terminal *term)
|
|||||||
break;
|
break;
|
||||||
case 'c': /* RIS: restore power-on settings */
|
case 'c': /* RIS: restore power-on settings */
|
||||||
compatibility(VT100);
|
compatibility(VT100);
|
||||||
power_on(term);
|
power_on(term, TRUE);
|
||||||
if (term->ldisc) /* cause ldisc to notice changes */
|
if (term->ldisc) /* cause ldisc to notice changes */
|
||||||
ldisc_send(term->ldisc, NULL, 0, 0);
|
ldisc_send(term->ldisc, NULL, 0, 0);
|
||||||
if (term->reset_132) {
|
if (term->reset_132) {
|
||||||
|
@ -2858,7 +2858,7 @@ void clear_scrollback_menuitem(GtkMenuItem *item, gpointer data)
|
|||||||
void reset_terminal_menuitem(GtkMenuItem *item, gpointer data)
|
void reset_terminal_menuitem(GtkMenuItem *item, gpointer data)
|
||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)data;
|
struct gui_data *inst = (struct gui_data *)data;
|
||||||
term_pwron(inst->term);
|
term_pwron(inst->term, TRUE);
|
||||||
if (inst->ldisc)
|
if (inst->ldisc)
|
||||||
ldisc_send(inst->ldisc, NULL, 0, 0);
|
ldisc_send(inst->ldisc, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
@ -3229,6 +3229,7 @@ void restart_session_menuitem(GtkMenuItem *item, gpointer data)
|
|||||||
|
|
||||||
if (!inst->back) {
|
if (!inst->back) {
|
||||||
logevent(inst, "----- Session restarted -----");
|
logevent(inst, "----- Session restarted -----");
|
||||||
|
term_pwron(inst->term, FALSE);
|
||||||
start_backend(inst);
|
start_backend(inst);
|
||||||
inst->exited = FALSE;
|
inst->exited = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1987,6 +1987,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
case IDM_RESTART:
|
case IDM_RESTART:
|
||||||
if (!back) {
|
if (!back) {
|
||||||
logevent(NULL, "----- Session restarted -----");
|
logevent(NULL, "----- Session restarted -----");
|
||||||
|
term_pwron(term, FALSE);
|
||||||
start_backend();
|
start_backend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2154,7 +2155,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
term_clrsb(term);
|
term_clrsb(term);
|
||||||
break;
|
break;
|
||||||
case IDM_RESET:
|
case IDM_RESET:
|
||||||
term_pwron(term);
|
term_pwron(term, TRUE);
|
||||||
if (ldisc)
|
if (ldisc)
|
||||||
ldisc_send(ldisc, NULL, 0, 0);
|
ldisc_send(ldisc, NULL, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user