int (*send) (char *buf, int len);
/* back->sendbuffer() does the same thing but without attempting a send */
int (*sendbuffer) (void);
- void (*size) (void);
+ void (*size) (int width, int height);
void (*special) (Telnet_Special code);
Socket(*socket) (void);
int (*exitcode) (void);
#include <ctype.h>
#include "putty.h"
-#include "terminal.h"
#ifndef FALSE
#define FALSE 0
static Socket s = NULL;
static int rlogin_bufsize;
+static int rlogin_term_width, rlogin_term_height;
static void *frontend;
static void rlogin_size(void);
char *err;
frontend = frontend_handle;
+ rlogin_term_width = cfg.width;
+ rlogin_term_height = cfg.height;
/*
* Try to find host.
/*
* Called to set the size of the window
*/
-static void rlogin_size(void)
+static void rlogin_size(int width, int height)
{
char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
- if (s == NULL || term == NULL)
+ rlogin_term_width = width;
+ rlogin_term_height = height;
+
+ if (s == NULL)
return;
-
- b[6] = term->cols >> 8;
- b[7] = term->cols & 0xFF;
- b[4] = term->rows >> 8;
- b[5] = term->rows & 0xFF;
+
+ b[6] = rlogin_term_width >> 8;
+ b[7] = rlogin_term_width & 0xFF;
+ b[4] = rlogin_term_height >> 8;
+ b[5] = rlogin_term_height & 0xFF;
rlogin_bufsize = sk_write(s, b, 12);
return;
}
#include <assert.h>
#include "putty.h"
-#include "terminal.h"
#include "tree234.h"
#include "ssh.h"
static void *frontend;
+static int ssh_term_width, ssh_term_height;
+
static tree234 *ssh_channels; /* indexed by local id */
static struct ssh_channel *mainchan; /* primary session channel */
static int ssh_exitcode = -1;
if (!cfg.nopty) {
send_packet(SSH1_CMSG_REQUEST_PTY,
PKT_STR, cfg.termtype,
- PKT_INT, term ? term->rows : 24,
- PKT_INT, term ? term->cols : 80,
+ PKT_INT, ssh_term_height,
+ PKT_INT, ssh_term_width,
PKT_INT, 0, PKT_INT, 0, PKT_CHAR, 0, PKT_END);
ssh_state = SSH_STATE_INTERMED;
do {
ssh2_pkt_addstring("pty-req");
ssh2_pkt_addbool(1); /* want reply */
ssh2_pkt_addstring(cfg.termtype);
- ssh2_pkt_adduint32(term ? term->cols : 80);
- ssh2_pkt_adduint32(term ? term->rows : 24);
+ ssh2_pkt_adduint32(ssh_term_width);
+ ssh2_pkt_adduint32(ssh_term_height);
ssh2_pkt_adduint32(0); /* pixel width */
ssh2_pkt_adduint32(0); /* pixel height */
ssh2_pkt_addstring_start();
#endif
frontend = frontend_handle;
+ ssh_term_width = cfg.width;
+ ssh_term_height = cfg.height;
ssh_send_ok = 0;
ssh_editing = 0;
/*
* Called to set the size of the window from SSH's POV.
*/
-static void ssh_size(void)
+static void ssh_size(int width, int height)
{
+ ssh_term_width = width;
+ ssh_term_height = height;
+
switch (ssh_state) {
case SSH_STATE_BEFORE_SIZE:
case SSH_STATE_PREPACKET:
return;
if (ssh_version == 1) {
send_packet(SSH1_CMSG_WINDOW_SIZE,
- PKT_INT, term->rows, PKT_INT, term->cols,
+ PKT_INT, ssh_term_height, PKT_INT, ssh_term_width,
PKT_INT, 0, PKT_INT, 0, PKT_END);
} else {
ssh2_pkt_init(SSH2_MSG_CHANNEL_REQUEST);
ssh2_pkt_adduint32(mainchan->remoteid);
ssh2_pkt_addstring("window-change");
ssh2_pkt_addbool(0);
- ssh2_pkt_adduint32(term->cols);
- ssh2_pkt_adduint32(term->rows);
+ ssh2_pkt_adduint32(ssh_term_width);
+ ssh2_pkt_adduint32(ssh_term_height);
ssh2_pkt_adduint32(0);
ssh2_pkt_adduint32(0);
ssh2_pkt_send();
#include <stdlib.h>
#include "putty.h"
-#include "terminal.h"
#ifndef FALSE
#define FALSE 0
static Socket s = NULL;
static void *frontend;
+static int telnet_term_width, telnet_term_height;
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
char *err;
frontend = frontend_handle;
+ telnet_term_width = cfg.width;
+ telnet_term_height = cfg.height;
/*
* Try to find host.
/*
* Called to set the size of the window from Telnet's POV.
*/
-static void telnet_size(void)
+static void telnet_size(int width, int height)
{
unsigned char b[16];
char logbuf[50];
- if (s == NULL || term == NULL || o_naws.state != ACTIVE)
+ telnet_term_width = width;
+ telnet_term_height = height;
+
+ if (s == NULL || o_naws.state != ACTIVE)
return;
b[0] = IAC;
b[1] = SB;
b[2] = TELOPT_NAWS;
- b[3] = term->cols >> 8;
- b[4] = term->cols & 0xFF;
- b[5] = term->rows >> 8;
- b[6] = term->rows & 0xFF;
+ b[3] = telnet_term_width >> 8;
+ b[4] = telnet_term_width & 0xFF;
+ b[5] = telnet_term_height >> 8;
+ b[6] = telnet_term_height & 0xFF;
b[7] = IAC;
b[8] = SE;
telnet_bufsize = sk_write(s, b, 9);
term->tabs[i] = (i % 8 == 0 ? TRUE : FALSE);
}
term->alt_om = term->dec_om = cfg.dec_om;
- term->alt_wnext = term->wrapnext = term->alt_ins = term->insert = FALSE;
+ term->alt_ins = term->insert = FALSE;
+ term->alt_wnext = term->wrapnext = term->save_wnext = FALSE;
term->alt_wrap = term->wrap = cfg.wrap_mode;
- term->alt_cset = term->cset = 0;
- term->alt_utf = term->utf = 0;
- term->alt_sco_acs = term->sco_acs = 0;
- term->cset_attr[0] = term->cset_attr[1] = ATTR_ASCII;
+ term->alt_cset = term->cset = term->save_cset = 0;
+ term->alt_utf = term->utf = term->save_utf = 0;
+ term->utf_state = 0;
+ term->alt_sco_acs = term->sco_acs = term->save_sco_acs = 0;
+ term->cset_attr[0] = term->cset_attr[1] = term->save_csattr = ATTR_ASCII;
term->rvideo = 0;
term->in_vbell = FALSE;
term->cursor_on = 1;
term->last_paste = 0;
bufchain_init(&term->inbuf);
bufchain_init(&term->printer_buf);
+ term->printing = term->only_printing = FALSE;
+ term->print_job = NULL;
+ term->vt52_mode = FALSE;
+ term->cr_lf_return = FALSE;
+ term->seen_disp_event = FALSE;
+ term->xterm_mouse = FALSE;
+ term->reset_132 = FALSE;
+ term->blinker = term->tblinker = 0;
+ term->has_focus = 1;
+ term->repeat_off = FALSE;
+ term->termstate = TOPLEVEL;
+ term->selstate = NO_SELECTION;
term->screen = term->alt_screen = term->scrollback = NULL;
term->disptop = 0;
update_sbar(term);
term_update(term);
- back->size();
+ back->size(term->cols, term->rows);
}
/*
tattr |= ATTR_WIDE;
/* Video reversing things */
- if (term->seltype == LEXICOGRAPHIC)
- selected = (posle(term->selstart, scrpos) &&
- poslt(scrpos, term->selend));
- else
- selected = (posPle(term->selstart, scrpos) &&
- posPlt(scrpos, term->selend));
+ if (term->selstate == DRAGGING || term->selstate == SELECTED) {
+ if (term->seltype == LEXICOGRAPHIC)
+ selected = (posle(term->selstart, scrpos) &&
+ poslt(scrpos, term->selend));
+ else
+ selected = (posPle(term->selstart, scrpos) &&
+ posPlt(scrpos, term->selend));
+ } else
+ selected = FALSE;
tattr = (tattr ^ rv
^ (selected ? ATTR_REVERSE : 0));
if (term->paste_len == 0)
return;
sfree(term->paste_buffer);
- term->paste_buffer = 0;
+ term->paste_buffer = NULL;
term->paste_len = 0;
}
#include <sys/ioctl.h>
#include "putty.h"
-#include "terminal.h"
#ifndef FALSE
#define FALSE 0
static int pty_stamped_utmp = 0;
static int pty_child_pid;
static int pty_utmp_helper_pid, pty_utmp_helper_pipe;
+static int pty_term_width, pty_term_height;
static sig_atomic_t pty_child_dead;
#ifndef OMIT_UTMP
static struct utmp utmp_entry;
return pty_child_dead;
}
-static void pty_size(void);
-
static void setup_utmp(char *ttyname, char *location)
{
#ifndef OMIT_UTMP
int slavefd;
pid_t pid, pgrp;
+ pty_term_width = cfg.width;
+ pty_term_height = cfg.height;
+
if (pty_master_fd < 0)
pty_open_master();
/*
* Called to set the size of the window
*/
-static void pty_size(void)
+static void pty_size(int width, int height)
{
struct winsize size;
- size.ws_row = (unsigned short)term->rows;
- size.ws_col = (unsigned short)term->cols;
- size.ws_xpixel = (unsigned short) term->cols * font_dimension(0);
- size.ws_ypixel = (unsigned short) term->rows * font_dimension(1);
+ pty_term_width = width;
+ pty_term_height = height;
+
+ size.ws_row = (unsigned short)pty_term_height;
+ size.ws_col = (unsigned short)pty_term_width;
+ size.ws_xpixel = (unsigned short) pty_term_width * font_dimension(0);
+ size.ws_ypixel = (unsigned short) pty_term_height * font_dimension(1);
ioctl(pty_master_fd, TIOCSWINSZ, (void *)&size);
return;
}