#define has_compat(x) ( ((CL_##x)&term->compatibility_level) != 0 )
-char *EMPTY_WINDOW_TITLE = "";
+const char *EMPTY_WINDOW_TITLE = "";
const char sco2ansicolour[] = { 0, 4, 2, 6, 1, 5, 3, 7 };
{
power_on(term, clear);
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
term->disptop = 0;
deselect(term);
term_update(term);
term->no_remote_charset = conf_get_int(term->conf, CONF_no_remote_charset);
term->no_remote_resize = conf_get_int(term->conf, CONF_no_remote_resize);
term->no_remote_wintitle = conf_get_int(term->conf, CONF_no_remote_wintitle);
+ term->no_remote_clearscroll = conf_get_int(term->conf, CONF_no_remote_clearscroll);
term->rawcnp = conf_get_int(term->conf, CONF_rawcnp);
term->rect_select = conf_get_int(term->conf, CONF_rect_select);
term->remote_qtitle_action = conf_get_int(term->conf, CONF_remote_qtitle_action);
termline *ldata;
/* Validate input coordinates, just in case. */
- if (x == 0 || x > term->cols)
+ if (x <= 0 || x > term->cols)
return;
ldata = scrlineptr(y);
case 10: /* DECEDM: set local edit mode */
term->term_editing = state;
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
break;
case 25: /* DECTCEM: enable/disable cursor */
compatibility2(OTHER, VT220);
case 12: /* SRM: set echo mode */
term->term_echoing = !state;
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
break;
case 20: /* LNM: Return sends ... */
term->cr_lf_return = state;
compatibility(VT100);
power_on(term, TRUE);
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
if (term->reset_132) {
if (!term->no_remote_resize)
request_resize(term->frontend, 80, term->rows);
if (i == 3) {
/* Erase Saved Lines (xterm)
* This follows Thomas Dickey's xterm. */
- term_clrsb(term);
+ if (!term->no_remote_clearscroll)
+ term_clrsb(term);
} else {
i++;
if (i > 3)
switch (term->esc_args[0]) {
int x, y, len;
- char buf[80], *p;
+ char buf[80];
+ const char *p;
case 1:
set_iconic(term->frontend, FALSE);
break;
}
term_print_flush(term);
- if (term->logflush)
+ if (term->logflush && term->logctx)
logflush(term->logctx);
}
static void clip_addchar(clip_workbuf *b, wchar_t chr, int attr)
{
if (b->bufpos >= b->buflen) {
- b->buflen += 128;
+ b->buflen *= 2;
b->textbuf = sresize(b->textbuf, b->buflen, wchar_t);
b->textptr = b->textbuf + b->bufpos;
b->attrbuf = sresize(b->attrbuf, b->buflen, int);
} else if (c <= 223 && r <= 223) {
len = sprintf(abuf, "\033[M%c%c%c", encstate + 32, c + 32, r + 32);
}
- ldisc_send(term->ldisc, abuf, len, 0);
+ if (len > 0)
+ ldisc_send(term->ldisc, abuf, len, 0);
}
return;
}
sel_spread(term);
} else if ((bcooked == MBT_SELECT && a == MA_DRAG) ||
(bcooked == MBT_EXTEND && a != MA_RELEASE)) {
+ if (a == MA_DRAG &&
+ (term->selstate == NO_SELECTION || term->selstate == SELECTED)) {
+ /*
+ * This can happen if a front end has passed us a MA_DRAG
+ * without a prior MA_CLICK. OS X GTK does so, for
+ * example, if the initial button press was eaten by the
+ * WM when it activated the window in the first place. The
+ * nicest thing to do in this situation is to ignore
+ * further drags, and wait for the user to click in the
+ * window again properly if they want to select.
+ */
+ return;
+ }
if (term->selstate == ABOUT_TO && poseq(term->selanchor, selpoint))
return;
if (bcooked == MBT_EXTEND && a != MA_DRAG &&
*/
char *term_get_ttymode(Terminal *term, const char *mode)
{
- char *val = NULL;
+ const char *val = NULL;
if (strcmp(mode, "ERASE") == 0) {
val = term->bksp_is_delete ? "^?" : "^H";
+ } else if (strcmp(mode, "IUTF8") == 0) {
+ val = frontend_is_utf8(term->frontend) ? "yes" : "no";
}
/* FIXME: perhaps we should set ONLCR based on lfhascr as well? */
/* FIXME: or ECHO and friends based on local echo state? */
* input.
*/
int term_get_userpass_input(Terminal *term, prompts_t *p,
- unsigned char *in, int inlen)
+ const unsigned char *in, int inlen)
{
struct term_userpass_state *s = (struct term_userpass_state *)p->data;
if (!s) {