Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 48728 | Differences between
and this patch

Collapse All | Expand All

(-)vte.c.orig (-485 / +1265 lines)
Lines 16-22 Link Here
16
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 */
17
 */
18
18
19
#ident "$Id: vte.c,v 1.369 2003/06/16 21:15:09 nalin Exp $"
19
#ident "$Id: vte.c,v 1.393 2004/04/22 03:44:54 nalin Exp $"
20
20
21
#include "../config.h"
21
#include "../config.h"
22
22
Lines 29-35 Link Here
29
#include <fcntl.h>
29
#include <fcntl.h>
30
#include <math.h>
30
#include <math.h>
31
#include <pwd.h>
31
#include <pwd.h>
32
#include <regex.h>
33
#include <signal.h>
32
#include <signal.h>
34
#include <stdio.h>
33
#include <stdio.h>
35
#include <stdlib.h>
34
#include <stdlib.h>
Lines 62-67 Link Here
62
#include "vteconv.h"
61
#include "vteconv.h"
63
#include "vtedraw.h"
62
#include "vtedraw.h"
64
#include "vteint.h"
63
#include "vteint.h"
64
#include "vteregex.h"
65
#include "vtetc.h"
65
#include "vtetc.h"
66
#include <fontconfig/fontconfig.h>
66
#include <fontconfig/fontconfig.h>
67
67
Lines 92-97 Link Here
92
#define VTE_DEF_BG			25
92
#define VTE_DEF_BG			25
93
#define VTE_BOLD_FG			26
93
#define VTE_BOLD_FG			26
94
#define VTE_DIM_FG			27
94
#define VTE_DIM_FG			27
95
#define VTE_DEF_HL			28
96
#define VTE_CUR_BG			29
95
#define VTE_SATURATION_MAX		10000
97
#define VTE_SATURATION_MAX		10000
96
#define VTE_SCROLLBACK_MIN		100
98
#define VTE_SCROLLBACK_MIN		100
97
#define VTE_DEFAULT_EMULATION		"xterm"
99
#define VTE_DEFAULT_EMULATION		"xterm"
Lines 136-142 Link Here
136
138
137
/* A match regex, with a tag. */
139
/* A match regex, with a tag. */
138
struct vte_match_regex {
140
struct vte_match_regex {
139
	regex_t reg;
141
	struct _vte_regex *reg;
140
	gint tag;
142
	gint tag;
141
	GdkCursor *cursor;
143
	GdkCursor *cursor;
142
};
144
};
Lines 172-177 Link Here
172
		gboolean am;
174
		gboolean am;
173
		gboolean bw;
175
		gboolean bw;
174
		gboolean ul;
176
		gboolean ul;
177
		gboolean xn;
175
	} flags;
178
	} flags;
176
	int keypad_mode, cursor_mode;	/* these would be VteKeymodes, but we
179
	int keypad_mode, cursor_mode;	/* these would be VteKeymodes, but we
177
					   need to guarantee its type */
180
					   need to guarantee its type */
Lines 239-245 Link Here
239
							   plus the current
242
							   plus the current
240
							   fore/back */
243
							   fore/back */
241
		struct vte_charcell fill_defaults;	/* original defaults
244
		struct vte_charcell fill_defaults;	/* original defaults
242
							   plust the current
245
							   plus the current
243
							   fore/back with no
246
							   fore/back with no
244
							   character data */
247
							   character data */
245
		struct vte_charcell basic_defaults;	/* original defaults */
248
		struct vte_charcell basic_defaults;	/* original defaults */
Lines 319-324 Link Here
319
	/* Data used when rendering the text which does not require server
322
	/* Data used when rendering the text which does not require server
320
	 * resources and which can be kept after unrealizing. */
323
	 * resources and which can be kept after unrealizing. */
321
	PangoFontDescription *fontdesc;
324
	PangoFontDescription *fontdesc;
325
	VteTerminalAntiAlias fontantialias;
322
	GtkSettings *connected_settings;
326
	GtkSettings *connected_settings;
323
327
324
	/* Data used when rendering the text which reflects server resources
328
	/* Data used when rendering the text which reflects server resources
Lines 327-335 Link Here
327
	struct _vte_draw *draw;
331
	struct _vte_draw *draw;
328
332
329
	gboolean palette_initialized;
333
	gboolean palette_initialized;
334
	gboolean highlight_color_set;
335
	gboolean cursor_color_set;
330
	struct vte_palette_entry {
336
	struct vte_palette_entry {
331
		guint16 red, green, blue;
337
		guint16 red, green, blue;
332
	} palette[VTE_DIM_FG + 1];
338
	} palette[VTE_CUR_BG + 1];
333
339
334
	/* Mouse cursors. */
340
	/* Mouse cursors. */
335
	gboolean mouse_cursor_visible;
341
	gboolean mouse_cursor_visible;
Lines 341-346 Link Here
341
	GtkIMContext *im_context;
347
	GtkIMContext *im_context;
342
	gboolean im_preedit_active;
348
	gboolean im_preedit_active;
343
	char *im_preedit;
349
	char *im_preedit;
350
	PangoAttrList *im_preedit_attrs;
344
	int im_preedit_cursor;
351
	int im_preedit_cursor;
345
352
346
	/* Our accessible peer. */
353
	/* Our accessible peer. */
Lines 366-376 Link Here
366
	GdkVisibilityState visibility_state;
373
	GdkVisibilityState visibility_state;
367
};
374
};
368
375
369
/* A function which can handle a terminal control sequence. */
376
/* A function which can handle a terminal control sequence.  Returns TRUE only
370
typedef void (*VteTerminalSequenceHandler)(VteTerminal *terminal,
377
 * if something happened (usually a signal emission) to which the controlling
371
					   const char *match,
378
 * application must have an immediate opportunity to respond. */
372
					   GQuark match_quark,
379
typedef gboolean (*VteTerminalSequenceHandler)(VteTerminal *terminal,
373
					   GValueArray *params);
380
					       const char *match,
381
					       GQuark match_quark,
382
					       GValueArray *params);
374
static void vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
383
static void vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
375
				     gboolean reset);
384
				     gboolean reset);
376
static void vte_terminal_ensure_cursor(VteTerminal *terminal, gboolean current);
385
static void vte_terminal_ensure_cursor(VteTerminal *terminal, gboolean current);
Lines 381-442 Link Here
381
				     gboolean paint_cells,
390
				     gboolean paint_cells,
382
				     gboolean ensure_after,
391
				     gboolean ensure_after,
383
				     gint forced_width);
392
				     gint forced_width);
384
static void vte_sequence_handler_clear_screen(VteTerminal *terminal,
393
static gboolean vte_sequence_handler_clear_screen(VteTerminal *terminal,
385
					      const char *match,
394
						  const char *match,
386
					      GQuark match_quark,
395
						  GQuark match_quark,
387
					      GValueArray *params);
396
						  GValueArray *params);
388
static void vte_sequence_handler_do(VteTerminal *terminal,
397
static gboolean vte_sequence_handler_do(VteTerminal *terminal,
389
				    const char *match,
398
					const char *match,
390
				    GQuark match_quark,
399
					GQuark match_quark,
391
				    GValueArray *params);
400
					GValueArray *params);
392
static void vte_sequence_handler_DO(VteTerminal *terminal,
401
static gboolean vte_sequence_handler_DO(VteTerminal *terminal,
393
				    const char *match,
402
					const char *match,
394
				    GQuark match_quark,
403
					GQuark match_quark,
395
				    GValueArray *params);
404
					GValueArray *params);
396
static void vte_sequence_handler_ho(VteTerminal *terminal,
405
static gboolean vte_sequence_handler_ho(VteTerminal *terminal,
397
				    const char *match,
406
					const char *match,
398
				    GQuark match_quark,
407
					GQuark match_quark,
399
				    GValueArray *params);
408
					GValueArray *params);
400
static void vte_sequence_handler_le(VteTerminal *terminal,
409
static gboolean vte_sequence_handler_index(VteTerminal *terminal,
401
				    const char *match,
410
					   const char *match,
402
				    GQuark match_quark,
411
					   GQuark match_quark,
403
				    GValueArray *params);
412
					   GValueArray *params);
404
static void vte_sequence_handler_LE(VteTerminal *terminal,
413
static gboolean vte_sequence_handler_le(VteTerminal *terminal,
405
				    const char *match,
414
					const char *match,
406
				    GQuark match_quark,
415
					GQuark match_quark,
407
				    GValueArray *params);
416
					GValueArray *params);
408
static void vte_sequence_handler_nd(VteTerminal *terminal,
417
static gboolean vte_sequence_handler_LE(VteTerminal *terminal,
409
				    const char *match,
418
					    const char *match,
410
				    GQuark match_quark,
419
					    GQuark match_quark,
411
				    GValueArray *params);
420
					    GValueArray *params);
412
static void vte_sequence_handler_sf(VteTerminal *terminal,
421
static gboolean vte_sequence_handler_nd(VteTerminal *terminal,
413
				    const char *match,
422
					const char *match,
414
				    GQuark match_quark,
423
					GQuark match_quark,
415
				    GValueArray *params);
424
					GValueArray *params);
416
static void vte_sequence_handler_sr(VteTerminal *terminal,
425
static gboolean vte_sequence_handler_sf(VteTerminal *terminal,
417
				    const char *match,
426
					const char *match,
418
				    GQuark match_quark,
427
					GQuark match_quark,
419
				    GValueArray *params);
428
					GValueArray *params);
420
static void vte_sequence_handler_ue(VteTerminal *terminal,
429
static gboolean vte_sequence_handler_sr(VteTerminal *terminal,
421
				    const char *match,
430
					const char *match,
422
				    GQuark match_quark,
431
					GQuark match_quark,
423
				    GValueArray *params);
432
					GValueArray *params);
424
static void vte_sequence_handler_up(VteTerminal *terminal,
433
static gboolean vte_sequence_handler_ue(VteTerminal *terminal,
425
				    const char *match,
434
					const char *match,
426
				    GQuark match_quark,
435
					GQuark match_quark,
427
				    GValueArray *params);
436
					GValueArray *params);
428
static void vte_sequence_handler_UP(VteTerminal *terminal,
437
static gboolean vte_sequence_handler_up(VteTerminal *terminal,
429
				    const char *match,
438
					const char *match,
430
				    GQuark match_quark,
439
					GQuark match_quark,
431
				    GValueArray *params);
440
					GValueArray *params);
432
static void vte_sequence_handler_us(VteTerminal *terminal,
441
static gboolean vte_sequence_handler_UP(VteTerminal *terminal,
433
				    const char *match,
442
					const char *match,
434
				    GQuark match_quark,
443
					GQuark match_quark,
435
				    GValueArray *params);
444
					GValueArray *params);
436
static void vte_sequence_handler_vb(VteTerminal *terminal,
445
static gboolean vte_sequence_handler_us(VteTerminal *terminal,
437
				    const char *match,
446
					const char *match,
438
				    GQuark match_quark,
447
					GQuark match_quark,
439
				    GValueArray *params);
448
					GValueArray *params);
449
static gboolean vte_sequence_handler_vb(VteTerminal *terminal,
450
					const char *match,
451
					GQuark match_quark,
452
					GValueArray *params);
440
static gboolean vte_terminal_io_read(GIOChannel *channel,
453
static gboolean vte_terminal_io_read(GIOChannel *channel,
441
				     GdkInputCondition condition,
454
				     GdkInputCondition condition,
442
				     gpointer data);
455
				     gpointer data);
Lines 1378-1385 Link Here
1378
				gdk_cursor_unref(regex->cursor);
1391
				gdk_cursor_unref(regex->cursor);
1379
				regex->cursor = NULL;
1392
				regex->cursor = NULL;
1380
			}
1393
			}
1381
			regfree(&regex->reg);
1394
			_vte_regex_free(regex->reg);
1382
			memset(&regex->reg, 0, sizeof(regex->reg));
1395
			regex->reg = NULL;
1383
			regex->tag = -1;
1396
			regex->tag = -1;
1384
		}
1397
		}
1385
	}
1398
	}
Lines 1416-1423 Link Here
1416
			gdk_cursor_unref(regex->cursor);
1429
			gdk_cursor_unref(regex->cursor);
1417
			regex->cursor = NULL;
1430
			regex->cursor = NULL;
1418
		}
1431
		}
1419
		regfree(&regex->reg);
1432
		_vte_regex_free(regex->reg);
1420
		memset(&regex->reg, 0, sizeof(regex->reg));
1433
		regex->reg = NULL;
1421
		regex->tag = -1;
1434
		regex->tag = -1;
1422
	}
1435
	}
1423
	vte_terminal_match_hilite_clear(terminal);
1436
	vte_terminal_match_hilite_clear(terminal);
Lines 1461-1469 Link Here
1461
	struct vte_match_regex new_regex, *regex;
1474
	struct vte_match_regex new_regex, *regex;
1462
	int ret;
1475
	int ret;
1463
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
1476
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
1477
	g_return_val_if_fail(match != NULL, -1);
1478
	g_return_val_if_fail(strlen(match) > 0, -1);
1464
	memset(&new_regex, 0, sizeof(new_regex));
1479
	memset(&new_regex, 0, sizeof(new_regex));
1465
	ret = regcomp(&new_regex.reg, match, VTE_REGCOMP_FLAGS);
1480
	new_regex.reg = _vte_regex_compile(match);
1466
	if (ret != 0) {
1481
	if (new_regex.reg == NULL) {
1467
		g_warning(_("Error compiling regular expression \"%s\"."),
1482
		g_warning(_("Error compiling regular expression \"%s\"."),
1468
			  match);
1483
			  match);
1469
		return -1;
1484
		return -1;
Lines 1558-1564 Link Here
1558
	struct vte_match_regex *regex = NULL;
1573
	struct vte_match_regex *regex = NULL;
1559
	struct _VteCharAttributes *attr = NULL;
1574
	struct _VteCharAttributes *attr = NULL;
1560
	gssize coffset;
1575
	gssize coffset;
1561
	regmatch_t matches[256];
1576
	struct _vte_regex_match matches[256];
1562
#ifdef VTE_DEBUG
1577
#ifdef VTE_DEBUG
1563
	if (_vte_debug_on(VTE_DEBUG_EVENTS)) {
1578
	if (_vte_debug_on(VTE_DEBUG_EVENTS)) {
1564
		fprintf(stderr, "Checking for match at (%ld,%ld).\n",
1579
		fprintf(stderr, "Checking for match at (%ld,%ld).\n",
Lines 1632-1642 Link Here
1632
		 * matches, so we'll have to skip each match until we
1647
		 * matches, so we'll have to skip each match until we
1633
		 * stop getting matches. */
1648
		 * stop getting matches. */
1634
		coffset = 0;
1649
		coffset = 0;
1635
		ret = regexec(&regex->reg,
1650
		ret = _vte_regex_exec(regex->reg,
1636
			      terminal->pvt->match_contents + coffset,
1651
				      terminal->pvt->match_contents + coffset,
1637
			      G_N_ELEMENTS(matches),
1652
				      G_N_ELEMENTS(matches),
1638
			      matches,
1653
				      matches);
1639
			      VTE_REGEXEC_FLAGS);
1640
		while (ret == 0) {
1654
		while (ret == 0) {
1641
			for (j = 0;
1655
			for (j = 0;
1642
			     (j < G_N_ELEMENTS(matches)) &&
1656
			     (j < G_N_ELEMENTS(matches)) &&
Lines 1704-1714 Link Here
1704
			/* Skip past the beginning of this match to
1718
			/* Skip past the beginning of this match to
1705
			 * look for more. */
1719
			 * look for more. */
1706
			coffset += (matches[0].rm_so + 1);
1720
			coffset += (matches[0].rm_so + 1);
1707
			ret = regexec(&regex->reg,
1721
			ret = _vte_regex_exec(regex->reg,
1708
				      terminal->pvt->match_contents + coffset,
1722
					      terminal->pvt->match_contents +
1709
				      G_N_ELEMENTS(matches),
1723
					      coffset,
1710
				      matches,
1724
					      G_N_ELEMENTS(matches),
1711
				      VTE_REGEXEC_FLAGS);
1725
					      matches);
1712
		}
1726
		}
1713
	}
1727
	}
1714
	terminal->pvt->match_previous = -1;
1728
	terminal->pvt->match_previous = -1;
Lines 1944-1950 Link Here
1944
1958
1945
/* Call another function, offsetting any long arguments by the given
1959
/* Call another function, offsetting any long arguments by the given
1946
 * increment value. */
1960
 * increment value. */
1947
static void
1961
static gboolean
1948
vte_sequence_handler_offset(VteTerminal *terminal,
1962
vte_sequence_handler_offset(VteTerminal *terminal,
1949
			    const char *match,
1963
			    const char *match,
1950
			    GQuark match_quark,
1964
			    GQuark match_quark,
Lines 1964-1974 Link Here
1964
			g_value_set_long(value, val);
1978
			g_value_set_long(value, val);
1965
		}
1979
		}
1966
	}
1980
	}
1967
	handler(terminal, match, match_quark, params);
1981
	return handler(terminal, match, match_quark, params);
1968
}
1982
}
1969
1983
1970
/* Call another function a given number of times, or once. */
1984
/* Call another function a given number of times, or once. */
1971
static void
1985
static gboolean
1972
vte_sequence_handler_multiple(VteTerminal *terminal,
1986
vte_sequence_handler_multiple(VteTerminal *terminal,
1973
			      const char *match,
1987
			      const char *match,
1974
			      GQuark match_quark,
1988
			      GQuark match_quark,
Lines 1976-1983 Link Here
1976
			      VteTerminalSequenceHandler handler)
1990
			      VteTerminalSequenceHandler handler)
1977
{
1991
{
1978
	long val = 1;
1992
	long val = 1;
1979
	int i;
1993
	int i, again;
1980
	GValue *value;
1994
	GValue *value;
1995
1981
	if ((params != NULL) && (params->n_values > 0)) {
1996
	if ((params != NULL) && (params->n_values > 0)) {
1982
		value = g_value_array_get_nth(params, 0);
1997
		value = g_value_array_get_nth(params, 0);
1983
		if (G_VALUE_HOLDS_LONG(value)) {
1998
		if (G_VALUE_HOLDS_LONG(value)) {
Lines 1985-1993 Link Here
1985
			val = MAX(val, 1);	/* FIXME: vttest. */
2000
			val = MAX(val, 1);	/* FIXME: vttest. */
1986
		}
2001
		}
1987
	}
2002
	}
2003
	again = 0;
1988
	for (i = 0; i < val; i++) {
2004
	for (i = 0; i < val; i++) {
1989
		handler(terminal, match, match_quark, NULL);
2005
		if (handler(terminal, match, match_quark, NULL)) {
2006
			again++;
2007
		}
1990
	}
2008
	}
2009
	return (again > 0);
1991
}
2010
}
1992
2011
1993
/* Insert a blank line at an arbitrary position. */
2012
/* Insert a blank line at an arbitrary position. */
Lines 2064-2069 Link Here
2064
	/* Set the terminal's encoding to the new value. */
2083
	/* Set the terminal's encoding to the new value. */
2065
	encoding_quark = g_quark_from_string(codeset);
2084
	encoding_quark = g_quark_from_string(codeset);
2066
	terminal->pvt->encoding = g_quark_to_string(encoding_quark);
2085
	terminal->pvt->encoding = g_quark_to_string(encoding_quark);
2086
	_vte_pty_set_utf8(terminal->pvt->pty_master,
2087
			  (strcmp(codeset, "UTF-8") == 0));
2067
2088
2068
	/* Convert any buffered output bytes. */
2089
	/* Convert any buffered output bytes. */
2069
	if ((_vte_buffer_length(terminal->pvt->outgoing) > 0) &&
2090
	if ((_vte_buffer_length(terminal->pvt->outgoing) > 0) &&
Lines 2125-2141 Link Here
2125
}
2146
}
2126
2147
2127
/* End alternate character set. */
2148
/* End alternate character set. */
2128
static void
2149
static gboolean
2129
vte_sequence_handler_ae(VteTerminal *terminal,
2150
vte_sequence_handler_ae(VteTerminal *terminal,
2130
			const char *match,
2151
			const char *match,
2131
			GQuark match_quark,
2152
			GQuark match_quark,
2132
			GValueArray *params)
2153
			GValueArray *params)
2133
{
2154
{
2134
	terminal->pvt->screen->defaults.alternate = 0;
2155
	terminal->pvt->screen->defaults.alternate = 0;
2156
	return FALSE;
2135
}
2157
}
2136
2158
2137
/* Add a line at the current cursor position. */
2159
/* Add a line at the current cursor position. */
2138
static void
2160
static gboolean
2139
vte_sequence_handler_al(VteTerminal *terminal,
2161
vte_sequence_handler_al(VteTerminal *terminal,
2140
			const char *match,
2162
			const char *match,
2141
			GQuark match_quark,
2163
			GQuark match_quark,
Lines 2183-2208 Link Here
2183
2205
2184
	/* We've modified the display.  Make a note of it. */
2206
	/* We've modified the display.  Make a note of it. */
2185
	terminal->pvt->text_deleted_count++;
2207
	terminal->pvt->text_deleted_count++;
2208
	return FALSE;
2186
}
2209
}
2187
2210
2188
/* Add N lines at the current cursor position. */
2211
/* Add N lines at the current cursor position. */
2189
static void
2212
static gboolean
2190
vte_sequence_handler_AL(VteTerminal *terminal,
2213
vte_sequence_handler_AL(VteTerminal *terminal,
2191
			const char *match,
2214
			const char *match,
2192
			GQuark match_quark,
2215
			GQuark match_quark,
2193
			GValueArray *params)
2216
			GValueArray *params)
2194
{
2217
{
2195
	vte_sequence_handler_al(terminal, match, match_quark, params);
2218
	return vte_sequence_handler_al(terminal, match, match_quark, params);
2196
}
2219
}
2197
2220
2198
/* Start using alternate character set. */
2221
/* Start using alternate character set. */
2199
static void
2222
static gboolean
2200
vte_sequence_handler_as(VteTerminal *terminal,
2223
vte_sequence_handler_as(VteTerminal *terminal,
2201
			const char *match,
2224
			const char *match,
2202
			GQuark match_quark,
2225
			GQuark match_quark,
2203
			GValueArray *params)
2226
			GValueArray *params)
2204
{
2227
{
2205
	terminal->pvt->screen->defaults.alternate = 1;
2228
	terminal->pvt->screen->defaults.alternate = 1;
2229
	return FALSE;
2206
}
2230
}
2207
2231
2208
static void
2232
static void
Lines 2220-2226 Link Here
2220
}
2244
}
2221
2245
2222
/* Beep. */
2246
/* Beep. */
2223
static void
2247
static gboolean
2224
vte_sequence_handler_bl(VteTerminal *terminal,
2248
vte_sequence_handler_bl(VteTerminal *terminal,
2225
			const char *match,
2249
			const char *match,
2226
			GQuark match_quark,
2250
			GQuark match_quark,
Lines 2234-2243 Link Here
2234
		/* Visual bell. */
2258
		/* Visual bell. */
2235
		vte_sequence_handler_vb(terminal, match, match_quark, params);
2259
		vte_sequence_handler_vb(terminal, match, match_quark, params);
2236
	}
2260
	}
2261
	return FALSE;
2237
}
2262
}
2238
2263
2239
/* Backtab. */
2264
/* Backtab. */
2240
static void
2265
static gboolean
2241
vte_sequence_handler_bt(VteTerminal *terminal,
2266
vte_sequence_handler_bt(VteTerminal *terminal,
2242
			const char *match,
2267
			const char *match,
2243
			GQuark match_quark,
2268
			GQuark match_quark,
Lines 2271-2280 Link Here
2271
	}
2296
	}
2272
#endif
2297
#endif
2273
	terminal->pvt->screen->cursor_current.col = newcol;
2298
	terminal->pvt->screen->cursor_current.col = newcol;
2299
	return FALSE;
2274
}
2300
}
2275
2301
2276
/* Clear from the cursor position to the beginning of the line. */
2302
/* Clear from the cursor position to the beginning of the line. */
2277
static void
2303
static gboolean
2278
vte_sequence_handler_cb(VteTerminal *terminal,
2304
vte_sequence_handler_cb(VteTerminal *terminal,
2279
			const char *match,
2305
			const char *match,
2280
			GQuark match_quark,
2306
			GQuark match_quark,
Lines 2314-2323 Link Here
2314
2340
2315
	/* We've modified the display.  Make a note of it. */
2341
	/* We've modified the display.  Make a note of it. */
2316
	terminal->pvt->text_deleted_count++;
2342
	terminal->pvt->text_deleted_count++;
2343
	return FALSE;
2317
}
2344
}
2318
2345
2319
/* Clear to the right of the cursor and below the current line. */
2346
/* Clear to the right of the cursor and below the current line. */
2320
static void
2347
static gboolean
2321
vte_sequence_handler_cd(VteTerminal *terminal,
2348
vte_sequence_handler_cd(VteTerminal *terminal,
2322
			const char *match,
2349
			const char *match,
2323
			GQuark match_quark,
2350
			GQuark match_quark,
Lines 2376-2385 Link Here
2376
2403
2377
	/* We've modified the display.  Make a note of it. */
2404
	/* We've modified the display.  Make a note of it. */
2378
	terminal->pvt->text_deleted_count++;
2405
	terminal->pvt->text_deleted_count++;
2406
	return FALSE;
2379
}
2407
}
2380
2408
2381
/* Clear from the cursor position to the end of the line. */
2409
/* Clear from the cursor position to the end of the line. */
2382
static void
2410
static gboolean
2383
vte_sequence_handler_ce(VteTerminal *terminal,
2411
vte_sequence_handler_ce(VteTerminal *terminal,
2384
			const char *match,
2412
			const char *match,
2385
			GQuark match_quark,
2413
			GQuark match_quark,
Lines 2409-2418 Link Here
2409
2437
2410
	/* We've modified the display.  Make a note of it. */
2438
	/* We've modified the display.  Make a note of it. */
2411
	terminal->pvt->text_deleted_count++;
2439
	terminal->pvt->text_deleted_count++;
2440
	return FALSE;
2412
}
2441
}
2413
2442
2414
/* Move the cursor to the given column (horizontal position). */
2443
/* Move the cursor to the given column (horizontal position). */
2415
static void
2444
static gboolean
2416
vte_sequence_handler_ch(VteTerminal *terminal,
2445
vte_sequence_handler_ch(VteTerminal *terminal,
2417
			const char *match,
2446
			const char *match,
2418
			GQuark match_quark,
2447
			GQuark match_quark,
Lines 2434-2443 Link Here
2434
			screen->cursor_current.col = val;
2463
			screen->cursor_current.col = val;
2435
		}
2464
		}
2436
	}
2465
	}
2466
	return FALSE;
2437
}
2467
}
2438
2468
2439
/* Clear the screen and home the cursor. */
2469
/* Clear the screen and home the cursor. */
2440
static void
2470
static gboolean
2441
vte_sequence_handler_cl(VteTerminal *terminal,
2471
vte_sequence_handler_cl(VteTerminal *terminal,
2442
			const char *match,
2472
			const char *match,
2443
			GQuark match_quark,
2473
			GQuark match_quark,
Lines 2448-2457 Link Here
2448
2478
2449
	/* We've modified the display.  Make a note of it. */
2479
	/* We've modified the display.  Make a note of it. */
2450
	terminal->pvt->text_deleted_count++;
2480
	terminal->pvt->text_deleted_count++;
2481
	return FALSE;
2451
}
2482
}
2452
2483
2453
/* Move the cursor to the given position. */
2484
/* Move the cursor to the given position. */
2454
static void
2485
static gboolean
2455
vte_sequence_handler_cm(VteTerminal *terminal,
2486
vte_sequence_handler_cm(VteTerminal *terminal,
2456
			const char *match,
2487
			const char *match,
2457
			GQuark match_quark,
2488
			GQuark match_quark,
Lines 2484-2493 Link Here
2484
			screen->cursor_current.col = colval;
2515
			screen->cursor_current.col = colval;
2485
		}
2516
		}
2486
	}
2517
	}
2518
	return FALSE;
2487
}
2519
}
2488
2520
2489
/* Clear the current line. */
2521
/* Clear the current line. */
2490
static void
2522
static gboolean
2491
vte_sequence_handler_clear_current_line(VteTerminal *terminal,
2523
vte_sequence_handler_clear_current_line(VteTerminal *terminal,
2492
					const char *match,
2524
					const char *match,
2493
					GQuark match_quark,
2525
					GQuark match_quark,
Lines 2521-2540 Link Here
2521
2553
2522
	/* We've modified the display.  Make a note of it. */
2554
	/* We've modified the display.  Make a note of it. */
2523
	terminal->pvt->text_deleted_count++;
2555
	terminal->pvt->text_deleted_count++;
2556
	return FALSE;
2524
}
2557
}
2525
2558
2526
/* Carriage return. */
2559
/* Carriage return. */
2527
static void
2560
static gboolean
2528
vte_sequence_handler_cr(VteTerminal *terminal,
2561
vte_sequence_handler_cr(VteTerminal *terminal,
2529
			const char *match,
2562
			const char *match,
2530
			GQuark match_quark,
2563
			GQuark match_quark,
2531
			GValueArray *params)
2564
			GValueArray *params)
2532
{
2565
{
2533
	terminal->pvt->screen->cursor_current.col = 0;
2566
	terminal->pvt->screen->cursor_current.col = 0;
2567
	return FALSE;
2534
}
2568
}
2535
2569
2536
/* Restrict scrolling and updates to a subset of the visible lines. */
2570
/* Restrict scrolling and updates to a subset of the visible lines. */
2537
static void
2571
static gboolean
2538
vte_sequence_handler_cs(VteTerminal *terminal,
2572
vte_sequence_handler_cs(VteTerminal *terminal,
2539
			const char *match,
2573
			const char *match,
2540
			GQuark match_quark,
2574
			GQuark match_quark,
Lines 2548-2554 Link Here
2548
	screen = terminal->pvt->screen;
2582
	screen = terminal->pvt->screen;
2549
	if ((params == NULL) || (params->n_values < 2)) {
2583
	if ((params == NULL) || (params->n_values < 2)) {
2550
		screen->scrolling_restricted = FALSE;
2584
		screen->scrolling_restricted = FALSE;
2551
		return;
2585
		return FALSE;
2552
	}
2586
	}
2553
	/* Extract the two values. */
2587
	/* Extract the two values. */
2554
	value = g_value_array_get_nth(params, 0);
2588
	value = g_value_array_get_nth(params, 0);
Lines 2577-2587 Link Here
2577
					   screen->insert_delta + start,
2611
					   screen->insert_delta + start,
2578
					   screen->insert_delta + end);
2612
					   screen->insert_delta + end);
2579
	vte_terminal_ensure_cursor(terminal, TRUE);
2613
	vte_terminal_ensure_cursor(terminal, TRUE);
2614
	return FALSE;
2580
}
2615
}
2581
2616
2582
/* Restrict scrolling and updates to a subset of the visible lines, because
2617
/* Restrict scrolling and updates to a subset of the visible lines, because
2583
 * GNU Emacs is special. */
2618
 * GNU Emacs is special. */
2584
static void
2619
static gboolean
2585
vte_sequence_handler_cS(VteTerminal *terminal,
2620
vte_sequence_handler_cS(VteTerminal *terminal,
2586
			const char *match,
2621
			const char *match,
2587
			GQuark match_quark,
2622
			GQuark match_quark,
Lines 2595-2601 Link Here
2595
	screen = terminal->pvt->screen;
2630
	screen = terminal->pvt->screen;
2596
	if ((params == NULL) || (params->n_values < 2)) {
2631
	if ((params == NULL) || (params->n_values < 2)) {
2597
		screen->scrolling_restricted = FALSE;
2632
		screen->scrolling_restricted = FALSE;
2598
		return;
2633
		return FALSE;
2599
	}
2634
	}
2600
	/* Extract the two parameters we care about, encoded as the number
2635
	/* Extract the two parameters we care about, encoded as the number
2601
	 * of lines above and below the scrolling region, respectively. */
2636
	 * of lines above and below the scrolling region, respectively. */
Lines 2618-2627 Link Here
2618
					   screen->insert_delta + start,
2653
					   screen->insert_delta + start,
2619
					   screen->insert_delta + end);
2654
					   screen->insert_delta + end);
2620
	vte_terminal_ensure_cursor(terminal, TRUE);
2655
	vte_terminal_ensure_cursor(terminal, TRUE);
2656
	return FALSE;
2621
}
2657
}
2622
2658
2623
/* Clear all tab stops. */
2659
/* Clear all tab stops. */
2624
static void
2660
static gboolean
2625
vte_sequence_handler_ct(VteTerminal *terminal,
2661
vte_sequence_handler_ct(VteTerminal *terminal,
2626
			const char *match,
2662
			const char *match,
2627
			GQuark match_quark,
2663
			GQuark match_quark,
Lines 2631-2640 Link Here
2631
		g_hash_table_destroy(terminal->pvt->tabstops);
2667
		g_hash_table_destroy(terminal->pvt->tabstops);
2632
		terminal->pvt->tabstops = NULL;
2668
		terminal->pvt->tabstops = NULL;
2633
	}
2669
	}
2670
	return FALSE;
2634
}
2671
}
2635
2672
2636
/* Move the cursor to the lower left-hand corner. */
2673
/* Move the cursor to the lower left-hand corner. */
2637
static void
2674
static gboolean
2638
vte_sequence_handler_cursor_lower_left(VteTerminal *terminal,
2675
vte_sequence_handler_cursor_lower_left(VteTerminal *terminal,
2639
				       const char *match,
2676
				       const char *match,
2640
				       GQuark match_quark,
2677
				       GQuark match_quark,
Lines 2647-2678 Link Here
2647
	screen->cursor_current.row = screen->insert_delta + row;
2684
	screen->cursor_current.row = screen->insert_delta + row;
2648
	screen->cursor_current.col = 0;
2685
	screen->cursor_current.col = 0;
2649
	vte_terminal_ensure_cursor(terminal, TRUE);
2686
	vte_terminal_ensure_cursor(terminal, TRUE);
2687
	return FALSE;
2650
}
2688
}
2651
2689
2652
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
2690
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
2653
static void
2691
static gboolean
2654
vte_sequence_handler_cursor_next_line(VteTerminal *terminal,
2692
vte_sequence_handler_cursor_next_line(VteTerminal *terminal,
2655
				      const char *match,
2693
				      const char *match,
2656
				      GQuark match_quark,
2694
				      GQuark match_quark,
2657
				      GValueArray *params)
2695
				      GValueArray *params)
2658
{
2696
{
2659
	terminal->pvt->screen->cursor_current.col = 0;
2697
	terminal->pvt->screen->cursor_current.col = 0;
2660
	vte_sequence_handler_DO(terminal, match, match_quark, params);
2698
	return vte_sequence_handler_DO(terminal, match, match_quark, params);
2661
}
2699
}
2662
2700
2663
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
2701
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
2664
static void
2702
static gboolean
2665
vte_sequence_handler_cursor_preceding_line(VteTerminal *terminal,
2703
vte_sequence_handler_cursor_preceding_line(VteTerminal *terminal,
2666
					   const char *match,
2704
					   const char *match,
2667
					   GQuark match_quark,
2705
					   GQuark match_quark,
2668
					   GValueArray *params)
2706
					   GValueArray *params)
2669
{
2707
{
2670
	terminal->pvt->screen->cursor_current.col = 0;
2708
	terminal->pvt->screen->cursor_current.col = 0;
2671
	vte_sequence_handler_UP(terminal, match, match_quark, params);
2709
	return vte_sequence_handler_UP(terminal, match, match_quark, params);
2672
}
2710
}
2673
2711
2674
/* Move the cursor to the given row (vertical position). */
2712
/* Move the cursor to the given row (vertical position). */
2675
static void
2713
static gboolean
2676
vte_sequence_handler_cv(VteTerminal *terminal,
2714
vte_sequence_handler_cv(VteTerminal *terminal,
2677
			const char *match,
2715
			const char *match,
2678
			GQuark match_quark,
2716
			GQuark match_quark,
Lines 2698-2707 Link Here
2698
			screen->cursor_current.row = screen->insert_delta + val;
2736
			screen->cursor_current.row = screen->insert_delta + val;
2699
		}
2737
		}
2700
	}
2738
	}
2739
	return FALSE;
2701
}
2740
}
2702
2741
2703
/* Delete a character at the current cursor position. */
2742
/* Delete a character at the current cursor position. */
2704
static void
2743
static gboolean
2705
vte_sequence_handler_dc(VteTerminal *terminal,
2744
vte_sequence_handler_dc(VteTerminal *terminal,
2706
			const char *match,
2745
			const char *match,
2707
			GQuark match_quark,
2746
			GQuark match_quark,
Lines 2735-2755 Link Here
2735
2774
2736
	/* We've modified the display.  Make a note of it. */
2775
	/* We've modified the display.  Make a note of it. */
2737
	terminal->pvt->text_deleted_count++;
2776
	terminal->pvt->text_deleted_count++;
2777
	return FALSE;
2738
}
2778
}
2739
2779
2740
/* Delete N characters at the current cursor position. */
2780
/* Delete N characters at the current cursor position. */
2741
static void
2781
static gboolean
2742
vte_sequence_handler_DC(VteTerminal *terminal,
2782
vte_sequence_handler_DC(VteTerminal *terminal,
2743
			const char *match,
2783
			const char *match,
2744
			GQuark match_quark,
2784
			GQuark match_quark,
2745
			GValueArray *params)
2785
			GValueArray *params)
2746
{
2786
{
2747
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
2787
	return vte_sequence_handler_multiple(terminal, match, match_quark,
2748
				      vte_sequence_handler_dc);
2788
					     params, vte_sequence_handler_dc);
2749
}
2789
}
2750
2790
2751
/* Delete a line at the current cursor position. */
2791
/* Delete a line at the current cursor position. */
2752
static void
2792
static gboolean
2753
vte_sequence_handler_dl(VteTerminal *terminal,
2793
vte_sequence_handler_dl(VteTerminal *terminal,
2754
			const char *match,
2794
			const char *match,
2755
			GQuark match_quark,
2795
			GQuark match_quark,
Lines 2790-2805 Link Here
2790
2830
2791
	/* We've modified the display.  Make a note of it. */
2831
	/* We've modified the display.  Make a note of it. */
2792
	terminal->pvt->text_deleted_count++;
2832
	terminal->pvt->text_deleted_count++;
2833
	return FALSE;
2793
}
2834
}
2794
2835
2795
/* Delete N lines at the current cursor position. */
2836
/* Delete N lines at the current cursor position. */
2796
static void
2837
static gboolean
2797
vte_sequence_handler_DL(VteTerminal *terminal,
2838
vte_sequence_handler_DL(VteTerminal *terminal,
2798
			const char *match,
2839
			const char *match,
2799
			GQuark match_quark,
2840
			GQuark match_quark,
2800
			GValueArray *params)
2841
			GValueArray *params)
2801
{
2842
{
2802
	vte_sequence_handler_dl(terminal, match, match_quark, params);
2843
	return vte_sequence_handler_dl(terminal, match, match_quark, params);
2803
}
2844
}
2804
2845
2805
/* Make sure we have enough rows and columns to hold data at the current
2846
/* Make sure we have enough rows and columns to hold data at the current
Lines 2878-2884 Link Here
2878
}
2919
}
2879
2920
2880
/* Cursor down, no scrolling. */
2921
/* Cursor down, no scrolling. */
2881
static void
2922
static gboolean
2882
vte_sequence_handler_do(VteTerminal *terminal,
2923
vte_sequence_handler_do(VteTerminal *terminal,
2883
			const char *match,
2924
			const char *match,
2884
			GQuark match_quark,
2925
			GQuark match_quark,
Lines 2901-2932 Link Here
2901
2942
2902
	/* Move the cursor down. */
2943
	/* Move the cursor down. */
2903
	screen->cursor_current.row = MIN(screen->cursor_current.row + 1, end);
2944
	screen->cursor_current.row = MIN(screen->cursor_current.row + 1, end);
2945
	return FALSE;
2904
}
2946
}
2905
2947
2906
/* Cursor down, no scrolling. */
2948
/* Cursor down, no scrolling. */
2907
static void
2949
static gboolean
2908
vte_sequence_handler_DO(VteTerminal *terminal,
2950
vte_sequence_handler_DO(VteTerminal *terminal,
2909
			const char *match,
2951
			const char *match,
2910
			GQuark match_quark,
2952
			GQuark match_quark,
2911
			GValueArray *params)
2953
			GValueArray *params)
2912
{
2954
{
2913
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
2955
	return vte_sequence_handler_multiple(terminal, match, match_quark,
2914
				      vte_sequence_handler_do);
2956
					     params, vte_sequence_handler_do);
2915
}
2957
}
2916
2958
2917
/* Start using alternate character set. */
2959
/* Start using alternate character set. */
2918
static void
2960
static gboolean
2919
vte_sequence_handler_eA(VteTerminal *terminal,
2961
vte_sequence_handler_eA(VteTerminal *terminal,
2920
			const char *match,
2962
			const char *match,
2921
			GQuark match_quark,
2963
			GQuark match_quark,
2922
			GValueArray *params)
2964
			GValueArray *params)
2923
{
2965
{
2924
	vte_sequence_handler_ae(terminal, match, match_quark, params);
2966
	return vte_sequence_handler_ae(terminal, match, match_quark, params);
2925
}
2967
}
2926
2968
2927
/* Erase characters starting at the cursor position (overwriting N with
2969
/* Erase characters starting at the cursor position (overwriting N with
2928
 * spaces, but not moving the cursor). */
2970
 * spaces, but not moving the cursor). */
2929
static void
2971
static gboolean
2930
vte_sequence_handler_ec(VteTerminal *terminal,
2972
vte_sequence_handler_ec(VteTerminal *terminal,
2931
			const char *match,
2973
			const char *match,
2932
			GQuark match_quark,
2974
			GQuark match_quark,
Lines 2984-3013 Link Here
2984
3026
2985
	/* We've modified the display.  Make a note of it. */
3027
	/* We've modified the display.  Make a note of it. */
2986
	terminal->pvt->text_deleted_count++;
3028
	terminal->pvt->text_deleted_count++;
3029
	return FALSE;
2987
}
3030
}
2988
3031
2989
/* End insert mode. */
3032
/* End insert mode. */
2990
static void
3033
static gboolean
2991
vte_sequence_handler_ei(VteTerminal *terminal,
3034
vte_sequence_handler_ei(VteTerminal *terminal,
2992
			const char *match,
3035
			const char *match,
2993
			GQuark match_quark,
3036
			GQuark match_quark,
2994
			GValueArray *params)
3037
			GValueArray *params)
2995
{
3038
{
2996
	terminal->pvt->screen->insert_mode = FALSE;
3039
	terminal->pvt->screen->insert_mode = FALSE;
3040
	return FALSE;
3041
}
3042
3043
/* Form-feed / next-page. */
3044
static gboolean
3045
vte_sequence_handler_form_feed(VteTerminal *terminal,
3046
			       const char *match,
3047
			       GQuark match_quark,
3048
			       GValueArray *params)
3049
{
3050
	return vte_sequence_handler_index(terminal, match, match_quark, params);
2997
}
3051
}
2998
3052
2999
/* Move from status line. */
3053
/* Move from status line. */
3000
static void
3054
static gboolean
3001
vte_sequence_handler_fs(VteTerminal *terminal,
3055
vte_sequence_handler_fs(VteTerminal *terminal,
3002
			const char *match,
3056
			const char *match,
3003
			GQuark match_quark,
3057
			GQuark match_quark,
3004
			GValueArray *params)
3058
			GValueArray *params)
3005
{
3059
{
3006
	terminal->pvt->screen->status_line = FALSE;
3060
	terminal->pvt->screen->status_line = FALSE;
3061
	return FALSE;
3007
}
3062
}
3008
3063
3009
/* Move the cursor to the home position. */
3064
/* Move the cursor to the home position. */
3010
static void
3065
static gboolean
3011
vte_sequence_handler_ho(VteTerminal *terminal,
3066
vte_sequence_handler_ho(VteTerminal *terminal,
3012
			const char *match,
3067
			const char *match,
3013
			GQuark match_quark,
3068
			GQuark match_quark,
Lines 3017-3037 Link Here
3017
	screen = terminal->pvt->screen;
3072
	screen = terminal->pvt->screen;
3018
	screen->cursor_current.row = screen->insert_delta;
3073
	screen->cursor_current.row = screen->insert_delta;
3019
	screen->cursor_current.col = 0;
3074
	screen->cursor_current.col = 0;
3075
	return FALSE;
3020
}
3076
}
3021
3077
3022
/* Move the cursor to a specified position. */
3078
/* Move the cursor to a specified position. */
3023
static void
3079
static gboolean
3024
vte_sequence_handler_horizontal_and_vertical_position(VteTerminal *terminal,
3080
vte_sequence_handler_horizontal_and_vertical_position(VteTerminal *terminal,
3025
						      const char *match,
3081
						      const char *match,
3026
						      GQuark match_quark,
3082
						      GQuark match_quark,
3027
						      GValueArray *params)
3083
						      GValueArray *params)
3028
{
3084
{
3029
	vte_sequence_handler_offset(terminal, match, match_quark, params,
3085
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
3030
				    -1, vte_sequence_handler_cm);
3086
					   -1, vte_sequence_handler_cm);
3031
}
3087
}
3032
3088
3033
/* Insert a character. */
3089
/* Insert a character. */
3034
static void
3090
static gboolean
3035
vte_sequence_handler_ic(VteTerminal *terminal,
3091
vte_sequence_handler_ic(VteTerminal *terminal,
3036
			const char *match,
3092
			const char *match,
3037
			GQuark match_quark,
3093
			GQuark match_quark,
Lines 3047-3119 Link Here
3047
	vte_terminal_insert_char(terminal, ' ', TRUE, TRUE, TRUE, TRUE, 0);
3103
	vte_terminal_insert_char(terminal, ' ', TRUE, TRUE, TRUE, TRUE, 0);
3048
3104
3049
	screen->cursor_current = save;
3105
	screen->cursor_current = save;
3106
3107
	return FALSE;
3050
}
3108
}
3051
3109
3052
/* Insert N characters. */
3110
/* Insert N characters. */
3053
static void
3111
static gboolean
3054
vte_sequence_handler_IC(VteTerminal *terminal,
3112
vte_sequence_handler_IC(VteTerminal *terminal,
3055
			const char *match,
3113
			const char *match,
3056
			GQuark match_quark,
3114
			GQuark match_quark,
3057
			GValueArray *params)
3115
			GValueArray *params)
3058
{
3116
{
3059
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3117
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3060
				      vte_sequence_handler_ic);
3118
					     params, vte_sequence_handler_ic);
3061
}
3119
}
3062
3120
3063
/* Begin insert mode. */
3121
/* Begin insert mode. */
3064
static void
3122
static gboolean
3065
vte_sequence_handler_im(VteTerminal *terminal,
3123
vte_sequence_handler_im(VteTerminal *terminal,
3066
			const char *match,
3124
			const char *match,
3067
			GQuark match_quark,
3125
			GQuark match_quark,
3068
			GValueArray *params)
3126
			GValueArray *params)
3069
{
3127
{
3070
	terminal->pvt->screen->insert_mode = TRUE;
3128
	terminal->pvt->screen->insert_mode = TRUE;
3129
	return FALSE;
3071
}
3130
}
3072
3131
3073
/* Cursor down, with scrolling. */
3132
/* Cursor down, with scrolling. */
3074
static void
3133
static gboolean
3075
vte_sequence_handler_index(VteTerminal *terminal,
3134
vte_sequence_handler_index(VteTerminal *terminal,
3076
			   const char *match,
3135
			   const char *match,
3077
			   GQuark match_quark,
3136
			   GQuark match_quark,
3078
			   GValueArray *params)
3137
			   GValueArray *params)
3079
{
3138
{
3080
	vte_sequence_handler_sf(terminal, match, match_quark, params);
3139
	return vte_sequence_handler_sf(terminal, match, match_quark, params);
3081
}
3140
}
3082
3141
3083
/* Send me a backspace key sym, will you?  Guess that the application meant
3142
/* Send me a backspace key sym, will you?  Guess that the application meant
3084
 * to send the cursor back one position. */
3143
 * to send the cursor back one position. */
3085
static void
3144
static gboolean
3086
vte_sequence_handler_kb(VteTerminal *terminal,
3145
vte_sequence_handler_kb(VteTerminal *terminal,
3087
			const char *match,
3146
			const char *match,
3088
			GQuark match_quark,
3147
			GQuark match_quark,
3089
			GValueArray *params)
3148
			GValueArray *params)
3090
{
3149
{
3091
	/* Move the cursor left. */
3150
	/* Move the cursor left. */
3092
	vte_sequence_handler_le(terminal, match, match_quark, params);
3151
	return vte_sequence_handler_le(terminal, match, match_quark, params);
3093
}
3152
}
3094
3153
3095
/* Keypad mode end. */
3154
/* Keypad mode end. */
3096
static void
3155
static gboolean
3097
vte_sequence_handler_ke(VteTerminal *terminal,
3156
vte_sequence_handler_ke(VteTerminal *terminal,
3098
			const char *match,
3157
			const char *match,
3099
			GQuark match_quark,
3158
			GQuark match_quark,
3100
			GValueArray *params)
3159
			GValueArray *params)
3101
{
3160
{
3102
	terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
3161
	terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
3162
	return FALSE;
3103
}
3163
}
3104
3164
3105
/* Keypad mode start. */
3165
/* Keypad mode start. */
3106
static void
3166
static gboolean
3107
vte_sequence_handler_ks(VteTerminal *terminal,
3167
vte_sequence_handler_ks(VteTerminal *terminal,
3108
			const char *match,
3168
			const char *match,
3109
			GQuark match_quark,
3169
			GQuark match_quark,
3110
			GValueArray *params)
3170
			GValueArray *params)
3111
{
3171
{
3112
	terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
3172
	terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
3173
	return FALSE;
3113
}
3174
}
3114
3175
3115
/* Cursor left. */
3176
/* Cursor left. */
3116
static void
3177
static gboolean
3117
vte_sequence_handler_le(VteTerminal *terminal,
3178
vte_sequence_handler_le(VteTerminal *terminal,
3118
			const char *match,
3179
			const char *match,
3119
			GQuark match_quark,
3180
			GQuark match_quark,
Lines 3136-3156 Link Here
3136
			screen->cursor_current.col = 0;
3197
			screen->cursor_current.col = 0;
3137
		}
3198
		}
3138
	}
3199
	}
3200
	return FALSE;
3139
}
3201
}
3140
3202
3141
/* Move the cursor left N columns. */
3203
/* Move the cursor left N columns. */
3142
static void
3204
static gboolean
3143
vte_sequence_handler_LE(VteTerminal *terminal,
3205
vte_sequence_handler_LE(VteTerminal *terminal,
3144
			const char *match,
3206
			const char *match,
3145
			GQuark match_quark,
3207
			GQuark match_quark,
3146
			GValueArray *params)
3208
			GValueArray *params)
3147
{
3209
{
3148
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3210
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3149
				      vte_sequence_handler_le);
3211
					     params, vte_sequence_handler_le);
3150
}
3212
}
3151
3213
3152
/* Move the cursor to the lower left corner of the display. */
3214
/* Move the cursor to the lower left corner of the display. */
3153
static void
3215
static gboolean
3154
vte_sequence_handler_ll(VteTerminal *terminal,
3216
vte_sequence_handler_ll(VteTerminal *terminal,
3155
			const char *match,
3217
			const char *match,
3156
			GQuark match_quark,
3218
			GQuark match_quark,
Lines 3162-3181 Link Here
3162
					 screen->insert_delta +
3224
					 screen->insert_delta +
3163
					 terminal->row_count - 1);
3225
					 terminal->row_count - 1);
3164
	screen->cursor_current.col = 0;
3226
	screen->cursor_current.col = 0;
3227
	return FALSE;
3165
}
3228
}
3166
3229
3167
/* Blink on. */
3230
/* Blink on. */
3168
static void
3231
static gboolean
3169
vte_sequence_handler_mb(VteTerminal *terminal,
3232
vte_sequence_handler_mb(VteTerminal *terminal,
3170
			const char *match,
3233
			const char *match,
3171
			GQuark match_quark,
3234
			GQuark match_quark,
3172
			GValueArray *params)
3235
			GValueArray *params)
3173
{
3236
{
3174
	terminal->pvt->screen->defaults.blink = 1;
3237
	terminal->pvt->screen->defaults.blink = 1;
3238
	return FALSE;
3175
}
3239
}
3176
3240
3177
/* Bold on. */
3241
/* Bold on. */
3178
static void
3242
static gboolean
3179
vte_sequence_handler_md(VteTerminal *terminal,
3243
vte_sequence_handler_md(VteTerminal *terminal,
3180
			const char *match,
3244
			const char *match,
3181
			GQuark match_quark,
3245
			GQuark match_quark,
Lines 3183-3202 Link Here
3183
{
3247
{
3184
	terminal->pvt->screen->defaults.bold = 1;
3248
	terminal->pvt->screen->defaults.bold = 1;
3185
	terminal->pvt->screen->defaults.half = 0;
3249
	terminal->pvt->screen->defaults.half = 0;
3250
	return FALSE;
3186
}
3251
}
3187
3252
3188
/* End modes. */
3253
/* End modes. */
3189
static void
3254
static gboolean
3190
vte_sequence_handler_me(VteTerminal *terminal,
3255
vte_sequence_handler_me(VteTerminal *terminal,
3191
			const char *match,
3256
			const char *match,
3192
			GQuark match_quark,
3257
			GQuark match_quark,
3193
			GValueArray *params)
3258
			GValueArray *params)
3194
{
3259
{
3195
	vte_terminal_set_default_attributes(terminal);
3260
	vte_terminal_set_default_attributes(terminal);
3261
	return FALSE;
3196
}
3262
}
3197
3263
3198
/* Half-bright on. */
3264
/* Half-bright on. */
3199
static void
3265
static gboolean
3200
vte_sequence_handler_mh(VteTerminal *terminal,
3266
vte_sequence_handler_mh(VteTerminal *terminal,
3201
			const char *match,
3267
			const char *match,
3202
			GQuark match_quark,
3268
			GQuark match_quark,
Lines 3204-3243 Link Here
3204
{
3270
{
3205
	terminal->pvt->screen->defaults.half = 1;
3271
	terminal->pvt->screen->defaults.half = 1;
3206
	terminal->pvt->screen->defaults.bold = 0;
3272
	terminal->pvt->screen->defaults.bold = 0;
3273
	return FALSE;
3207
}
3274
}
3208
3275
3209
/* Invisible on. */
3276
/* Invisible on. */
3210
static void
3277
static gboolean
3211
vte_sequence_handler_mk(VteTerminal *terminal,
3278
vte_sequence_handler_mk(VteTerminal *terminal,
3212
			const char *match,
3279
			const char *match,
3213
			GQuark match_quark,
3280
			GQuark match_quark,
3214
			GValueArray *params)
3281
			GValueArray *params)
3215
{
3282
{
3216
	terminal->pvt->screen->defaults.invisible = 1;
3283
	terminal->pvt->screen->defaults.invisible = 1;
3284
	return FALSE;
3217
}
3285
}
3218
3286
3219
/* Protect on. */
3287
/* Protect on. */
3220
static void
3288
static gboolean
3221
vte_sequence_handler_mp(VteTerminal *terminal,
3289
vte_sequence_handler_mp(VteTerminal *terminal,
3222
			const char *match,
3290
			const char *match,
3223
			GQuark match_quark,
3291
			GQuark match_quark,
3224
			GValueArray *params)
3292
			GValueArray *params)
3225
{
3293
{
3226
	terminal->pvt->screen->defaults.protect = 1;
3294
	terminal->pvt->screen->defaults.protect = 1;
3295
	return FALSE;
3227
}
3296
}
3228
3297
3229
/* Reverse on. */
3298
/* Reverse on. */
3230
static void
3299
static gboolean
3231
vte_sequence_handler_mr(VteTerminal *terminal,
3300
vte_sequence_handler_mr(VteTerminal *terminal,
3232
			const char *match,
3301
			const char *match,
3233
			GQuark match_quark,
3302
			GQuark match_quark,
3234
			GValueArray *params)
3303
			GValueArray *params)
3235
{
3304
{
3236
	terminal->pvt->screen->defaults.reverse = 1;
3305
	terminal->pvt->screen->defaults.reverse = 1;
3306
	return FALSE;
3237
}
3307
}
3238
3308
3239
/* Cursor right. */
3309
/* Cursor right. */
3240
static void
3310
static gboolean
3241
vte_sequence_handler_nd(VteTerminal *terminal,
3311
vte_sequence_handler_nd(VteTerminal *terminal,
3242
			const char *match,
3312
			const char *match,
3243
			GQuark match_quark,
3313
			GQuark match_quark,
Lines 3249-3288 Link Here
3249
		/* There's room to move right. */
3319
		/* There's room to move right. */
3250
		screen->cursor_current.col++;
3320
		screen->cursor_current.col++;
3251
	}
3321
	}
3322
	return FALSE;
3252
}
3323
}
3253
3324
3254
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
3325
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
3255
static void
3326
static gboolean
3256
vte_sequence_handler_next_line(VteTerminal *terminal,
3327
vte_sequence_handler_next_line(VteTerminal *terminal,
3257
			       const char *match,
3328
			       const char *match,
3258
			       GQuark match_quark,
3329
			       GQuark match_quark,
3259
			       GValueArray *params)
3330
			       GValueArray *params)
3260
{
3331
{
3261
	terminal->pvt->screen->cursor_current.col = 0;
3332
	terminal->pvt->screen->cursor_current.col = 0;
3262
	vte_sequence_handler_DO(terminal, match, match_quark, params);
3333
	return vte_sequence_handler_DO(terminal, match, match_quark, params);
3263
}
3334
}
3264
3335
3265
/* No-op. */
3336
/* No-op. */
3266
static void
3337
static gboolean
3267
vte_sequence_handler_noop(VteTerminal *terminal,
3338
vte_sequence_handler_noop(VteTerminal *terminal,
3268
			  const char *match,
3339
			  const char *match,
3269
			  GQuark match_quark,
3340
			  GQuark match_quark,
3270
			  GValueArray *params)
3341
			  GValueArray *params)
3271
{
3342
{
3343
	return FALSE;
3272
}
3344
}
3273
3345
3274
/* Carriage return command(?). */
3346
/* Carriage return command(?). */
3275
static void
3347
static gboolean
3276
vte_sequence_handler_nw(VteTerminal *terminal,
3348
vte_sequence_handler_nw(VteTerminal *terminal,
3277
			const char *match,
3349
			const char *match,
3278
			GQuark match_quark,
3350
			GQuark match_quark,
3279
			GValueArray *params)
3351
			GValueArray *params)
3280
{
3352
{
3281
	vte_sequence_handler_cr(terminal, match, match_quark, params);
3353
	return vte_sequence_handler_cr(terminal, match, match_quark, params);
3282
}
3354
}
3283
3355
3284
/* Restore cursor (position). */
3356
/* Restore cursor (position). */
3285
static void
3357
static gboolean
3286
vte_sequence_handler_rc(VteTerminal *terminal,
3358
vte_sequence_handler_rc(VteTerminal *terminal,
3287
			const char *match,
3359
			const char *match,
3288
			GQuark match_quark,
3360
			GQuark match_quark,
Lines 3296-3326 Link Here
3296
					   screen->insert_delta,
3368
					   screen->insert_delta,
3297
					   screen->insert_delta +
3369
					   screen->insert_delta +
3298
					   terminal->row_count - 1);
3370
					   terminal->row_count - 1);
3371
	return FALSE;
3299
}
3372
}
3300
3373
3301
/* Cursor down, with scrolling. */
3374
/* Cursor down, with scrolling. */
3302
static void
3375
static gboolean
3303
vte_sequence_handler_reverse_index(VteTerminal *terminal,
3376
vte_sequence_handler_reverse_index(VteTerminal *terminal,
3304
				   const char *match,
3377
				   const char *match,
3305
				   GQuark match_quark,
3378
				   GQuark match_quark,
3306
				   GValueArray *params)
3379
				   GValueArray *params)
3307
{
3380
{
3308
	vte_sequence_handler_sr(terminal, match, match_quark, params);
3381
	return vte_sequence_handler_sr(terminal, match, match_quark, params);
3309
}
3382
}
3310
3383
3311
/* Cursor right N characters. */
3384
/* Cursor right N characters. */
3312
static void
3385
static gboolean
3313
vte_sequence_handler_RI(VteTerminal *terminal,
3386
vte_sequence_handler_RI(VteTerminal *terminal,
3314
			const char *match,
3387
			const char *match,
3315
			GQuark match_quark,
3388
			GQuark match_quark,
3316
			GValueArray *params)
3389
			GValueArray *params)
3317
{
3390
{
3318
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3391
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3319
				      vte_sequence_handler_nd);
3392
					     params, vte_sequence_handler_nd);
3320
}
3393
}
3321
3394
3322
/* Save cursor (position). */
3395
/* Save cursor (position). */
3323
static void
3396
static gboolean
3324
vte_sequence_handler_sc(VteTerminal *terminal,
3397
vte_sequence_handler_sc(VteTerminal *terminal,
3325
			const char *match,
3398
			const char *match,
3326
			GQuark match_quark,
3399
			GQuark match_quark,
Lines 3332-3341 Link Here
3332
	screen->cursor_saved.row = CLAMP(screen->cursor_current.row -
3405
	screen->cursor_saved.row = CLAMP(screen->cursor_current.row -
3333
					 screen->insert_delta,
3406
					 screen->insert_delta,
3334
					 0, terminal->row_count - 1);
3407
					 0, terminal->row_count - 1);
3408
	return FALSE;
3335
}
3409
}
3336
3410
3337
/* Standout end. */
3411
/* Standout end. */
3338
static void
3412
static gboolean
3339
vte_sequence_handler_se(VteTerminal *terminal,
3413
vte_sequence_handler_se(VteTerminal *terminal,
3340
			const char *match,
3414
			const char *match,
3341
			GQuark match_quark,
3415
			GQuark match_quark,
Lines 3402-3411 Link Here
3402
		g_free(underline);
3476
		g_free(underline);
3403
	}
3477
	}
3404
	g_free(standout);
3478
	g_free(standout);
3479
	return FALSE;
3405
}
3480
}
3406
3481
3407
/* Cursor down, with scrolling. */
3482
/* Cursor down, with scrolling. */
3408
static void
3483
static gboolean
3409
vte_sequence_handler_sf(VteTerminal *terminal,
3484
vte_sequence_handler_sf(VteTerminal *terminal,
3410
			const char *match,
3485
			const char *match,
3411
			GQuark match_quark,
3486
			GQuark match_quark,
Lines 3489-3509 Link Here
3489
	}
3564
	}
3490
	/* Adjust the scrollbars if necessary. */
3565
	/* Adjust the scrollbars if necessary. */
3491
	vte_terminal_adjust_adjustments(terminal, FALSE);
3566
	vte_terminal_adjust_adjustments(terminal, FALSE);
3567
	return FALSE;
3492
}
3568
}
3493
3569
3494
/* Cursor down, with scrolling. */
3570
/* Cursor down, with scrolling. */
3495
static void
3571
static gboolean
3496
vte_sequence_handler_SF(VteTerminal *terminal,
3572
vte_sequence_handler_SF(VteTerminal *terminal,
3497
			const char *match,
3573
			const char *match,
3498
			GQuark match_quark,
3574
			GQuark match_quark,
3499
			GValueArray *params)
3575
			GValueArray *params)
3500
{
3576
{
3501
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3577
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3502
				      vte_sequence_handler_sf);
3578
					     params, vte_sequence_handler_sf);
3503
}
3579
}
3504
3580
3505
/* Standout start. */
3581
/* Standout start. */
3506
static void
3582
static gboolean
3507
vte_sequence_handler_so(VteTerminal *terminal,
3583
vte_sequence_handler_so(VteTerminal *terminal,
3508
			const char *match,
3584
			const char *match,
3509
			GQuark match_quark,
3585
			GQuark match_quark,
Lines 3570-3579 Link Here
3570
		g_free(underline);
3646
		g_free(underline);
3571
	}
3647
	}
3572
	g_free(standout);
3648
	g_free(standout);
3649
	return FALSE;
3573
}
3650
}
3574
3651
3575
/* Cursor up, scrolling if need be. */
3652
/* Cursor up, scrolling if need be. */
3576
static void
3653
static gboolean
3577
vte_sequence_handler_sr(VteTerminal *terminal,
3654
vte_sequence_handler_sr(VteTerminal *terminal,
3578
			const char *match,
3655
			const char *match,
3579
			GQuark match_quark,
3656
			GQuark match_quark,
Lines 3612-3632 Link Here
3612
	vte_terminal_adjust_adjustments(terminal, FALSE);
3689
	vte_terminal_adjust_adjustments(terminal, FALSE);
3613
	/* We modified the display, so make a note of it. */
3690
	/* We modified the display, so make a note of it. */
3614
	terminal->pvt->text_modified_flag = TRUE;
3691
	terminal->pvt->text_modified_flag = TRUE;
3692
	return FALSE;
3615
}
3693
}
3616
3694
3617
/* Cursor up, with scrolling. */
3695
/* Cursor up, with scrolling. */
3618
static void
3696
static gboolean
3619
vte_sequence_handler_SR(VteTerminal *terminal,
3697
vte_sequence_handler_SR(VteTerminal *terminal,
3620
			const char *match,
3698
			const char *match,
3621
			GQuark match_quark,
3699
			GQuark match_quark,
3622
			GValueArray *params)
3700
			GValueArray *params)
3623
{
3701
{
3624
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3702
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3625
				      vte_sequence_handler_sr);
3703
					     params, vte_sequence_handler_sr);
3626
}
3704
}
3627
3705
3628
/* Set tab stop in the current column. */
3706
/* Set tab stop in the current column. */
3629
static void
3707
static gboolean
3630
vte_sequence_handler_st(VteTerminal *terminal,
3708
vte_sequence_handler_st(VteTerminal *terminal,
3631
			const char *match,
3709
			const char *match,
3632
			GQuark match_quark,
3710
			GQuark match_quark,
Lines 3638-3647 Link Here
3638
	}
3716
	}
3639
	vte_terminal_set_tabstop(terminal,
3717
	vte_terminal_set_tabstop(terminal,
3640
				 terminal->pvt->screen->cursor_current.col);
3718
				 terminal->pvt->screen->cursor_current.col);
3719
	return FALSE;
3641
}
3720
}
3642
3721
3643
/* Tab. */
3722
/* Tab. */
3644
static void
3723
static gboolean
3645
vte_sequence_handler_ta(VteTerminal *terminal,
3724
vte_sequence_handler_ta(VteTerminal *terminal,
3646
			const char *match,
3725
			const char *match,
3647
			GQuark match_quark,
3726
			GQuark match_quark,
Lines 3668-3677 Link Here
3668
	}
3747
	}
3669
3748
3670
	terminal->pvt->screen->cursor_current.col = newcol;
3749
	terminal->pvt->screen->cursor_current.col = newcol;
3750
	return FALSE;
3671
}
3751
}
3672
3752
3673
/* Clear tabs selectively. */
3753
/* Clear tabs selectively. */
3674
static void
3754
static gboolean
3675
vte_sequence_handler_tab_clear(VteTerminal *terminal,
3755
vte_sequence_handler_tab_clear(VteTerminal *terminal,
3676
			       const char *match,
3756
			       const char *match,
3677
			       GQuark match_quark,
3757
			       GQuark match_quark,
Lines 3696-3705 Link Here
3696
			terminal->pvt->tabstops = NULL;
3776
			terminal->pvt->tabstops = NULL;
3697
		}
3777
		}
3698
	}
3778
	}
3779
	return FALSE;
3699
}
3780
}
3700
3781
3701
/* Move to status line. */
3782
/* Move to status line. */
3702
static void
3783
static gboolean
3703
vte_sequence_handler_ts(VteTerminal *terminal,
3784
vte_sequence_handler_ts(VteTerminal *terminal,
3704
			const char *match,
3785
			const char *match,
3705
			GQuark match_quark,
3786
			GQuark match_quark,
Lines 3708-3717 Link Here
3708
	terminal->pvt->screen->status_line = TRUE;
3789
	terminal->pvt->screen->status_line = TRUE;
3709
	g_string_truncate(terminal->pvt->screen->status_line_contents, 0);
3790
	g_string_truncate(terminal->pvt->screen->status_line_contents, 0);
3710
	vte_terminal_emit_status_line_changed(terminal);
3791
	vte_terminal_emit_status_line_changed(terminal);
3792
	return FALSE;
3711
}
3793
}
3712
3794
3713
/* Underline this character and move right. */
3795
/* Underline this character and move right. */
3714
static void
3796
static gboolean
3715
vte_sequence_handler_uc(VteTerminal *terminal,
3797
vte_sequence_handler_uc(VteTerminal *terminal,
3716
			const char *match,
3798
			const char *match,
3717
			GQuark match_quark,
3799
			GQuark match_quark,
Lines 3746-3765 Link Here
3746
	/* We've modified the display without changing the text.  Make a note
3828
	/* We've modified the display without changing the text.  Make a note
3747
	 * of it. */
3829
	 * of it. */
3748
	terminal->pvt->text_modified_flag = TRUE;
3830
	terminal->pvt->text_modified_flag = TRUE;
3831
	return FALSE;
3749
}
3832
}
3750
3833
3751
/* Underline end. */
3834
/* Underline end. */
3752
static void
3835
static gboolean
3753
vte_sequence_handler_ue(VteTerminal *terminal,
3836
vte_sequence_handler_ue(VteTerminal *terminal,
3754
			const char *match,
3837
			const char *match,
3755
			GQuark match_quark,
3838
			GQuark match_quark,
3756
			GValueArray *params)
3839
			GValueArray *params)
3757
{
3840
{
3758
	terminal->pvt->screen->defaults.underline = 0;
3841
	terminal->pvt->screen->defaults.underline = 0;
3842
	return FALSE;
3759
}
3843
}
3760
3844
3761
/* Cursor up, no scrolling. */
3845
/* Cursor up, no scrolling. */
3762
static void
3846
static gboolean
3763
vte_sequence_handler_up(VteTerminal *terminal,
3847
vte_sequence_handler_up(VteTerminal *terminal,
3764
			const char *match,
3848
			const char *match,
3765
			GQuark match_quark,
3849
			GQuark match_quark,
Lines 3779-3809 Link Here
3779
	}
3863
	}
3780
3864
3781
	screen->cursor_current.row = MAX(screen->cursor_current.row - 1, start);
3865
	screen->cursor_current.row = MAX(screen->cursor_current.row - 1, start);
3866
	return FALSE;
3782
}
3867
}
3783
3868
3784
/* Cursor up N lines, no scrolling. */
3869
/* Cursor up N lines, no scrolling. */
3785
static void
3870
static gboolean
3786
vte_sequence_handler_UP(VteTerminal *terminal,
3871
vte_sequence_handler_UP(VteTerminal *terminal,
3787
			const char *match,
3872
			const char *match,
3788
			GQuark match_quark,
3873
			GQuark match_quark,
3789
			GValueArray *params)
3874
			GValueArray *params)
3790
{
3875
{
3791
	vte_sequence_handler_multiple(terminal, match, match_quark, params,
3876
	return vte_sequence_handler_multiple(terminal, match, match_quark,
3792
				      vte_sequence_handler_up);
3877
					     params, vte_sequence_handler_up);
3793
}
3878
}
3794
3879
3795
/* Underline start. */
3880
/* Underline start. */
3796
static void
3881
static gboolean
3797
vte_sequence_handler_us(VteTerminal *terminal,
3882
vte_sequence_handler_us(VteTerminal *terminal,
3798
			const char *match,
3883
			const char *match,
3799
			GQuark match_quark,
3884
			GQuark match_quark,
3800
			GValueArray *params)
3885
			GValueArray *params)
3801
{
3886
{
3802
	terminal->pvt->screen->defaults.underline = 1;
3887
	terminal->pvt->screen->defaults.underline = 1;
3888
	return FALSE;
3803
}
3889
}
3804
3890
3805
/* Visible bell. */
3891
/* Visible bell. */
3806
static void
3892
static gboolean
3807
vte_sequence_handler_vb(VteTerminal *terminal,
3893
vte_sequence_handler_vb(VteTerminal *terminal,
3808
			const char *match,
3894
			const char *match,
3809
			GQuark match_quark,
3895
			GQuark match_quark,
Lines 3828-3857 Link Here
3828
		vte_invalidate_all(terminal);
3914
		vte_invalidate_all(terminal);
3829
		gdk_window_process_updates(widget->window, TRUE);
3915
		gdk_window_process_updates(widget->window, TRUE);
3830
	}
3916
	}
3917
	return FALSE;
3831
}
3918
}
3832
3919
3833
/* Cursor visible. */
3920
/* Cursor visible. */
3834
static void
3921
static gboolean
3835
vte_sequence_handler_ve(VteTerminal *terminal,
3922
vte_sequence_handler_ve(VteTerminal *terminal,
3836
			const char *match,
3923
			const char *match,
3837
			GQuark match_quark,
3924
			GQuark match_quark,
3838
			GValueArray *params)
3925
			GValueArray *params)
3839
{
3926
{
3840
	terminal->pvt->cursor_visible = TRUE;
3927
	terminal->pvt->cursor_visible = TRUE;
3928
	return FALSE;
3929
}
3930
3931
/* Vertical tab. */
3932
static gboolean
3933
vte_sequence_handler_vertical_tab(VteTerminal *terminal,
3934
				  const char *match,
3935
				  GQuark match_quark,
3936
				  GValueArray *params)
3937
{
3938
	return vte_sequence_handler_index(terminal, match, match_quark, params);
3841
}
3939
}
3842
3940
3843
/* Cursor invisible. */
3941
/* Cursor invisible. */
3844
static void
3942
static gboolean
3845
vte_sequence_handler_vi(VteTerminal *terminal,
3943
vte_sequence_handler_vi(VteTerminal *terminal,
3846
			const char *match,
3944
			const char *match,
3847
			GQuark match_quark,
3945
			GQuark match_quark,
3848
			GValueArray *params)
3946
			GValueArray *params)
3849
{
3947
{
3850
	terminal->pvt->cursor_visible = FALSE;
3948
	terminal->pvt->cursor_visible = FALSE;
3949
	return FALSE;
3851
}
3950
}
3852
3951
3853
/* Cursor standout. */
3952
/* Cursor standout. */
3854
static void
3953
static gboolean
3855
vte_sequence_handler_vs(VteTerminal *terminal,
3954
vte_sequence_handler_vs(VteTerminal *terminal,
3856
			const char *match,
3955
			const char *match,
3857
			GQuark match_quark,
3956
			GQuark match_quark,
Lines 3859-3868 Link Here
3859
{
3958
{
3860
	terminal->pvt->cursor_visible = TRUE; /* FIXME: should be *more*
3959
	terminal->pvt->cursor_visible = TRUE; /* FIXME: should be *more*
3861
						 visible. */
3960
						 visible. */
3961
	return FALSE;
3862
}
3962
}
3863
3963
3864
/* Handle ANSI color setting and related stuffs (SGR). */
3964
/* Handle ANSI color setting and related stuffs (SGR). */
3865
static void
3965
static gboolean
3866
vte_sequence_handler_character_attributes(VteTerminal *terminal,
3966
vte_sequence_handler_character_attributes(VteTerminal *terminal,
3867
					  const char *match,
3967
					  const char *match,
3868
					  GQuark match_quark,
3968
					  GQuark match_quark,
Lines 3871-3877 Link Here
3871
	unsigned int i;
3971
	unsigned int i;
3872
	GValue *value;
3972
	GValue *value;
3873
	long param;
3973
	long param;
3874
	g_return_if_fail(VTE_IS_TERMINAL(terminal));
3875
	/* The default parameter is zero. */
3974
	/* The default parameter is zero. */
3876
	param = 0;
3975
	param = 0;
3877
	/* Step through each numeric parameter. */
3976
	/* Step through each numeric parameter. */
Lines 4000-4009 Link Here
4000
		terminal->pvt->screen->defaults.fore;
4099
		terminal->pvt->screen->defaults.fore;
4001
	terminal->pvt->screen->fill_defaults.back =
4100
	terminal->pvt->screen->fill_defaults.back =
4002
		terminal->pvt->screen->defaults.back;
4101
		terminal->pvt->screen->defaults.back;
4102
	return FALSE;
4003
}
4103
}
4004
4104
4005
/* Clear above the current line. */
4105
/* Clear above the current line. */
4006
static void
4106
static gboolean
4007
vte_sequence_handler_clear_above_current(VteTerminal *terminal,
4107
vte_sequence_handler_clear_above_current(VteTerminal *terminal,
4008
					 const char *match,
4108
					 const char *match,
4009
					 GQuark match_quark,
4109
					 GQuark match_quark,
Lines 4036-4045 Link Here
4036
	}
4136
	}
4037
	/* We've modified the display.  Make a note of it. */
4137
	/* We've modified the display.  Make a note of it. */
4038
	terminal->pvt->text_deleted_count++;
4138
	terminal->pvt->text_deleted_count++;
4139
	return FALSE;
4039
}
4140
}
4040
4141
4041
/* Clear the entire screen. */
4142
/* Clear the entire screen. */
4042
static void
4143
static gboolean
4043
vte_sequence_handler_clear_screen(VteTerminal *terminal,
4144
vte_sequence_handler_clear_screen(VteTerminal *terminal,
4044
				  const char *match,
4145
				  const char *match,
4045
				  GQuark match_quark,
4146
				  GQuark match_quark,
Lines 4069-4120 Link Here
4069
	vte_invalidate_all(terminal);
4170
	vte_invalidate_all(terminal);
4070
	/* We've modified the display.  Make a note of it. */
4171
	/* We've modified the display.  Make a note of it. */
4071
	terminal->pvt->text_deleted_count++;
4172
	terminal->pvt->text_deleted_count++;
4173
	return FALSE;
4072
}
4174
}
4073
4175
4074
/* Move the cursor to the given column, 1-based. */
4176
/* Move the cursor to the given column, 1-based. */
4075
static void
4177
static gboolean
4076
vte_sequence_handler_cursor_character_absolute(VteTerminal *terminal,
4178
vte_sequence_handler_cursor_character_absolute(VteTerminal *terminal,
4077
					       const char *match,
4179
					       const char *match,
4078
					       GQuark match_quark,
4180
					       GQuark match_quark,
4079
					       GValueArray *params)
4181
					       GValueArray *params)
4080
{
4182
{
4081
	vte_sequence_handler_offset(terminal, match, match_quark, params,
4183
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
4082
				    -1, vte_sequence_handler_ch);
4184
					   -1, vte_sequence_handler_ch);
4083
}
4185
}
4084
4186
4085
/* Move the cursor to the given position, 1-based. */
4187
/* Move the cursor to the given position, 1-based. */
4086
static void
4188
static gboolean
4087
vte_sequence_handler_cursor_position(VteTerminal *terminal,
4189
vte_sequence_handler_cursor_position(VteTerminal *terminal,
4088
				     const char *match,
4190
				     const char *match,
4089
				     GQuark match_quark,
4191
				     GQuark match_quark,
4090
				     GValueArray *params)
4192
				     GValueArray *params)
4091
{
4193
{
4092
	vte_sequence_handler_offset(terminal, match, match_quark, params,
4194
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
4093
				    -1, vte_sequence_handler_cm);
4195
					   -1, vte_sequence_handler_cm);
4094
}
4196
}
4095
4197
4096
/* Request terminal attributes. */
4198
/* Request terminal attributes. */
4097
static void
4199
static gboolean
4098
vte_sequence_handler_request_terminal_parameters(VteTerminal *terminal,
4200
vte_sequence_handler_request_terminal_parameters(VteTerminal *terminal,
4099
						 const char *match,
4201
						 const char *match,
4100
						 GQuark match_quark,
4202
						 GQuark match_quark,
4101
						 GValueArray *params)
4203
						 GValueArray *params)
4102
{
4204
{
4103
	vte_terminal_feed_child(terminal, "[?x", -1);
4205
	vte_terminal_feed_child(terminal, "[?x", -1);
4206
	return FALSE;
4104
}
4207
}
4105
4208
4106
/* Request terminal attributes. */
4209
/* Request terminal attributes. */
4107
static void
4210
static gboolean
4108
vte_sequence_handler_return_terminal_status(VteTerminal *terminal,
4211
vte_sequence_handler_return_terminal_status(VteTerminal *terminal,
4109
					    const char *match,
4212
					    const char *match,
4110
					    GQuark match_quark,
4213
					    GQuark match_quark,
4111
					    GValueArray *params)
4214
					    GValueArray *params)
4112
{
4215
{
4113
	vte_terminal_feed_child(terminal, "xterm", -1);
4216
	vte_terminal_feed_child(terminal, "", -1);
4217
	return FALSE;
4114
}
4218
}
4115
4219
4116
/* Send primary device attributes. */
4220
/* Send primary device attributes. */
4117
static void
4221
static gboolean
4118
vte_sequence_handler_send_primary_device_attributes(VteTerminal *terminal,
4222
vte_sequence_handler_send_primary_device_attributes(VteTerminal *terminal,
4119
						    const char *match,
4223
						    const char *match,
4120
						    GQuark match_quark,
4224
						    GQuark match_quark,
Lines 4122-4144 Link Here
4122
{
4226
{
4123
	/* Claim to be a VT220 with only national character set support. */
4227
	/* Claim to be a VT220 with only national character set support. */
4124
	vte_terminal_feed_child(terminal, "[?60;9;c", -1);
4228
	vte_terminal_feed_child(terminal, "[?60;9;c", -1);
4229
	return FALSE;
4125
}
4230
}
4126
4231
4127
/* Send terminal ID. */
4232
/* Send terminal ID. */
4128
static void
4233
static gboolean
4129
vte_sequence_handler_return_terminal_id(VteTerminal *terminal,
4234
vte_sequence_handler_return_terminal_id(VteTerminal *terminal,
4130
					const char *match,
4235
					const char *match,
4131
					GQuark match_quark,
4236
					GQuark match_quark,
4132
					GValueArray *params)
4237
					GValueArray *params)
4133
{
4238
{
4134
	vte_sequence_handler_send_primary_device_attributes(terminal,
4239
	return vte_sequence_handler_send_primary_device_attributes(terminal,
4135
							    match,
4240
								   match,
4136
							    match_quark,
4241
								   match_quark,
4137
							    params);
4242
								   params);
4138
}
4243
}
4139
4244
4140
/* Send secondary device attributes. */
4245
/* Send secondary device attributes. */
4141
static void
4246
static gboolean
4142
vte_sequence_handler_send_secondary_device_attributes(VteTerminal *terminal,
4247
vte_sequence_handler_send_secondary_device_attributes(VteTerminal *terminal,
4143
						      const char *match,
4248
						      const char *match,
4144
						      GQuark match_quark,
4249
						      GQuark match_quark,
Lines 4156-4168 Link Here
4156
		}
4261
		}
4157
		g_strfreev(version);
4262
		g_strfreev(version);
4158
	}
4263
	}
4159
	ret = g_strdup_printf("[>1;%ld;0c", ver);
4264
	ret = g_strdup_printf(_VTE_CAP_ESC "[>1;%ld;0c", ver);
4160
	vte_terminal_feed_child(terminal, ret, -1);
4265
	vte_terminal_feed_child(terminal, ret, -1);
4161
	g_free(ret);
4266
	g_free(ret);
4267
	return FALSE;
4162
}
4268
}
4163
4269
4164
/* Set icon/window titles. */
4270
/* Set icon/window titles. */
4165
static void
4271
static gboolean
4166
vte_sequence_handler_set_title_internal(VteTerminal *terminal,
4272
vte_sequence_handler_set_title_internal(VteTerminal *terminal,
4167
					const char *match,
4273
					const char *match,
4168
					GQuark match_quark,
4274
					GQuark match_quark,
Lines 4173-4178 Link Here
4173
	VteConv conv;
4279
	VteConv conv;
4174
	char *inbuf = NULL, *outbuf = NULL, *outbufptr = NULL, *title = NULL;
4280
	char *inbuf = NULL, *outbuf = NULL, *outbufptr = NULL, *title = NULL;
4175
	gsize inbuf_len, outbuf_len;
4281
	gsize inbuf_len, outbuf_len;
4282
	gboolean ret = FALSE;
4283
4176
	/* Get the string parameter's value. */
4284
	/* Get the string parameter's value. */
4177
	value = g_value_array_get_nth(params, 0);
4285
	value = g_value_array_get_nth(params, 0);
4178
	if (value) {
4286
	if (value) {
Lines 4244-4295 Link Here
4244
			}
4352
			}
4245
			g_free(validated);
4353
			g_free(validated);
4246
			g_free(title);
4354
			g_free(title);
4355
4356
			ret = TRUE;
4247
		}
4357
		}
4248
	}
4358
	}
4359
	return ret;
4249
}
4360
}
4250
4361
4251
/* Set one or the other. */
4362
/* Set one or the other. */
4252
static void
4363
static gboolean
4253
vte_sequence_handler_set_icon_title(VteTerminal *terminal,
4364
vte_sequence_handler_set_icon_title(VteTerminal *terminal,
4254
				    const char *match,
4365
				    const char *match,
4255
				    GQuark match_quark,
4366
				    GQuark match_quark,
4256
				    GValueArray *params)
4367
				    GValueArray *params)
4257
{
4368
{
4258
	vte_sequence_handler_set_title_internal(terminal, match, match_quark,
4369
	return vte_sequence_handler_set_title_internal(terminal,
4259
						params, "icon");
4370
						       match, match_quark,
4371
						       params, "icon");
4260
}
4372
}
4261
static void
4373
static gboolean
4262
vte_sequence_handler_set_window_title(VteTerminal *terminal,
4374
vte_sequence_handler_set_window_title(VteTerminal *terminal,
4263
				      const char *match,
4375
				      const char *match,
4264
				      GQuark match_quark,
4376
				      GQuark match_quark,
4265
				      GValueArray *params)
4377
				      GValueArray *params)
4266
{
4378
{
4267
	vte_sequence_handler_set_title_internal(terminal, match, match_quark,
4379
	return vte_sequence_handler_set_title_internal(terminal,
4268
						params, "window");
4380
						       match, match_quark,
4381
						       params, "window");
4269
}
4382
}
4270
4383
4271
/* Set both the window and icon titles to the same string. */
4384
/* Set both the window and icon titles to the same string. */
4272
static void
4385
static gboolean
4273
vte_sequence_handler_set_icon_and_window_title(VteTerminal *terminal,
4386
vte_sequence_handler_set_icon_and_window_title(VteTerminal *terminal,
4274
						  const char *match,
4387
						  const char *match,
4275
						  GQuark match_quark,
4388
						  GQuark match_quark,
4276
						  GValueArray *params)
4389
						  GValueArray *params)
4277
{
4390
{
4278
	vte_sequence_handler_set_title_internal(terminal, match, match_quark,
4391
	int again;
4279
						params, "icon");
4392
	again = 0;
4280
	vte_sequence_handler_set_title_internal(terminal, match, match_quark,
4393
	if (vte_sequence_handler_set_title_internal(terminal,
4281
						params, "window");
4394
						    match, match_quark,
4395
						    params, "icon")) {
4396
		again++;
4397
	}
4398
	if (vte_sequence_handler_set_title_internal(terminal,
4399
						    match, match_quark,
4400
						    params, "window")) {
4401
		again++;
4402
	}
4403
	return (again > 0);
4282
}
4404
}
4283
4405
4284
/* Restrict the scrolling region. */
4406
/* Restrict the scrolling region. */
4285
static void
4407
static gboolean
4286
vte_sequence_handler_set_scrolling_region(VteTerminal *terminal,
4408
vte_sequence_handler_set_scrolling_region(VteTerminal *terminal,
4287
					  const char *match,
4409
					  const char *match,
4288
					  GQuark match_quark,
4410
					  GQuark match_quark,
4289
					  GValueArray *params)
4411
					  GValueArray *params)
4290
{
4412
{
4291
	vte_sequence_handler_offset(terminal, match, match_quark, params,
4413
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
4292
				    -1, vte_sequence_handler_cs);
4414
					   -1, vte_sequence_handler_cs);
4293
}
4415
}
4294
4416
4295
/* Show or hide the pointer. */
4417
/* Show or hide the pointer. */
Lines 4344-4357 Link Here
4344
}
4466
}
4345
4467
4346
/* Manipulate certain terminal attributes. */
4468
/* Manipulate certain terminal attributes. */
4347
static void
4469
static gboolean
4348
vte_sequence_handler_decset_internal(VteTerminal *terminal,
4470
vte_sequence_handler_decset_internal(VteTerminal *terminal,
4349
				     int setting,
4471
				     int setting,
4350
				     gboolean restore,
4472
				     gboolean restore,
4351
				     gboolean save,
4473
				     gboolean save,
4352
				     gboolean set)
4474
				     gboolean set)
4353
{
4475
{
4354
	gboolean recognized = FALSE;
4476
	gboolean recognized = FALSE, again = FALSE;
4355
	gpointer p;
4477
	gpointer p;
4356
	int i;
4478
	int i;
4357
	struct {
4479
	struct {
Lines 4510-4517 Link Here
4510
		 NULL, NULL},
4632
		 NULL, NULL},
4511
	};
4633
	};
4512
4634
4513
	g_return_if_fail(VTE_IS_TERMINAL(terminal));
4514
4515
	/* Handle the setting. */
4635
	/* Handle the setting. */
4516
	for (i = 0; i < G_N_ELEMENTS(settings); i++)
4636
	for (i = 0; i < G_N_ELEMENTS(settings); i++)
4517
	if (settings[i].setting == setting) {
4637
	if (settings[i].setting == setting) {
Lines 4604-4614 Link Here
4604
	case 3:
4724
	case 3:
4605
		vte_terminal_emit_resize_window(terminal,
4725
		vte_terminal_emit_resize_window(terminal,
4606
						(set ? 132 : 80) *
4726
						(set ? 132 : 80) *
4607
						terminal->char_width,
4727
						terminal->char_width +
4728
						VTE_PAD_WIDTH * 2,
4608
						terminal->row_count *
4729
						terminal->row_count *
4609
						terminal->char_height);
4730
						terminal->char_height +
4731
						VTE_PAD_WIDTH * 2);
4610
		/* Request a resize and redraw. */
4732
		/* Request a resize and redraw. */
4611
		vte_invalidate_all(terminal);
4733
		vte_invalidate_all(terminal);
4734
		again = TRUE;
4612
		break;
4735
		break;
4613
	case 5:
4736
	case 5:
4614
		/* Repaint everything in reverse mode. */
4737
		/* Repaint everything in reverse mode. */
Lines 4754-4763 Link Here
4754
			  setting);
4877
			  setting);
4755
	}
4878
	}
4756
#endif
4879
#endif
4880
	return again;
4757
}
4881
}
4758
4882
4759
/* Set the application or normal keypad. */
4883
/* Set the application or normal keypad. */
4760
static void
4884
static gboolean
4761
vte_sequence_handler_application_keypad(VteTerminal *terminal,
4885
vte_sequence_handler_application_keypad(VteTerminal *terminal,
4762
					const char *match,
4886
					const char *match,
4763
					GQuark match_quark,
4887
					GQuark match_quark,
Lines 4769-4777 Link Here
4769
	}
4893
	}
4770
#endif
4894
#endif
4771
	terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
4895
	terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
4896
	return FALSE;
4772
}
4897
}
4773
4898
4774
static void
4899
static gboolean
4775
vte_sequence_handler_normal_keypad(VteTerminal *terminal,
4900
vte_sequence_handler_normal_keypad(VteTerminal *terminal,
4776
				   const char *match,
4901
				   const char *match,
4777
				   GQuark match_quark,
4902
				   GQuark match_quark,
Lines 4783-4812 Link Here
4783
	}
4908
	}
4784
#endif
4909
#endif
4785
	terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
4910
	terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
4911
	return FALSE;
4786
}
4912
}
4787
4913
4788
/* Move the cursor. */
4914
/* Move the cursor. */
4789
static void
4915
static gboolean
4790
vte_sequence_handler_character_position_absolute(VteTerminal *terminal,
4916
vte_sequence_handler_character_position_absolute(VteTerminal *terminal,
4791
						 const char *match,
4917
						 const char *match,
4792
						 GQuark match_quark,
4918
						 GQuark match_quark,
4793
						 GValueArray *params)
4919
						 GValueArray *params)
4794
{
4920
{
4795
	vte_sequence_handler_offset(terminal, match, match_quark, params,
4921
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
4796
				    -1, vte_sequence_handler_ch);
4922
					   -1, vte_sequence_handler_ch);
4797
}
4923
}
4798
static void
4924
static gboolean
4799
vte_sequence_handler_line_position_absolute(VteTerminal *terminal,
4925
vte_sequence_handler_line_position_absolute(VteTerminal *terminal,
4800
					    const char *match,
4926
					    const char *match,
4801
					    GQuark match_quark,
4927
					    GQuark match_quark,
4802
					    GValueArray *params)
4928
					    GValueArray *params)
4803
{
4929
{
4804
	vte_sequence_handler_offset(terminal, match, match_quark, params,
4930
	return vte_sequence_handler_offset(terminal, match, match_quark, params,
4805
				    -1, vte_sequence_handler_cv);
4931
					   -1, vte_sequence_handler_cv);
4806
}
4932
}
4807
4933
4808
/* Toggle a terminal mode. */
4934
/* Toggle a terminal mode. */
4809
static void
4935
static gboolean
4810
vte_sequence_handler_set_mode_internal(VteTerminal *terminal,
4936
vte_sequence_handler_set_mode_internal(VteTerminal *terminal,
4811
				       long setting, gboolean value)
4937
				       long setting, gboolean value)
4812
{
4938
{
Lines 4825-4882 Link Here
4825
	default:
4951
	default:
4826
		break;
4952
		break;
4827
	}
4953
	}
4954
	return FALSE;
4828
}
4955
}
4829
4956
4830
/* Set certain terminal attributes. */
4957
/* Set certain terminal attributes. */
4831
static void
4958
static gboolean
4832
vte_sequence_handler_set_mode(VteTerminal *terminal,
4959
vte_sequence_handler_set_mode(VteTerminal *terminal,
4833
			      const char *match,
4960
			      const char *match,
4834
			      GQuark match_quark,
4961
			      GQuark match_quark,
4835
			      GValueArray *params)
4962
			      GValueArray *params)
4836
{
4963
{
4837
	int i;
4964
	int i, again;
4838
	long setting;
4965
	long setting;
4839
	GValue *value;
4966
	GValue *value;
4840
	if ((params == NULL) || (params->n_values == 0)) {
4967
	if ((params == NULL) || (params->n_values == 0)) {
4841
		return;
4968
		return FALSE;
4842
	}
4969
	}
4970
	again = 0;
4843
	for (i = 0; i < params->n_values; i++) {
4971
	for (i = 0; i < params->n_values; i++) {
4844
		value = g_value_array_get_nth(params, i);
4972
		value = g_value_array_get_nth(params, i);
4845
		if (!G_VALUE_HOLDS_LONG(value)) {
4973
		if (!G_VALUE_HOLDS_LONG(value)) {
4846
			continue;
4974
			continue;
4847
		}
4975
		}
4848
		setting = g_value_get_long(value);
4976
		setting = g_value_get_long(value);
4849
		vte_sequence_handler_set_mode_internal(terminal, setting,
4977
		if (vte_sequence_handler_set_mode_internal(terminal, setting,
4850
						       TRUE);
4978
							   TRUE)) {
4979
			again++;
4980
		}
4851
	}
4981
	}
4982
	return (again > 0);
4852
}
4983
}
4853
4984
4854
/* Unset certain terminal attributes. */
4985
/* Unset certain terminal attributes. */
4855
static void
4986
static gboolean
4856
vte_sequence_handler_reset_mode(VteTerminal *terminal,
4987
vte_sequence_handler_reset_mode(VteTerminal *terminal,
4857
				const char *match,
4988
				const char *match,
4858
				GQuark match_quark,
4989
				GQuark match_quark,
4859
				GValueArray *params)
4990
				GValueArray *params)
4860
{
4991
{
4861
	int i;
4992
	int i, again;
4862
	long setting;
4993
	long setting;
4863
	GValue *value;
4994
	GValue *value;
4864
	if ((params == NULL) || (params->n_values == 0)) {
4995
	if ((params == NULL) || (params->n_values == 0)) {
4865
		return;
4996
		return FALSE;
4866
	}
4997
	}
4998
	again = 0;
4867
	for (i = 0; i < params->n_values; i++) {
4999
	for (i = 0; i < params->n_values; i++) {
4868
		value = g_value_array_get_nth(params, i);
5000
		value = g_value_array_get_nth(params, i);
4869
		if (!G_VALUE_HOLDS_LONG(value)) {
5001
		if (!G_VALUE_HOLDS_LONG(value)) {
4870
			continue;
5002
			continue;
4871
		}
5003
		}
4872
		setting = g_value_get_long(value);
5004
		setting = g_value_get_long(value);
4873
		vte_sequence_handler_set_mode_internal(terminal, setting,
5005
		if (vte_sequence_handler_set_mode_internal(terminal, setting,
4874
						       FALSE);
5006
							   FALSE)) {
5007
			again++;
5008
		}
4875
	}
5009
	}
5010
	return (again > 0);
4876
}
5011
}
4877
5012
4878
/* Set certain terminal attributes. */
5013
/* Set certain terminal attributes. */
4879
static void
5014
static gboolean
4880
vte_sequence_handler_decset(VteTerminal *terminal,
5015
vte_sequence_handler_decset(VteTerminal *terminal,
4881
			    const char *match,
5016
			    const char *match,
4882
			    GQuark match_quark,
5017
			    GQuark match_quark,
Lines 4884-4906 Link Here
4884
{
5019
{
4885
	GValue *value;
5020
	GValue *value;
4886
	long setting;
5021
	long setting;
4887
	int i;
5022
	int i, again;
4888
	if ((params == NULL) || (params->n_values == 0)) {
5023
	if ((params == NULL) || (params->n_values == 0)) {
4889
		return;
5024
		return FALSE;
4890
	}
5025
	}
5026
	again = 0;
4891
	for (i = 0; i < params->n_values; i++) {
5027
	for (i = 0; i < params->n_values; i++) {
4892
		value = g_value_array_get_nth(params, i);
5028
		value = g_value_array_get_nth(params, i);
4893
		if (!G_VALUE_HOLDS_LONG(value)) {
5029
		if (!G_VALUE_HOLDS_LONG(value)) {
4894
			continue;
5030
			continue;
4895
		}
5031
		}
4896
		setting = g_value_get_long(value);
5032
		setting = g_value_get_long(value);
4897
		vte_sequence_handler_decset_internal(terminal, setting,
5033
		if (vte_sequence_handler_decset_internal(terminal, setting,
4898
						     FALSE, FALSE, TRUE);
5034
							 FALSE, FALSE, TRUE)) {
5035
			again++;
5036
		}
4899
	}
5037
	}
5038
	return (again > 0);
4900
}
5039
}
4901
5040
4902
/* Unset certain terminal attributes. */
5041
/* Unset certain terminal attributes. */
4903
static void
5042
static gboolean
4904
vte_sequence_handler_decreset(VteTerminal *terminal,
5043
vte_sequence_handler_decreset(VteTerminal *terminal,
4905
			      const char *match,
5044
			      const char *match,
4906
			      GQuark match_quark,
5045
			      GQuark match_quark,
Lines 4908-4940 Link Here
4908
{
5047
{
4909
	GValue *value;
5048
	GValue *value;
4910
	long setting;
5049
	long setting;
4911
	int i;
5050
	int i, again;
4912
	if ((params == NULL) || (params->n_values == 0)) {
5051
	if ((params == NULL) || (params->n_values == 0)) {
4913
		return;
5052
		return FALSE;
4914
	}
5053
	}
5054
	again = 0;
4915
	for (i = 0; i < params->n_values; i++) {
5055
	for (i = 0; i < params->n_values; i++) {
4916
		value = g_value_array_get_nth(params, i);
5056
		value = g_value_array_get_nth(params, i);
4917
		if (!G_VALUE_HOLDS_LONG(value)) {
5057
		if (!G_VALUE_HOLDS_LONG(value)) {
4918
			continue;
5058
			continue;
4919
		}
5059
		}
4920
		setting = g_value_get_long(value);
5060
		setting = g_value_get_long(value);
4921
		vte_sequence_handler_decset_internal(terminal, setting,
5061
		if (vte_sequence_handler_decset_internal(terminal, setting,
4922
						     FALSE, FALSE, FALSE);
5062
							 FALSE, FALSE, FALSE)) {
5063
			again++;
5064
		}
4923
	}
5065
	}
5066
	return (again > 0);
4924
}
5067
}
4925
5068
4926
/* Erase a specified number of characters. */
5069
/* Erase a specified number of characters. */
4927
static void
5070
static gboolean
4928
vte_sequence_handler_erase_characters(VteTerminal *terminal,
5071
vte_sequence_handler_erase_characters(VteTerminal *terminal,
4929
				      const char *match,
5072
				      const char *match,
4930
				      GQuark match_quark,
5073
				      GQuark match_quark,
4931
				      GValueArray *params)
5074
				      GValueArray *params)
4932
{
5075
{
4933
	vte_sequence_handler_ec(terminal, match, match_quark, params);
5076
	return vte_sequence_handler_ec(terminal, match, match_quark, params);
4934
}
5077
}
4935
5078
4936
/* Erase certain lines in the display. */
5079
/* Erase certain lines in the display. */
4937
static void
5080
static gboolean
4938
vte_sequence_handler_erase_in_display(VteTerminal *terminal,
5081
vte_sequence_handler_erase_in_display(VteTerminal *terminal,
4939
				      const char *match,
5082
				      const char *match,
4940
				      GQuark match_quark,
5083
				      GQuark match_quark,
Lines 4943-4948 Link Here
4943
	GValue *value;
5086
	GValue *value;
4944
	long param;
5087
	long param;
4945
	int i;
5088
	int i;
5089
	gboolean again;
4946
	/* The default parameter is 0. */
5090
	/* The default parameter is 0. */
4947
	param = 0;
5091
	param = 0;
4948
	/* Pull out a parameter. */
5092
	/* Pull out a parameter. */
Lines 4954-4990 Link Here
4954
		param = g_value_get_long(value);
5098
		param = g_value_get_long(value);
4955
	}
5099
	}
4956
	/* Clear the right area. */
5100
	/* Clear the right area. */
5101
	again = FALSE;
4957
	switch (param) {
5102
	switch (param) {
4958
	case 0:
5103
	case 0:
4959
		/* Clear below the current line. */
5104
		/* Clear below the current line. */
4960
		vte_sequence_handler_cd(terminal, NULL, 0, NULL);
5105
		again = vte_sequence_handler_cd(terminal, NULL, 0, NULL);
4961
		break;
5106
		break;
4962
	case 1:
5107
	case 1:
4963
		/* Clear above the current line. */
5108
		/* Clear above the current line. */
4964
		vte_sequence_handler_clear_above_current(terminal,
5109
		again = vte_sequence_handler_clear_above_current(terminal,
4965
							 NULL,
5110
								 NULL,
4966
							 0,
5111
								 0,
4967
							 NULL);
5112
								 NULL);
4968
		/* Clear everything to the left of the cursor, too. */
5113
		/* Clear everything to the left of the cursor, too. */
4969
		/* FIXME: vttest. */
5114
		/* FIXME: vttest. */
4970
		vte_sequence_handler_cb(terminal, NULL, 0, NULL);
5115
		again = vte_sequence_handler_cb(terminal, NULL, 0, NULL) ||
5116
			again;
4971
		break;
5117
		break;
4972
	case 2:
5118
	case 2:
4973
		/* Clear the entire screen. */
5119
		/* Clear the entire screen. */
4974
		vte_sequence_handler_clear_screen(terminal,
5120
		again = vte_sequence_handler_clear_screen(terminal,
4975
						  NULL,
5121
							  NULL,
4976
						  0,
5122
							  0,
4977
						  NULL);
5123
							  NULL);
4978
		break;
5124
		break;
4979
	default:
5125
	default:
4980
		break;
5126
		break;
4981
	}
5127
	}
4982
	/* We've modified the display.  Make a note of it. */
5128
	/* We've modified the display.  Make a note of it. */
4983
	terminal->pvt->text_deleted_count++;
5129
	terminal->pvt->text_deleted_count++;
5130
	return again;
4984
}
5131
}
4985
5132
4986
/* Erase certain parts of the current line in the display. */
5133
/* Erase certain parts of the current line in the display. */
4987
static void
5134
static gboolean
4988
vte_sequence_handler_erase_in_line(VteTerminal *terminal,
5135
vte_sequence_handler_erase_in_line(VteTerminal *terminal,
4989
				   const char *match,
5136
				   const char *match,
4990
				   GQuark match_quark,
5137
				   GQuark match_quark,
Lines 4993-4998 Link Here
4993
	GValue *value;
5140
	GValue *value;
4994
	long param;
5141
	long param;
4995
	int i;
5142
	int i;
5143
	gboolean again;
4996
	/* The default parameter is 0. */
5144
	/* The default parameter is 0. */
4997
	param = 0;
5145
	param = 0;
4998
	/* Pull out a parameter. */
5146
	/* Pull out a parameter. */
Lines 5004-5052 Link Here
5004
		param = g_value_get_long(value);
5152
		param = g_value_get_long(value);
5005
	}
5153
	}
5006
	/* Clear the right area. */
5154
	/* Clear the right area. */
5155
	again = FALSE;
5007
	switch (param) {
5156
	switch (param) {
5008
	case 0:
5157
	case 0:
5009
		/* Clear to end of the line. */
5158
		/* Clear to end of the line. */
5010
		vte_sequence_handler_ce(terminal, NULL, 0, NULL);
5159
		again = vte_sequence_handler_ce(terminal, NULL, 0, NULL);
5011
		break;
5160
		break;
5012
	case 1:
5161
	case 1:
5013
		/* Clear to start of the line. */
5162
		/* Clear to start of the line. */
5014
		vte_sequence_handler_cb(terminal, NULL, 0, NULL);
5163
		again = vte_sequence_handler_cb(terminal, NULL, 0, NULL);
5015
		break;
5164
		break;
5016
	case 2:
5165
	case 2:
5017
		/* Clear the entire line. */
5166
		/* Clear the entire line. */
5018
		vte_sequence_handler_clear_current_line(terminal,
5167
		again = vte_sequence_handler_clear_current_line(terminal,
5019
							NULL, 0, NULL);
5168
								NULL, 0, NULL);
5020
		break;
5169
		break;
5021
	default:
5170
	default:
5022
		break;
5171
		break;
5023
	}
5172
	}
5024
	/* We've modified the display.  Make a note of it. */
5173
	/* We've modified the display.  Make a note of it. */
5025
	terminal->pvt->text_deleted_count++;
5174
	terminal->pvt->text_deleted_count++;
5175
	return again;
5026
}
5176
}
5027
5177
5028
/* Perform a full-bore reset. */
5178
/* Perform a full-bore reset. */
5029
static void
5179
static gboolean
5030
vte_sequence_handler_full_reset(VteTerminal *terminal,
5180
vte_sequence_handler_full_reset(VteTerminal *terminal,
5031
				const char *match,
5181
				const char *match,
5032
				GQuark match_quark,
5182
				GQuark match_quark,
5033
				GValueArray *params)
5183
				GValueArray *params)
5034
{
5184
{
5035
	vte_terminal_reset(terminal, TRUE, TRUE);
5185
	vte_terminal_reset(terminal, TRUE, TRUE);
5186
	return FALSE;
5036
}
5187
}
5037
5188
5038
/* Insert a specified number of blank characters. */
5189
/* Insert a specified number of blank characters. */
5039
static void
5190
static gboolean
5040
vte_sequence_handler_insert_blank_characters(VteTerminal *terminal,
5191
vte_sequence_handler_insert_blank_characters(VteTerminal *terminal,
5041
					     const char *match,
5192
					     const char *match,
5042
					     GQuark match_quark,
5193
					     GQuark match_quark,
5043
					     GValueArray *params)
5194
					     GValueArray *params)
5044
{
5195
{
5045
	vte_sequence_handler_IC(terminal, match, match_quark, params);
5196
	return vte_sequence_handler_IC(terminal, match, match_quark, params);
5046
}
5197
}
5047
5198
5048
/* Insert a certain number of lines below the current cursor. */
5199
/* Insert a certain number of lines below the current cursor. */
5049
static void
5200
static gboolean
5050
vte_sequence_handler_insert_lines(VteTerminal *terminal,
5201
vte_sequence_handler_insert_lines(VteTerminal *terminal,
5051
				  const char *match,
5202
				  const char *match,
5052
				  GQuark match_quark,
5203
				  GQuark match_quark,
Lines 5091-5100 Link Here
5091
	vte_terminal_adjust_adjustments(terminal, FALSE);
5242
	vte_terminal_adjust_adjustments(terminal, FALSE);
5092
	/* We've modified the display.  Make a note of it. */
5243
	/* We've modified the display.  Make a note of it. */
5093
	terminal->pvt->text_inserted_count++;
5244
	terminal->pvt->text_inserted_count++;
5245
	return FALSE;
5094
}
5246
}
5095
5247
5096
/* Delete certain lines from the scrolling region. */
5248
/* Delete certain lines from the scrolling region. */
5097
static void
5249
static gboolean
5098
vte_sequence_handler_delete_lines(VteTerminal *terminal,
5250
vte_sequence_handler_delete_lines(VteTerminal *terminal,
5099
				  const char *match,
5251
				  const char *match,
5100
				  GQuark match_quark,
5252
				  GQuark match_quark,
Lines 5140-5149 Link Here
5140
	vte_terminal_adjust_adjustments(terminal, FALSE);
5292
	vte_terminal_adjust_adjustments(terminal, FALSE);
5141
	/* We've modified the display.  Make a note of it. */
5293
	/* We've modified the display.  Make a note of it. */
5142
	terminal->pvt->text_deleted_count++;
5294
	terminal->pvt->text_deleted_count++;
5295
	return FALSE;
5143
}
5296
}
5144
5297
5145
/* Set the terminal encoding. */
5298
/* Set the terminal encoding. */
5146
static void
5299
static gboolean
5147
vte_sequence_handler_local_charset(VteTerminal *terminal,
5300
vte_sequence_handler_local_charset(VteTerminal *terminal,
5148
				   const char *match,
5301
				   const char *match,
5149
				   GQuark match_quark,
5302
				   GQuark match_quark,
Lines 5152-5171 Link Here
5152
	G_CONST_RETURN char *locale_encoding;
5305
	G_CONST_RETURN char *locale_encoding;
5153
	g_get_charset(&locale_encoding);
5306
	g_get_charset(&locale_encoding);
5154
	vte_terminal_set_encoding(terminal, locale_encoding);
5307
	vte_terminal_set_encoding(terminal, locale_encoding);
5308
	return FALSE;
5155
}
5309
}
5156
5310
5157
static void
5311
static gboolean
5158
vte_sequence_handler_utf_8_charset(VteTerminal *terminal,
5312
vte_sequence_handler_utf_8_charset(VteTerminal *terminal,
5159
				   const char *match,
5313
				   const char *match,
5160
				   GQuark match_quark,
5314
				   GQuark match_quark,
5161
				   GValueArray *params)
5315
				   GValueArray *params)
5162
{
5316
{
5163
	vte_terminal_set_encoding(terminal, "UTF-8");
5317
	vte_terminal_set_encoding(terminal, "UTF-8");
5318
	return FALSE;
5164
}
5319
}
5165
5320
5166
/* Device status reports. The possible reports are the cursor position and
5321
/* Device status reports. The possible reports are the cursor position and
5167
 * whether or not we're okay. */
5322
 * whether or not we're okay. */
5168
static void
5323
static gboolean
5169
vte_sequence_handler_device_status_report(VteTerminal *terminal,
5324
vte_sequence_handler_device_status_report(VteTerminal *terminal,
5170
					  const char *match,
5325
					  const char *match,
5171
					  GQuark match_quark,
5326
					  GQuark match_quark,
Lines 5200-5209 Link Here
5200
			break;
5355
			break;
5201
		}
5356
		}
5202
	}
5357
	}
5358
	return FALSE;
5203
}
5359
}
5204
5360
5205
/* DEC-style device status reports. */
5361
/* DEC-style device status reports. */
5206
static void
5362
static gboolean
5207
vte_sequence_handler_dec_device_status_report(VteTerminal *terminal,
5363
vte_sequence_handler_dec_device_status_report(VteTerminal *terminal,
5208
					      const char *match,
5364
					      const char *match,
5209
					      GQuark match_quark,
5365
					      GQuark match_quark,
Lines 5251-5260 Link Here
5251
			break;
5407
			break;
5252
		}
5408
		}
5253
	}
5409
	}
5410
	return FALSE;
5254
}
5411
}
5255
5412
5256
/* Restore a certain terminal attribute. */
5413
/* Restore a certain terminal attribute. */
5257
static void
5414
static gboolean
5258
vte_sequence_handler_restore_mode(VteTerminal *terminal,
5415
vte_sequence_handler_restore_mode(VteTerminal *terminal,
5259
				  const char *match,
5416
				  const char *match,
5260
				  GQuark match_quark,
5417
				  GQuark match_quark,
Lines 5262-5284 Link Here
5262
{
5419
{
5263
	GValue *value;
5420
	GValue *value;
5264
	long setting;
5421
	long setting;
5265
	int i;
5422
	int i, again;
5266
	if ((params == NULL) || (params->n_values == 0)) {
5423
	if ((params == NULL) || (params->n_values == 0)) {
5267
		return;
5424
		return FALSE;
5268
	}
5425
	}
5426
	again = 0;
5269
	for (i = 0; i < params->n_values; i++) {
5427
	for (i = 0; i < params->n_values; i++) {
5270
		value = g_value_array_get_nth(params, i);
5428
		value = g_value_array_get_nth(params, i);
5271
		if (!G_VALUE_HOLDS_LONG(value)) {
5429
		if (!G_VALUE_HOLDS_LONG(value)) {
5272
			continue;
5430
			continue;
5273
		}
5431
		}
5274
		setting = g_value_get_long(value);
5432
		setting = g_value_get_long(value);
5275
		vte_sequence_handler_decset_internal(terminal, setting,
5433
		if (vte_sequence_handler_decset_internal(terminal, setting,
5276
						     TRUE, FALSE, FALSE);
5434
						         TRUE, FALSE, FALSE)) {
5435
			again++;
5436
		}
5277
	}
5437
	}
5438
	return (again > 0);
5278
}
5439
}
5279
5440
5280
/* Save a certain terminal attribute. */
5441
/* Save a certain terminal attribute. */
5281
static void
5442
static gboolean
5282
vte_sequence_handler_save_mode(VteTerminal *terminal,
5443
vte_sequence_handler_save_mode(VteTerminal *terminal,
5283
			       const char *match,
5444
			       const char *match,
5284
			       GQuark match_quark,
5445
			       GQuark match_quark,
Lines 5286-5309 Link Here
5286
{
5447
{
5287
	GValue *value;
5448
	GValue *value;
5288
	long setting;
5449
	long setting;
5289
	int i;
5450
	int i, again;
5290
	if ((params == NULL) || (params->n_values == 0)) {
5451
	if ((params == NULL) || (params->n_values == 0)) {
5291
		return;
5452
		return FALSE;
5292
	}
5453
	}
5454
	again = 0;
5293
	for (i = 0; i < params->n_values; i++) {
5455
	for (i = 0; i < params->n_values; i++) {
5294
		value = g_value_array_get_nth(params, i);
5456
		value = g_value_array_get_nth(params, i);
5295
		if (!G_VALUE_HOLDS_LONG(value)) {
5457
		if (!G_VALUE_HOLDS_LONG(value)) {
5296
			continue;
5458
			continue;
5297
		}
5459
		}
5298
		setting = g_value_get_long(value);
5460
		setting = g_value_get_long(value);
5299
		vte_sequence_handler_decset_internal(terminal, setting,
5461
		if (vte_sequence_handler_decset_internal(terminal, setting,
5300
						     FALSE, TRUE, FALSE);
5462
						         FALSE, TRUE, FALSE)) {
5463
			again++;
5464
		}
5301
	}
5465
	}
5466
	return (again > 0);
5302
}
5467
}
5303
5468
5304
/* Perform a screen alignment test -- fill all visible cells with the
5469
/* Perform a screen alignment test -- fill all visible cells with the
5305
 * letter "E". */
5470
 * letter "E". */
5306
static void
5471
static gboolean
5307
vte_sequence_handler_screen_alignment_test(VteTerminal *terminal,
5472
vte_sequence_handler_screen_alignment_test(VteTerminal *terminal,
5308
					   const char *match,
5473
					   const char *match,
5309
					   GQuark match_quark,
5474
					   GQuark match_quark,
Lines 5342-5363 Link Here
5342
5507
5343
	/* We modified the display, so make a note of it for completeness. */
5508
	/* We modified the display, so make a note of it for completeness. */
5344
	terminal->pvt->text_modified_flag = TRUE;
5509
	terminal->pvt->text_modified_flag = TRUE;
5510
	return FALSE;
5345
}
5511
}
5346
5512
5347
/* Perform a soft reset. */
5513
/* Perform a soft reset. */
5348
static void
5514
static gboolean
5349
vte_sequence_handler_soft_reset(VteTerminal *terminal,
5515
vte_sequence_handler_soft_reset(VteTerminal *terminal,
5350
				const char *match,
5516
				const char *match,
5351
				GQuark match_quark,
5517
				GQuark match_quark,
5352
				GValueArray *params)
5518
				GValueArray *params)
5353
{
5519
{
5354
	vte_terminal_reset(terminal, FALSE, FALSE);
5520
	vte_terminal_reset(terminal, FALSE, FALSE);
5521
	return FALSE;
5355
}
5522
}
5356
5523
5357
/* Window manipulation control sequences.  Most of these are considered
5524
/* Window manipulation control sequences.  Most of these are considered
5358
 * bad ideas, but they're implemented as signals which the application
5525
 * bad ideas, but they're implemented as signals which the application
5359
 * is free to ignore, so they're harmless. */
5526
 * is free to ignore, so they're harmless. */
5360
static void
5527
static gboolean
5361
vte_sequence_handler_window_manipulation(VteTerminal *terminal,
5528
vte_sequence_handler_window_manipulation(VteTerminal *terminal,
5362
					 const char *match,
5529
					 const char *match,
5363
					 GQuark match_quark,
5530
					 GQuark match_quark,
Lines 5435-5442 Link Here
5435
				}
5602
				}
5436
#endif
5603
#endif
5437
				vte_terminal_emit_resize_window(terminal,
5604
				vte_terminal_emit_resize_window(terminal,
5438
								arg2,
5605
								arg2 +
5439
								arg1);
5606
								VTE_PAD_WIDTH * 2,
5607
								arg1 +
5608
								VTE_PAD_WIDTH * 2);
5440
				i += 2;
5609
				i += 2;
5441
			}
5610
			}
5442
			break;
5611
			break;
Lines 5475-5482 Link Here
5475
				}
5644
				}
5476
#endif
5645
#endif
5477
				vte_terminal_emit_resize_window(terminal,
5646
				vte_terminal_emit_resize_window(terminal,
5478
								arg2 * terminal->char_width,
5647
								arg2 * terminal->char_width +
5479
								arg1 * terminal->char_height);
5648
								VTE_PAD_WIDTH * 2,
5649
								arg1 * terminal->char_height +
5650
								VTE_PAD_WIDTH * 2);
5480
				i += 2;
5651
				i += 2;
5481
			}
5652
			}
5482
			break;
5653
			break;
Lines 5627-5642 Link Here
5627
				/* Resize to the specified number of
5798
				/* Resize to the specified number of
5628
				 * rows. */
5799
				 * rows. */
5629
				vte_terminal_emit_resize_window(terminal,
5800
				vte_terminal_emit_resize_window(terminal,
5630
								terminal->column_count * terminal->char_width,
5801
								terminal->column_count * terminal->char_width +
5631
								param * terminal->char_height);
5802
								VTE_PAD_WIDTH * 2,
5803
								param * terminal->char_height +
5804
								VTE_PAD_WIDTH * 2);
5632
			}
5805
			}
5633
			break;
5806
			break;
5634
		}
5807
		}
5635
	}
5808
	}
5809
	return TRUE;
5636
}
5810
}
5637
5811
5638
/* Complain that we got an escape sequence that's actually a keystroke. */
5812
/* Complain that we got an escape sequence that's actually a keystroke. */
5639
static void
5813
static gboolean
5640
vte_sequence_handler_complain_key(VteTerminal *terminal,
5814
vte_sequence_handler_complain_key(VteTerminal *terminal,
5641
				  const char *match,
5815
				  const char *match,
5642
				  GQuark match_quark,
5816
				  GQuark match_quark,
Lines 5644-5649 Link Here
5644
{
5818
{
5645
	g_warning(_("Got unexpected (key?) sequence `%s'."),
5819
	g_warning(_("Got unexpected (key?) sequence `%s'."),
5646
		  match ? match : "???");
5820
		  match ? match : "???");
5821
	return FALSE;
5647
}
5822
}
5648
5823
5649
/* The table of handlers.  Primarily used at initialization time. */
5824
/* The table of handlers.  Primarily used at initialization time. */
Lines 6004-6009 Link Here
6004
	{"erase-characters", vte_sequence_handler_erase_characters},
6179
	{"erase-characters", vte_sequence_handler_erase_characters},
6005
	{"erase-in-display", vte_sequence_handler_erase_in_display},
6180
	{"erase-in-display", vte_sequence_handler_erase_in_display},
6006
	{"erase-in-line", vte_sequence_handler_erase_in_line},
6181
	{"erase-in-line", vte_sequence_handler_erase_in_line},
6182
	{"form-feed", vte_sequence_handler_form_feed},
6007
	{"full-reset", vte_sequence_handler_full_reset},
6183
	{"full-reset", vte_sequence_handler_full_reset},
6008
	{"horizontal-and-vertical-position", vte_sequence_handler_horizontal_and_vertical_position},
6184
	{"horizontal-and-vertical-position", vte_sequence_handler_horizontal_and_vertical_position},
6009
	{"index", vte_sequence_handler_index},
6185
	{"index", vte_sequence_handler_index},
Lines 6016-6021 Link Here
6016
	{"invoke-g3-character-set-as-gr", NULL},
6192
	{"invoke-g3-character-set-as-gr", NULL},
6017
	{"invoke-g3-character-set", NULL},
6193
	{"invoke-g3-character-set", NULL},
6018
	{"iso8859-1-character-set", vte_sequence_handler_local_charset},
6194
	{"iso8859-1-character-set", vte_sequence_handler_local_charset},
6195
	{"linux-console-cursor-attributes", vte_sequence_handler_noop},
6019
	{"line-position-absolute", vte_sequence_handler_line_position_absolute},
6196
	{"line-position-absolute", vte_sequence_handler_line_position_absolute},
6020
	{"media-copy", NULL},
6197
	{"media-copy", NULL},
6021
	{"memory-lock", NULL},
6198
	{"memory-lock", NULL},
Lines 6058-6063 Link Here
6058
	{"tab-clear", vte_sequence_handler_tab_clear},
6235
	{"tab-clear", vte_sequence_handler_tab_clear},
6059
	{"tab-set", vte_sequence_handler_st},
6236
	{"tab-set", vte_sequence_handler_st},
6060
	{"utf-8-character-set", vte_sequence_handler_utf_8_charset},
6237
	{"utf-8-character-set", vte_sequence_handler_utf_8_charset},
6238
	{"vertical-tab", vte_sequence_handler_vertical_tab},
6061
	{"window-manipulation", vte_sequence_handler_window_manipulation},
6239
	{"window-manipulation", vte_sequence_handler_window_manipulation},
6062
};
6240
};
6063
6241
Lines 6222-6227 Link Here
6222
}
6400
}
6223
6401
6224
/**
6402
/**
6403
 * vte_terminal_set_color_cursor
6404
 * @terminal: a #VteTerminal
6405
 * @background: the new color to use for the text cursor
6406
 *
6407
 * Sets the background color for text which is under the cursor.  If NULL, text
6408
 * under the cursor will be drawn with foreground and background colors
6409
 * reversed.
6410
 *
6411
 * Since: 0.11.11
6412
 *
6413
 */
6414
void
6415
vte_terminal_set_color_cursor(VteTerminal *terminal,
6416
			      const GdkColor *cursor_background)
6417
{
6418
	if (cursor_background != NULL) {
6419
		vte_terminal_set_color_internal(terminal, VTE_CUR_BG,
6420
						cursor_background);
6421
		terminal->pvt->cursor_color_set = TRUE;
6422
	} else {
6423
		terminal->pvt->cursor_color_set = FALSE;
6424
	}
6425
}
6426
6427
/**
6428
 * vte_terminal_set_color_highlight
6429
 * @terminal: a #VteTerminal
6430
 * @background: the new color to use for highlighted text
6431
 *
6432
 * Sets the background color for text which is highlighted.  If NULL,
6433
 * highlighted text (which is usually highlighted because it is selected) will
6434
 * be drawn with foreground and background colors reversed.
6435
 *
6436
 * Since: 0.11.11
6437
 *
6438
 */
6439
void
6440
vte_terminal_set_color_highlight(VteTerminal *terminal,
6441
				 const GdkColor *highlight_background)
6442
{
6443
	if (highlight_background != NULL) {
6444
		vte_terminal_set_color_internal(terminal, VTE_DEF_HL,
6445
						highlight_background);
6446
		terminal->pvt->highlight_color_set = TRUE;
6447
	} else {
6448
		terminal->pvt->highlight_color_set = FALSE;
6449
	}
6450
}
6451
6452
/**
6225
 * vte_terminal_set_colors
6453
 * vte_terminal_set_colors
6226
 * @terminal: a #VteTerminal
6454
 * @terminal: a #VteTerminal
6227
 * @foreground: the new foreground color, or #NULL
6455
 * @foreground: the new foreground color, or #NULL
Lines 6306-6311 Link Here
6306
						   0.5,
6534
						   0.5,
6307
						   &color);
6535
						   &color);
6308
			break;
6536
			break;
6537
		case VTE_DEF_HL:
6538
			color.red = 0xc000;
6539
			color.blue = 0xc000;
6540
			color.green = 0xc000;
6541
			break;
6542
		case VTE_CUR_BG:
6543
			color.red = 0x0000;
6544
			color.blue = 0x0000;
6545
			color.green = 0x0000;
6546
			break;
6309
		case 0 + 0:
6547
		case 0 + 0:
6310
		case 0 + 1:
6548
		case 0 + 1:
6311
		case 0 + 2:
6549
		case 0 + 2:
Lines 6620-6626 Link Here
6620
#endif
6858
#endif
6621
6859
6622
/* Handle a terminal control sequence and its parameters. */
6860
/* Handle a terminal control sequence and its parameters. */
6623
static void
6861
static gboolean
6624
vte_terminal_handle_sequence(GtkWidget *widget,
6862
vte_terminal_handle_sequence(GtkWidget *widget,
6625
			     const char *match_s,
6863
			     const char *match_s,
6626
			     GQuark match,
6864
			     GQuark match,
Lines 6630-6638 Link Here
6630
	VteTerminalSequenceHandler handler;
6868
	VteTerminalSequenceHandler handler;
6631
	VteScreen *screen;
6869
	VteScreen *screen;
6632
	struct vte_cursor_position position;
6870
	struct vte_cursor_position position;
6871
	gboolean ret;
6633
6872
6634
	g_return_if_fail(widget != NULL);
6873
	g_return_val_if_fail(widget != NULL, FALSE);
6635
	g_return_if_fail(VTE_IS_TERMINAL(widget));
6874
	g_return_val_if_fail(VTE_IS_TERMINAL(widget), FALSE);
6636
	terminal = VTE_TERMINAL(widget);
6875
	terminal = VTE_TERMINAL(widget);
6637
	screen = terminal->pvt->screen;
6876
	screen = terminal->pvt->screen;
6638
6877
Lines 6653-6668 Link Here
6653
#endif
6892
#endif
6654
	if (handler != NULL) {
6893
	if (handler != NULL) {
6655
		/* Let the handler handle it. */
6894
		/* Let the handler handle it. */
6656
		handler(terminal, match_s, match, params);
6895
		ret = handler(terminal, match_s, match, params);
6657
	} else {
6896
	} else {
6658
		g_warning(_("No handler for control sequence `%s' defined."),
6897
		g_warning(_("No handler for control sequence `%s' defined."),
6659
			  match_s);
6898
			  match_s);
6899
		ret = FALSE;
6660
	}
6900
	}
6661
6901
6662
	/* Let the updating begin. */
6902
	/* Let the updating begin. */
6663
	if (GTK_WIDGET_REALIZED (widget)) {
6903
	if (GTK_WIDGET_REALIZED (widget)) {
6664
		gdk_window_thaw_updates(widget->window);
6904
		gdk_window_thaw_updates(widget->window);
6665
	}
6905
	}
6906
6907
	return ret;
6666
}
6908
}
6667
6909
6668
/* Catch a VteReaper child-exited signal, and if it matches the one we're
6910
/* Catch a VteReaper child-exited signal, and if it matches the one we're
Lines 6790-6818 Link Here
6790
	}
7032
	}
6791
}
7033
}
6792
7034
6793
/**
7035
/* Basic wrapper around _vte_pty_open, which handles the pipefitting. */
6794
 * vte_terminal_fork_command:
7036
static pid_t
6795
 * @terminal: a #VteTerminal
7037
_vte_terminal_fork_basic(VteTerminal *terminal, const char *command,
6796
 * @command: the name of a binary to run
7038
			 char **argv, char **envv,
6797
 * @argv: the argument list to be passed to @command
7039
			 const char *directory,
6798
 * @envv: a list of environment variables to be added to the environment before
7040
			 gboolean lastlog, gboolean utmp, gboolean wtmp)
6799
 * starting @command
6800
 * @directory: the name of a directory the command should start in, or NULL
6801
 * @lastlog: TRUE if the session should be logged to the lastlog
6802
 * @utmp: TRUE if the session should be logged to the utmp/utmpx log
6803
 * @wtmp: TRUE if the session should be logged to the wtmp/wtmpx log
6804
 *
6805
 * Starts the specified command under a newly-allocated controlling
6806
 * pseudo-terminal.  TERM is automatically set to reflect the terminal widget's
6807
 * emulation setting.  If @lastlog, @utmp, or @wtmp are TRUE, logs the session
6808
 * to the specified system log files.
6809
 *
6810
 * Returns: the ID of the new process
6811
 */
6812
pid_t
6813
vte_terminal_fork_command(VteTerminal *terminal, const char *command,
6814
			  char **argv, char **envv, const char *directory,
6815
			  gboolean lastlog, gboolean utmp, gboolean wtmp)
6816
{
7041
{
6817
	char **env_add;
7042
	char **env_add;
6818
	int i;
7043
	int i;
Lines 6820-6864 Link Here
6820
	GtkWidget *widget;
7045
	GtkWidget *widget;
6821
	VteReaper *reaper;
7046
	VteReaper *reaper;
6822
7047
6823
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
6824
	widget = GTK_WIDGET(terminal);
7048
	widget = GTK_WIDGET(terminal);
6825
7049
6826
	/* Start up the command and get the PTY of the master. */
7050
	/* Duplicate the environment, and add one more variable. */
6827
	for (i = 0; (envv != NULL) && (envv[i] != NULL); i++) ;
7051
	for (i = 0; (envv != NULL) && (envv[i] != NULL); i++) {
6828
7052
		/* nothing */ ;
6829
	env_add = g_malloc0(sizeof(char*) * (i + 2));
6830
	if (command == NULL) {
6831
		command = terminal->pvt->shell;
6832
	}
7053
	}
6833
7054
	env_add = g_malloc0(sizeof(char*) * (i + 2));
6834
	env_add[0] = g_strdup_printf("TERM=%s", terminal->pvt->emulation);
7055
	env_add[0] = g_strdup_printf("TERM=%s", terminal->pvt->emulation);
6835
	for (i = 0; (envv != NULL) && (envv[i] != NULL); i++) {
7056
	for (i = 0; (envv != NULL) && (envv[i] != NULL); i++) {
6836
		env_add[i + 1] = g_strdup(envv[i]);
7057
		env_add[i + 1] = g_strdup(envv[i]);
6837
	}
7058
	}
6838
	env_add[i + 1] = NULL;
7059
	env_add[i + 1] = NULL;
6839
7060
7061
	/* Close any existing ptys. */
6840
	if (terminal->pvt->pty_master != -1) {
7062
	if (terminal->pvt->pty_master != -1) {
6841
		_vte_pty_close(terminal->pvt->pty_master);
7063
		_vte_pty_close(terminal->pvt->pty_master);
6842
		close(terminal->pvt->pty_master);
7064
		close(terminal->pvt->pty_master);
6843
	}
7065
	}
6844
	terminal->pvt->pty_master = _vte_pty_open(&pid,
6845
						  env_add,
6846
						  command,
6847
						  argv,
6848
						  directory,
6849
						  terminal->column_count,
6850
						  terminal->row_count,
6851
						  lastlog,
6852
						  utmp,
6853
						  wtmp);
6854
7066
6855
	for (i = 0; env_add[i] != NULL; i++) {
7067
	/* Open the new pty. */
6856
		g_free(env_add[i]);
7068
	pid = -1;
7069
	i = _vte_pty_open(&pid, env_add, command, argv, directory,
7070
			  terminal->column_count, terminal->row_count,
7071
			  lastlog, utmp, wtmp);
7072
	switch (i) {
7073
	case -1:
7074
		return -1;
7075
		break;
7076
	default:
7077
		if (pid != 0) {
7078
			terminal->pvt->pty_master = i;
7079
		}
6857
	}
7080
	}
6858
	g_free(env_add);
6859
7081
6860
	/* If we started the process, set up to listen for its output. */
7082
	/* If we successfully started the process, set up to listen for its
6861
	if (pid != -1) {
7083
	 * output. */
7084
	if ((pid != -1) && (pid != 0)) {
6862
		/* Set this as the child's pid. */
7085
		/* Set this as the child's pid. */
6863
		terminal->pvt->pty_pid = pid;
7086
		terminal->pvt->pty_pid = pid;
6864
7087
Lines 6892-6901 Link Here
6892
		_vte_terminal_connect_pty_read(terminal);
7115
		_vte_terminal_connect_pty_read(terminal);
6893
	}
7116
	}
6894
7117
7118
	/* Clean up. */
7119
	for (i = 0; env_add[i] != NULL; i++) {
7120
		g_free(env_add[i]);
7121
	}
7122
	g_free(env_add);
7123
6895
	/* Return the pid to the caller. */
7124
	/* Return the pid to the caller. */
6896
	return pid;
7125
	return pid;
6897
}
7126
}
6898
7127
7128
/**
7129
 * vte_terminal_fork_command:
7130
 * @terminal: a #VteTerminal
7131
 * @command: the name of a binary to run
7132
 * @argv: the argument list to be passed to @command
7133
 * @envv: a list of environment variables to be added to the environment before
7134
 * starting @command, or NULL
7135
 * @directory: the name of a directory the command should start in, or NULL
7136
 * @lastlog: TRUE if the session should be logged to the lastlog
7137
 * @utmp: TRUE if the session should be logged to the utmp/utmpx log
7138
 * @wtmp: TRUE if the session should be logged to the wtmp/wtmpx log
7139
 *
7140
 * Starts the specified command under a newly-allocated controlling
7141
 * pseudo-terminal.  TERM is automatically set to reflect the terminal widget's
7142
 * emulation setting.  If @lastlog, @utmp, or @wtmp are TRUE, logs the session
7143
 * to the specified system log files.
7144
 *
7145
 * Returns: the ID of the new process
7146
 */
7147
pid_t
7148
vte_terminal_fork_command(VteTerminal *terminal,
7149
			  const char *command, char **argv, char **envv,
7150
			  const char *directory,
7151
			  gboolean lastlog, gboolean utmp, gboolean wtmp)
7152
{
7153
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
7154
7155
	/* Make the user's shell the default command. */
7156
	if (command == NULL) {
7157
		command = terminal->pvt->shell;
7158
	}
7159
7160
	/* Start up the command and get the PTY of the master. */
7161
	return _vte_terminal_fork_basic(terminal, command, argv, envv,
7162
				        directory, lastlog, utmp, wtmp);
7163
}
7164
7165
/**
7166
 * vte_terminal_forkpty:
7167
 * @terminal: a #VteTerminal
7168
 * @envv: a list of environment variables to be added to the environment before
7169
 * starting returning in the child process, or NULL
7170
 * @directory: the name of a directory the child process should change to, or
7171
 * NULL
7172
 * @lastlog: TRUE if the session should be logged to the lastlog
7173
 * @utmp: TRUE if the session should be logged to the utmp/utmpx log
7174
 * @wtmp: TRUE if the session should be logged to the wtmp/wtmpx log
7175
 *
7176
 * Starts a new child process under a newly-allocated controlling
7177
 * pseudo-terminal.  TERM is automatically set to reflect the terminal widget's
7178
 * emulation setting.  If @lastlog, @utmp, or @wtmp are TRUE, logs the session
7179
 * to the specified system log files.
7180
 *
7181
 * Returns: the ID of the new process in the parent, 0 in the child, and -1 if
7182
 * there was an error
7183
 *
7184
 * Since: 0.11.11
7185
 */
7186
pid_t
7187
vte_terminal_forkpty(VteTerminal *terminal,
7188
		     char **envv, const char *directory,
7189
		     gboolean lastlog, gboolean utmp, gboolean wtmp)
7190
{
7191
	pid_t ret;
7192
7193
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
7194
7195
	ret = _vte_terminal_fork_basic(terminal, NULL, NULL, envv,
7196
				       directory, lastlog, utmp, wtmp);
7197
7198
	return ret;
7199
}
7200
6899
/* Handle an EOF from the client. */
7201
/* Handle an EOF from the client. */
6900
static void
7202
static void
6901
vte_terminal_eof(GIOChannel *channel, gpointer data)
7203
vte_terminal_eof(GIOChannel *channel, gpointer data)
Lines 6951-6956 Link Here
6951
			g_free(terminal->pvt->im_preedit);
7253
			g_free(terminal->pvt->im_preedit);
6952
			terminal->pvt->im_preedit = NULL;
7254
			terminal->pvt->im_preedit = NULL;
6953
		}
7255
		}
7256
		if (terminal->pvt->im_preedit_attrs != NULL) {
7257
			pango_attr_list_unref(terminal->pvt->im_preedit_attrs);
7258
			terminal->pvt->im_preedit_attrs = NULL;
7259
		}
6954
	}
7260
	}
6955
}
7261
}
6956
7262
Lines 7034-7040 Link Here
7034
	const char *match;
7340
	const char *match;
7035
	GQuark quark;
7341
	GQuark quark;
7036
	const gunichar *next;
7342
	const gunichar *next;
7037
	gboolean leftovers, modified, bottom, inserted;
7343
	gboolean leftovers, modified, bottom, inserted, again;
7038
	GArray *unichars;
7344
	GArray *unichars;
7039
7345
7040
	g_return_val_if_fail(GTK_IS_WIDGET(data), FALSE);
7346
	g_return_val_if_fail(GTK_IS_WIDGET(data), FALSE);
Lines 7069-7075 Link Here
7069
	terminal->pvt->text_deleted_count = 0;
7375
	terminal->pvt->text_deleted_count = 0;
7070
7376
7071
	/* We should only be called when there's data to process. */
7377
	/* We should only be called when there's data to process. */
7072
	g_assert(_vte_buffer_length(terminal->pvt->incoming) > 0);
7378
	g_assert((_vte_buffer_length(terminal->pvt->incoming) > 0) ||
7379
		 (terminal->pvt->pending->len > 0));
7073
7380
7074
	/* Convert the data into unicode characters. */
7381
	/* Convert the data into unicode characters. */
7075
	unichars = terminal->pvt->pending;
7382
	unichars = terminal->pvt->pending;
Lines 7083-7091 Link Here
7083
7390
7084
	/* Try initial substrings. */
7391
	/* Try initial substrings. */
7085
	start = 0;
7392
	start = 0;
7086
	modified = leftovers = inserted = FALSE;
7393
	modified = leftovers = inserted = again = FALSE;
7087
7394
7088
	while ((start < wcount) && !leftovers) {
7395
	while ((start < wcount) && !leftovers && !again) {
7089
		/* Try to match any control sequences. */
7396
		/* Try to match any control sequences. */
7090
		_vte_matcher_match(terminal->pvt->matcher,
7397
		_vte_matcher_match(terminal->pvt->matcher,
7091
				   &wbuf[start],
7398
				   &wbuf[start],
Lines 7109-7118 Link Here
7109
			vte_terminal_emit_pending_text_signals(terminal, quark);
7416
			vte_terminal_emit_pending_text_signals(terminal, quark);
7110
			/* Call the right sequence handler for the requested
7417
			/* Call the right sequence handler for the requested
7111
			 * behavior. */
7418
			 * behavior. */
7112
			vte_terminal_handle_sequence(GTK_WIDGET(terminal),
7419
			again = vte_terminal_handle_sequence(GTK_WIDGET(terminal),
7113
						     match,
7420
							     match,
7114
						     quark,
7421
							     quark,
7115
						     params);
7422
							     params);
7116
			/* Skip over the proper number of unicode chars. */
7423
			/* Skip over the proper number of unicode chars. */
7117
			start = (next - wbuf);
7424
			start = (next - wbuf);
7118
			/* Flush any pending signals. */
7425
			/* Flush any pending signals. */
Lines 7259-7264 Link Here
7259
		terminal->pvt->pending = unichars;
7566
		terminal->pvt->pending = unichars;
7260
	} else {
7567
	} else {
7261
		g_array_set_size(terminal->pvt->pending, 0);
7568
		g_array_set_size(terminal->pvt->pending, 0);
7569
		/* If we're out of data, we needn't pause to let the
7570
		 * controlling application respond to incoming data, because
7571
		 * the main loop is already going to do that. */
7572
		again = FALSE;
7262
	}
7573
	}
7263
7574
7264
	/* Flush any pending "inserted" signals. */
7575
	/* Flush any pending "inserted" signals. */
Lines 7295-7300 Link Here
7295
	if (modified || (screen != terminal->pvt->screen)) {
7606
	if (modified || (screen != terminal->pvt->screen)) {
7296
		/* Signal that the visible contents changed. */
7607
		/* Signal that the visible contents changed. */
7297
		vte_terminal_match_contents_clear(terminal);
7608
		vte_terminal_match_contents_clear(terminal);
7609
		vte_terminal_emit_contents_changed(terminal);
7298
	}
7610
	}
7299
7611
7300
	if ((cursor.col != terminal->pvt->screen->cursor_current.col) ||
7612
	if ((cursor.col != terminal->pvt->screen->cursor_current.col) ||
Lines 7324-7334 Link Here
7324
	}
7636
	}
7325
#endif
7637
#endif
7326
	/* Disconnect this function from the main loop. */
7638
	/* Disconnect this function from the main loop. */
7327
	terminal->pvt->processing = FALSE;
7639
	if (!again) {
7328
	if (terminal->pvt->processing_tag != VTE_INVALID_SOURCE) {
7640
		terminal->pvt->processing = FALSE;
7329
		g_source_remove(terminal->pvt->processing_tag);
7641
		if (terminal->pvt->processing_tag != VTE_INVALID_SOURCE) {
7642
			g_source_remove(terminal->pvt->processing_tag);
7643
		}
7644
		terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
7330
	}
7645
	}
7331
	terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
7332
7646
7333
#ifdef VTE_DEBUG
7647
#ifdef VTE_DEBUG
7334
	if (_vte_debug_on(VTE_DEBUG_IO)) {
7648
	if (_vte_debug_on(VTE_DEBUG_IO)) {
Lines 7743-7749 Link Here
7743
		fprintf(stderr, "Input method pre-edit ended.\n");
8057
		fprintf(stderr, "Input method pre-edit ended.\n");
7744
	}
8058
	}
7745
#endif
8059
#endif
7746
	terminal->pvt->im_preedit_active = TRUE;
8060
	terminal->pvt->im_preedit_active = FALSE;
7747
}
8061
}
7748
8062
7749
/* The pre-edit string changed. */
8063
/* The pre-edit string changed. */
Lines 7771-7781 Link Here
7771
	 * for repainting. */
8085
	 * for repainting. */
7772
	vte_invalidate_cursor_once(terminal, FALSE);
8086
	vte_invalidate_cursor_once(terminal, FALSE);
7773
8087
7774
	pango_attr_list_unref(attrs);
7775
	if (terminal->pvt->im_preedit != NULL) {
8088
	if (terminal->pvt->im_preedit != NULL) {
7776
		g_free(terminal->pvt->im_preedit);
8089
		g_free(terminal->pvt->im_preedit);
7777
	}
8090
	}
7778
	terminal->pvt->im_preedit = str;
8091
	terminal->pvt->im_preedit = str;
8092
8093
	if (terminal->pvt->im_preedit_attrs != NULL) {
8094
		pango_attr_list_unref(terminal->pvt->im_preedit_attrs);
8095
	}
8096
	terminal->pvt->im_preedit_attrs = attrs;
8097
7779
	terminal->pvt->im_preedit_cursor = cursor;
8098
	terminal->pvt->im_preedit_cursor = cursor;
7780
8099
7781
	vte_invalidate_cursor_once(terminal, FALSE);
8100
	vte_invalidate_cursor_once(terminal, FALSE);
Lines 7786-7791 Link Here
7786
vte_terminal_configure_toplevel(GtkWidget *widget, GdkEventConfigure *event,
8105
vte_terminal_configure_toplevel(GtkWidget *widget, GdkEventConfigure *event,
7787
				gpointer data)
8106
				gpointer data)
7788
{
8107
{
8108
	VteTerminal *terminal;
8109
7789
#ifdef VTE_DEBUG
8110
#ifdef VTE_DEBUG
7790
	if (_vte_debug_on(VTE_DEBUG_EVENTS)) {
8111
	if (_vte_debug_on(VTE_DEBUG_EVENTS)) {
7791
		fprintf(stderr, "Top level parent configured.\n");
8112
		fprintf(stderr, "Top level parent configured.\n");
Lines 7794-7803 Link Here
7794
	g_return_val_if_fail(GTK_IS_WIDGET(widget), FALSE);
8115
	g_return_val_if_fail(GTK_IS_WIDGET(widget), FALSE);
7795
	g_return_val_if_fail(GTK_WIDGET_TOPLEVEL(widget), FALSE);
8116
	g_return_val_if_fail(GTK_WIDGET_TOPLEVEL(widget), FALSE);
7796
	g_return_val_if_fail(VTE_IS_TERMINAL(data), FALSE);
8117
	g_return_val_if_fail(VTE_IS_TERMINAL(data), FALSE);
8118
	terminal = VTE_TERMINAL(data);
7797
8119
7798
	/* In case we were resized, repaint everything, including any border
8120
	if (terminal->pvt->bg_transparent) {
7799
	 * regions which no cell covers. */
8121
		/* We have to repaint the entire window, because we don't get
7800
	vte_invalidate_all(VTE_TERMINAL(data));
8122
		 * an expose event unless some portion of our visible area
8123
		 * moved out from behind another window. */
8124
		vte_invalidate_all(terminal);
8125
	}
7801
8126
7802
	return FALSE;
8127
	return FALSE;
7803
}
8128
}
Lines 7845-7851 Link Here
7845
	if (pango_font_description_equal(style->font_desc,
8170
	if (pango_font_description_equal(style->font_desc,
7846
					 widget->style->font_desc) ||
8171
					 widget->style->font_desc) ||
7847
	    (terminal->pvt->fontdesc == NULL)) {
8172
	    (terminal->pvt->fontdesc == NULL)) {
7848
		vte_terminal_set_font(terminal, terminal->pvt->fontdesc);
8173
		vte_terminal_set_font_full(terminal, terminal->pvt->fontdesc,
8174
					   terminal->pvt->fontantialias);
7849
	}
8175
	}
7850
}
8176
}
7851
8177
Lines 7869-7879 Link Here
7869
	gunichar keychar = 0;
8195
	gunichar keychar = 0;
7870
	char keybuf[VTE_UTF8_BPC];
8196
	char keybuf[VTE_UTF8_BPC];
7871
	GdkModifierType modifiers;
8197
	GdkModifierType modifiers;
8198
	GtkWidgetClass *widget_class;
7872
8199
7873
	g_return_val_if_fail(widget != NULL, TRUE);
8200
	g_return_val_if_fail(widget != NULL, TRUE);
7874
	g_return_val_if_fail(VTE_IS_TERMINAL(widget), TRUE);
8201
	g_return_val_if_fail(VTE_IS_TERMINAL(widget), TRUE);
7875
	terminal = VTE_TERMINAL(widget);
8202
	terminal = VTE_TERMINAL(widget);
7876
8203
8204
	/* First, check if GtkWidget's behavior already does something with
8205
 	 * this key. */
8206
	widget_class = g_type_class_peek(GTK_TYPE_WIDGET);
8207
	if (GTK_WIDGET_CLASS(widget_class)->key_press_event) {
8208
		if ((GTK_WIDGET_CLASS(widget_class))->key_press_event(widget,
8209
								      event)) {
8210
			return TRUE;
8211
		}
8212
	}
8213
7877
	/* If it's a keypress, record that we got the event, in case the
8214
	/* If it's a keypress, record that we got the event, in case the
7878
	 * input method takes the event from us. */
8215
	 * input method takes the event from us. */
7879
	if (event->type == GDK_KEY_PRESS) {
8216
	if (event->type == GDK_KEY_PRESS) {
Lines 7922-7940 Link Here
7922
#endif
8259
#endif
7923
8260
7924
		/* We steal many keypad keys here. */
8261
		/* We steal many keypad keys here. */
7925
		switch (keyval) {
8262
		if (!terminal->pvt->im_preedit_active) {
7926
		case GDK_KP_Add:
8263
			switch (keyval) {
7927
		case GDK_KP_Subtract:
8264
			case GDK_KP_Add:
7928
		case GDK_KP_Multiply:
8265
			case GDK_KP_Subtract:
7929
		case GDK_KP_Divide:
8266
			case GDK_KP_Multiply:
7930
		case GDK_KP_Enter:
8267
			case GDK_KP_Divide:
7931
			steal = TRUE;
8268
			case GDK_KP_Enter:
7932
			break;
8269
				steal = TRUE;
7933
		default:
8270
				break;
7934
			break;
8271
			default:
7935
		}
8272
				break;
7936
		if (modifiers & VTE_META_MASK) {
8273
			}
7937
			steal = TRUE;
8274
			if (modifiers & VTE_META_MASK) {
8275
				steal = TRUE;
8276
			}
8277
			switch (keyval) {
8278
			case GDK_Multi_key:
8279
			case GDK_Codeinput:
8280
			case GDK_SingleCandidate:
8281
			case GDK_MultipleCandidate:
8282
			case GDK_PreviousCandidate:
8283
			case GDK_Kanji:
8284
			case GDK_Muhenkan:
8285
			case GDK_Henkan:
8286
			case GDK_Romaji:
8287
			case GDK_Hiragana:
8288
			case GDK_Katakana:
8289
			case GDK_Hiragana_Katakana:
8290
			case GDK_Zenkaku:
8291
			case GDK_Hankaku:
8292
			case GDK_Zenkaku_Hankaku:
8293
			case GDK_Touroku:
8294
			case GDK_Massyo:
8295
			case GDK_Kana_Lock:
8296
			case GDK_Kana_Shift:
8297
			case GDK_Eisu_Shift:
8298
			case GDK_Eisu_toggle:
8299
				steal = FALSE;
8300
				break;
8301
			default:
8302
				break;
8303
			}
7938
		}
8304
		}
7939
	}
8305
	}
7940
8306
Lines 7993-8003 Link Here
7993
		case GDK_Delete:
8359
		case GDK_Delete:
7994
			switch (terminal->pvt->delete_binding) {
8360
			switch (terminal->pvt->delete_binding) {
7995
			case VTE_ERASE_ASCII_BACKSPACE:
8361
			case VTE_ERASE_ASCII_BACKSPACE:
7996
				normal = g_strdup("");
8362
				normal = g_strdup("\010");
7997
				normal_length = 1;
8363
				normal_length = 1;
7998
				break;
8364
				break;
7999
			case VTE_ERASE_ASCII_DELETE:
8365
			case VTE_ERASE_ASCII_DELETE:
8000
				normal = g_strdup("");
8366
				normal = g_strdup("\177");
8001
				normal_length = 1;
8367
				normal_length = 1;
8002
				break;
8368
				break;
8003
			case VTE_ERASE_DELETE_SEQUENCE:
8369
			case VTE_ERASE_DELETE_SEQUENCE:
Lines 8141-8147 Link Here
8141
			    !suppress_meta_esc &&
8507
			    !suppress_meta_esc &&
8142
			    (normal_length > 0) &&
8508
			    (normal_length > 0) &&
8143
			    (terminal->pvt->modifiers & VTE_META_MASK)) {
8509
			    (terminal->pvt->modifiers & VTE_META_MASK)) {
8144
				vte_terminal_feed_child(terminal, "", 1);
8510
				vte_terminal_feed_child(terminal,
8511
							_VTE_CAP_ESC,
8512
							1);
8145
			}
8513
			}
8146
			if (normal_length > 0) {
8514
			if (normal_length > 0) {
8147
				vte_terminal_feed_child_using_modes(terminal,
8515
				vte_terminal_feed_child_using_modes(terminal,
Lines 8754-8759 Link Here
8754
			    gpointer data,
9122
			    gpointer data,
8755
			    GArray *attributes)
9123
			    GArray *attributes)
8756
{
9124
{
9125
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
8757
	return vte_terminal_get_text_range_maybe_wrapped(terminal,
9126
	return vte_terminal_get_text_range_maybe_wrapped(terminal,
8758
							 start_row, start_col,
9127
							 start_row, start_col,
8759
							 end_row, end_col,
9128
							 end_row, end_col,
Lines 8776-8782 Link Here
8776
					  GArray *attributes)
9145
					  GArray *attributes)
8777
{
9146
{
8778
	long col, row, last_space, last_spacecol,
9147
	long col, row, last_space, last_spacecol,
8779
	     last_nonspace, last_nonspacecol;
9148
	     last_nonspace, last_nonspacecol, line_start;
8780
	VteScreen *screen;
9149
	VteScreen *screen;
8781
	struct vte_charcell *pcell = NULL;
9150
	struct vte_charcell *pcell = NULL;
8782
	GString *string;
9151
	GString *string;
Lines 8796-8801 Link Here
8796
		last_space = last_nonspace = -1;
9165
		last_space = last_nonspace = -1;
8797
		last_spacecol = last_nonspacecol = -1;
9166
		last_spacecol = last_nonspacecol = -1;
8798
		attr.row = row;
9167
		attr.row = row;
9168
		line_start = string->len;
8799
		pcell = NULL;
9169
		pcell = NULL;
8800
		do {
9170
		do {
8801
			/* If it's not part of a multi-column character,
9171
			/* If it's not part of a multi-column character,
Lines 8883-8888 Link Here
8883
				g_string_truncate(string, last_nonspace + 1);
9253
				g_string_truncate(string, last_nonspace + 1);
8884
			}
9254
			}
8885
		}
9255
		}
9256
		/* If we found no non-whitespace characters on this line, trim
9257
		 * it, as xterm does. */
9258
		if (last_nonspacecol == -1) {
9259
			g_string_truncate(string, line_start);
9260
		}
8886
		/* Make sure that the attributes array is as long as the
9261
		/* Make sure that the attributes array is as long as the
8887
		 * string. */
9262
		 * string. */
8888
		if (attributes) {
9263
		if (attributes) {
Lines 8979-8984 Link Here
8979
		      gpointer data,
9354
		      gpointer data,
8980
		      GArray *attributes)
9355
		      GArray *attributes)
8981
{
9356
{
9357
	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
8982
	return vte_terminal_get_text_maybe_wrapped(terminal,
9358
	return vte_terminal_get_text_maybe_wrapped(terminal,
8983
						   TRUE,
9359
						   TRUE,
8984
						   is_selected ?
9360
						   is_selected ?
Lines 9090-9103 Link Here
9090
9466
9091
/* Start selection at the location of the event. */
9467
/* Start selection at the location of the event. */
9092
static void
9468
static void
9093
vte_terminal_start_selection(GtkWidget *widget, GdkEventButton *event,
9469
vte_terminal_start_selection(VteTerminal *terminal, GdkEventButton *event,
9094
			     enum vte_selection_type selection_type)
9470
			     enum vte_selection_type selection_type)
9095
{
9471
{
9096
	VteTerminal *terminal;
9097
	long cellx, celly, delta;
9472
	long cellx, celly, delta;
9098
9473
9099
	terminal = VTE_TERMINAL(widget);
9100
9101
	/* Convert the event coordinates to cell coordinates. */
9474
	/* Convert the event coordinates to cell coordinates. */
9102
	delta = terminal->pvt->screen->scroll_delta;
9475
	delta = terminal->pvt->screen->scroll_delta;
9103
	cellx = (event->x - VTE_PAD_WIDTH) / terminal->char_width;
9476
	cellx = (event->x - VTE_PAD_WIDTH) / terminal->char_width;
Lines 9158-9175 Link Here
9158
9531
9159
/* Extend selection to include the given event coordinates. */
9532
/* Extend selection to include the given event coordinates. */
9160
static void
9533
static void
9161
vte_terminal_extend_selection(GtkWidget *widget, double x, double y,
9534
vte_terminal_extend_selection(VteTerminal *terminal, double x, double y,
9162
			      gboolean always_grow)
9535
			      gboolean always_grow)
9163
{
9536
{
9164
	VteTerminal *terminal;
9165
	VteScreen *screen;
9537
	VteScreen *screen;
9166
	VteRowData *rowdata;
9538
	VteRowData *rowdata;
9167
	long delta, height, width, last_nonspace, i, j;
9539
	long delta, height, width, last_nonspace, i, j;
9168
	struct vte_charcell *cell;
9540
	struct vte_charcell *cell;
9169
	struct selection_event_coords *origin, *last, *start, *end;
9541
	struct selection_event_coords *origin, *last, *start, *end;
9170
	struct selection_cell_coords old_start, old_end, *sc, *ec, tc;
9542
	struct selection_cell_coords old_start, old_end, *sc, *ec, tc;
9543
	gboolean invalidate_selected = FALSE;
9171
9544
9172
	terminal = VTE_TERMINAL(widget);
9173
	screen = terminal->pvt->screen;
9545
	screen = terminal->pvt->screen;
9174
	old_start = terminal->pvt->selection_start;
9546
	old_start = terminal->pvt->selection_start;
9175
	old_end = terminal->pvt->selection_end;
9547
	old_end = terminal->pvt->selection_end;
Lines 9183-9188 Link Here
9183
	 * the selected block. */
9555
	 * the selected block. */
9184
	if (terminal->pvt->selecting_restart) {
9556
	if (terminal->pvt->selecting_restart) {
9185
		vte_terminal_deselect_all(terminal);
9557
		vte_terminal_deselect_all(terminal);
9558
		invalidate_selected = TRUE;
9186
		/* Record the origin of the selection. */
9559
		/* Record the origin of the selection. */
9187
		terminal->pvt->selection_origin =
9560
		terminal->pvt->selection_origin =
9188
			terminal->pvt->selection_restart_origin;
9561
			terminal->pvt->selection_restart_origin;
Lines 9489-9494 Link Here
9489
				     ABS(old_end.y -
9862
				     ABS(old_end.y -
9490
					 terminal->pvt->selection_end.y) + 1);
9863
					 terminal->pvt->selection_end.y) + 1);
9491
	}
9864
	}
9865
	if (invalidate_selected) {
9866
#ifdef VTE_DEBUG
9867
		if (_vte_debug_on(VTE_DEBUG_SELECTION)) {
9868
			fprintf(stderr, "Refreshing lines %ld to %ld.\n",
9869
				MIN(terminal->pvt->selection_start.y,
9870
				    terminal->pvt->selection_end.y),
9871
				MAX(terminal->pvt->selection_start.y,
9872
				    terminal->pvt->selection_end.y));
9873
		}
9874
#endif
9875
		vte_invalidate_cells(terminal,
9876
				     0,
9877
				     terminal->column_count,
9878
				     MIN(terminal->pvt->selection_start.y,
9879
				         terminal->pvt->selection_end.y),
9880
				     MAX(terminal->pvt->selection_start.y,
9881
					 terminal->pvt->selection_end.y) -
9882
				     MIN(terminal->pvt->selection_start.y,
9883
				         terminal->pvt->selection_end.y) + 1);
9884
	}
9492
9885
9493
#ifdef VTE_DEBUG
9886
#ifdef VTE_DEBUG
9494
	if (_vte_debug_on(VTE_DEBUG_SELECTION)) {
9887
	if (_vte_debug_on(VTE_DEBUG_SELECTION)) {
Lines 9566-9572 Link Here
9566
			x = terminal->column_count * terminal->char_width;
9959
			x = terminal->column_count * terminal->char_width;
9567
		}
9960
		}
9568
		/* Extend selection to cover the newly-scrolled area. */
9961
		/* Extend selection to cover the newly-scrolled area. */
9569
		vte_terminal_extend_selection(widget, x, y, FALSE);
9962
		vte_terminal_extend_selection(terminal, x, y, FALSE);
9570
	} else {
9963
	} else {
9571
		/* Stop autoscrolling. */
9964
		/* Stop autoscrolling. */
9572
		terminal->pvt->mouse_autoscroll_tag = 0;
9965
		terminal->pvt->mouse_autoscroll_tag = 0;
Lines 9641-9647 Link Here
9641
#endif
10034
#endif
9642
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
10035
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
9643
			    !event_mode) {
10036
			    !event_mode) {
9644
				vte_terminal_extend_selection(widget,
10037
				vte_terminal_extend_selection(terminal,
9645
							      event->x - VTE_PAD_WIDTH,
10038
							      event->x - VTE_PAD_WIDTH,
9646
							      event->y - VTE_PAD_WIDTH,
10039
							      event->y - VTE_PAD_WIDTH,
9647
							      FALSE);
10040
							      FALSE);
Lines 9755-9766 Link Here
9755
					start_selecting = TRUE;
10148
					start_selecting = TRUE;
9756
				}
10149
				}
9757
			} else {
10150
			} else {
9758
				/* If the user hit shift, and the location
10151
				/* If the user hit shift, then extend the
9759
				 * clicked isn't selected, and we already have
10152
				 * selection instead. */
9760
				 * a selection, extend selection, otherwise
9761
				 * start over. */
9762
				if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) &&
10153
				if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) &&
9763
				    terminal->pvt->has_selection &&
10154
				    (terminal->pvt->has_selection ||
10155
				     terminal->pvt->selecting_restart) &&
9764
				    !vte_cell_is_selected(terminal,
10156
				    !vte_cell_is_selected(terminal,
9765
							  cellx,
10157
							  cellx,
9766
							  celly,
10158
							  celly,
Lines 9772-9787 Link Here
9772
			}
10164
			}
9773
			if (start_selecting) {
10165
			if (start_selecting) {
9774
				vte_terminal_deselect_all(terminal);
10166
				vte_terminal_deselect_all(terminal);
9775
				vte_terminal_start_selection(widget,
10167
				vte_terminal_start_selection(terminal,
9776
							     event,
10168
							     event,
9777
							     selection_type_char);
10169
							     selection_type_char);
9778
				handled = TRUE;
10170
				handled = TRUE;
9779
			}
10171
			}
9780
			if (extend_selecting) {
10172
			if (extend_selecting) {
9781
				vte_terminal_extend_selection(widget,
10173
				vte_terminal_extend_selection(terminal,
9782
							      event->x - VTE_PAD_WIDTH,
10174
							      event->x - VTE_PAD_WIDTH,
9783
							      event->y - VTE_PAD_WIDTH,
10175
							      event->y - VTE_PAD_WIDTH,
9784
							      TRUE);
10176
							      !terminal->pvt->selecting_restart);
9785
				handled = TRUE;
10177
				handled = TRUE;
9786
			}
10178
			}
9787
			break;
10179
			break;
Lines 9819-9828 Link Here
9819
		case 1:
10211
		case 1:
9820
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
10212
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
9821
			    !event_mode) {
10213
			    !event_mode) {
9822
				vte_terminal_start_selection(widget,
10214
				vte_terminal_start_selection(terminal,
9823
							     event,
10215
							     event,
9824
							     selection_type_word);
10216
							     selection_type_word);
9825
				vte_terminal_extend_selection(widget,
10217
				vte_terminal_extend_selection(terminal,
9826
							      event->x - VTE_PAD_WIDTH,
10218
							      event->x - VTE_PAD_WIDTH,
9827
							      event->y - VTE_PAD_WIDTH,
10219
							      event->y - VTE_PAD_WIDTH,
9828
							      FALSE);
10220
							      FALSE);
Lines 9848-9857 Link Here
9848
		case 1:
10240
		case 1:
9849
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
10241
			if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
9850
			    !event_mode) {
10242
			    !event_mode) {
9851
				vte_terminal_start_selection(widget,
10243
				vte_terminal_start_selection(terminal,
9852
							     event,
10244
							     event,
9853
							     selection_type_line);
10245
							     selection_type_line);
9854
				vte_terminal_extend_selection(widget,
10246
				vte_terminal_extend_selection(terminal,
9855
							      event->x - VTE_PAD_WIDTH,
10247
							      event->x - VTE_PAD_WIDTH,
9856
							      event->y - VTE_PAD_WIDTH,
10248
							      event->y - VTE_PAD_WIDTH,
9857
							      FALSE);
10249
							      FALSE);
Lines 10089-10097 Link Here
10089
}
10481
}
10090
10482
10091
/**
10483
/**
10092
 * vte_terminal_set_font:
10484
 * vte_terminal_set_font_full:
10093
 * @terminal: a #VteTerminal
10485
 * @terminal: a #VteTerminal
10094
 * @font_desc: The #PangoFontDescription of the desired font.
10486
 * @font_desc: The #PangoFontDescription of the desired font.
10487
 * @anti_alias: Specify if anti aliasing of the fonts is to be used or not.
10095
 *
10488
 *
10096
 * Sets the font used for rendering all text displayed by the terminal,
10489
 * Sets the font used for rendering all text displayed by the terminal,
10097
 * overriding any fonts set using gtk_widget_modify_font().  The terminal
10490
 * overriding any fonts set using gtk_widget_modify_font().  The terminal
Lines 10099-10108 Link Here
10099
 * metrics, and attempt to resize itself to keep the same number of rows
10492
 * metrics, and attempt to resize itself to keep the same number of rows
10100
 * and columns.
10493
 * and columns.
10101
 *
10494
 *
10495
 * Since: 0.11.11
10102
 */
10496
 */
10103
void
10497
void
10104
vte_terminal_set_font(VteTerminal *terminal,
10498
vte_terminal_set_font_full(VteTerminal *terminal,
10105
		      const PangoFontDescription *font_desc)
10499
			   const PangoFontDescription *font_desc,
10500
			   VteTerminalAntiAlias anti_alias)
10106
{
10501
{
10107
	GtkWidget *widget;
10502
	GtkWidget *widget;
10108
	PangoFontDescription *desc;
10503
	PangoFontDescription *desc;
Lines 10133-10147 Link Here
10133
		}
10528
		}
10134
#endif
10529
#endif
10135
	}
10530
	}
10531
	terminal->pvt->fontantialias = anti_alias;
10136
10532
10137
	/* Free the old font description and save the new one. */
10533
	/* Free the old font description and save the new one. */
10138
	if (terminal->pvt->fontdesc != NULL) {
10534
	if (terminal->pvt->fontdesc != NULL) {
10139
		pango_font_description_free(terminal->pvt->fontdesc);
10535
		pango_font_description_free(terminal->pvt->fontdesc);
10140
	}
10536
	}
10141
	terminal->pvt->fontdesc = desc;
10537
	terminal->pvt->fontdesc = desc;
10538
	terminal->pvt->fontantialias = anti_alias;
10142
10539
10143
	/* Set the drawing font. */
10540
	/* Set the drawing font. */
10144
	_vte_draw_set_text_font(terminal->pvt->draw, terminal->pvt->fontdesc);
10541
	_vte_draw_set_text_font(terminal->pvt->draw,
10542
				terminal->pvt->fontdesc,
10543
				anti_alias);
10145
	vte_terminal_apply_metrics(terminal,
10544
	vte_terminal_apply_metrics(terminal,
10146
				   _vte_draw_get_text_width(terminal->pvt->draw),
10545
				   _vte_draw_get_text_width(terminal->pvt->draw),
10147
				   _vte_draw_get_text_height(terminal->pvt->draw),
10546
				   _vte_draw_get_text_height(terminal->pvt->draw),
Lines 10153-10168 Link Here
10153
}
10552
}
10154
10553
10155
/**
10554
/**
10156
 * vte_terminal_set_font_from_string:
10555
 * vte_terminal_set_font:
10556
 * @terminal: a #VteTerminal
10557
 * @font_desc: The #PangoFontDescription of the desired font.
10558
 *
10559
 * Sets the font used for rendering all text displayed by the terminal,
10560
 * overriding any fonts set using gtk_widget_modify_font().  The terminal
10561
 * will immediately attempt to load the desired font, retrieve its
10562
 * metrics, and attempt to resize itself to keep the same number of rows
10563
 * and columns.
10564
 *
10565
 */
10566
void
10567
vte_terminal_set_font(VteTerminal *terminal,
10568
		      const PangoFontDescription *font_desc)
10569
{
10570
	vte_terminal_set_font_full(terminal, font_desc,
10571
				   VTE_ANTI_ALIAS_USE_DEFAULT);
10572
}
10573
10574
/**
10575
 * vte_terminal_set_font_from_string_full:
10157
 * @terminal: a #VteTerminal
10576
 * @terminal: a #VteTerminal
10158
 * @name: A string describing the font.
10577
 * @name: A string describing the font.
10578
 * @antialias: Whether or not to antialias the font (if possible).
10159
 *
10579
 *
10160
 * A convenience function which converts @name into a #PangoFontDescription and
10580
 * A convenience function which converts @name into a #PangoFontDescription and
10161
 * passes it to vte_terminal_set_font().
10581
 * passes it to vte_terminal_set_font_full().
10162
 *
10582
 *
10583
 * Since: 0.11.11
10163
 */
10584
 */
10164
void
10585
void
10165
vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name)
10586
vte_terminal_set_font_from_string_full(VteTerminal *terminal, const char *name,
10587
				       VteTerminalAntiAlias antialias)
10166
{
10588
{
10167
	PangoFontDescription *font_desc;
10589
	PangoFontDescription *font_desc;
10168
	g_return_if_fail(VTE_IS_TERMINAL(terminal));
10590
	g_return_if_fail(VTE_IS_TERMINAL(terminal));
Lines 10170-10180 Link Here
10170
	g_return_if_fail(strlen(name) > 0);
10592
	g_return_if_fail(strlen(name) > 0);
10171
10593
10172
	font_desc = pango_font_description_from_string(name);
10594
	font_desc = pango_font_description_from_string(name);
10173
	vte_terminal_set_font(terminal, font_desc);
10595
	vte_terminal_set_font_full(terminal, font_desc, antialias);
10174
	pango_font_description_free(font_desc);
10596
	pango_font_description_free(font_desc);
10175
}
10597
}
10176
10598
10177
/**
10599
/**
10600
 * vte_terminal_set_font_from_string:
10601
 * @terminal: a #VteTerminal
10602
 * @name: A string describing the font.
10603
 *
10604
 * A convenience function which converts @name into a #PangoFontDescription and
10605
 * passes it to vte_terminal_set_font().
10606
 *
10607
 */
10608
void
10609
vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name)
10610
{
10611
	vte_terminal_set_font_from_string_full(terminal, name,
10612
					       VTE_ANTI_ALIAS_USE_DEFAULT);
10613
}
10614
10615
/**
10178
 * vte_terminal_get_font:
10616
 * vte_terminal_get_font:
10179
 * @terminal: a #VteTerminal
10617
 * @terminal: a #VteTerminal
10180
 *
10618
 *
Lines 10440-10445 Link Here
10440
	terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->termcap,
10878
	terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->termcap,
10441
							    terminal->pvt->emulation,
10879
							    terminal->pvt->emulation,
10442
							    "ul");
10880
							    "ul");
10881
	terminal->pvt->flags.xn = _vte_termcap_find_boolean(terminal->pvt->termcap,
10882
							    terminal->pvt->emulation,
10883
							    "xn");
10443
10884
10444
	/* Resize to the given default. */
10885
	/* Resize to the given default. */
10445
	columns = _vte_termcap_find_numeric(terminal->pvt->termcap,
10886
	columns = _vte_termcap_find_numeric(terminal->pvt->termcap,
Lines 10558-10564 Link Here
10558
			spec->name);
10999
			spec->name);
10559
	}
11000
	}
10560
#endif
11001
#endif
10561
	vte_terminal_set_font(terminal, terminal->pvt->fontdesc);
11002
	vte_terminal_set_font_full(terminal, terminal->pvt->fontdesc,
11003
				   terminal->pvt->fontantialias);
10562
}
11004
}
10563
11005
10564
/* Connect to notifications from our settings object that font hints have
11006
/* Connect to notifications from our settings object that font hints have
Lines 10679-10684 Link Here
10679
	pvt->flags.am = FALSE;
11121
	pvt->flags.am = FALSE;
10680
	pvt->flags.bw = FALSE;
11122
	pvt->flags.bw = FALSE;
10681
	pvt->flags.ul = FALSE;
11123
	pvt->flags.ul = FALSE;
11124
	pvt->flags.xn = FALSE;
10682
	pvt->keypad_mode = VTE_KEYMODE_NORMAL;
11125
	pvt->keypad_mode = VTE_KEYMODE_NORMAL;
10683
	pvt->cursor_mode = VTE_KEYMODE_NORMAL;
11126
	pvt->cursor_mode = VTE_KEYMODE_NORMAL;
10684
	pvt->sun_fkey_mode = FALSE;
11127
	pvt->sun_fkey_mode = FALSE;
Lines 10856-10875 Link Here
10856
11299
10857
	/* Rendering data.  Try everything. */
11300
	/* Rendering data.  Try everything. */
10858
	pvt->palette_initialized = FALSE;
11301
	pvt->palette_initialized = FALSE;
11302
	pvt->highlight_color_set = FALSE;
10859
	memset(&pvt->palette, 0, sizeof(pvt->palette));
11303
	memset(&pvt->palette, 0, sizeof(pvt->palette));
10860
	pvt->draw = _vte_draw_new(GTK_WIDGET(terminal));
11304
	pvt->draw = _vte_draw_new(GTK_WIDGET(terminal));
10861
11305
10862
	/* The font description. */
11306
	/* The font description. */
10863
	pvt->fontdesc = NULL;
11307
	pvt->fontdesc = NULL;
11308
	pvt->fontantialias = VTE_ANTI_ALIAS_USE_DEFAULT;
10864
	pvt->connected_settings = NULL;
11309
	pvt->connected_settings = NULL;
10865
	gtk_widget_ensure_style(widget);
11310
	gtk_widget_ensure_style(widget);
10866
	vte_terminal_connect_xft_settings(terminal);
11311
	vte_terminal_connect_xft_settings(terminal);
10867
	vte_terminal_set_font(terminal, NULL);
11312
	vte_terminal_set_font_full(terminal, NULL, VTE_ANTI_ALIAS_USE_DEFAULT);
10868
11313
10869
	/* Input method support. */
11314
	/* Input method support. */
10870
	pvt->im_context = NULL;
11315
	pvt->im_context = NULL;
10871
	pvt->im_preedit_active = FALSE;
11316
	pvt->im_preedit_active = FALSE;
10872
	pvt->im_preedit = NULL;
11317
	pvt->im_preedit = NULL;
11318
	pvt->im_preedit_attrs = NULL;
10873
	pvt->im_preedit_cursor = 0;
11319
	pvt->im_preedit_cursor = 0;
10874
11320
10875
	/* Bookkeeping data for adjustment-changed signals. */
11321
	/* Bookkeeping data for adjustment-changed signals. */
Lines 10907-10914 Link Here
10907
	pvt->accessible_emit = FALSE;
11353
	pvt->accessible_emit = FALSE;
10908
11354
10909
#ifdef VTE_DEBUG
11355
#ifdef VTE_DEBUG
10910
	/* In debuggable mode, we always do this. */
11356
	/* In debuggable mode, we always used to do this. */
10911
	pvt->accessible = gtk_widget_get_accessible(GTK_WIDGET(terminal));
11357
	/* gtk_widget_get_accessible(GTK_WIDGET(terminal)); */
10912
#endif
11358
#endif
10913
}
11359
}
10914
11360
Lines 11132-11137 Link Here
11132
		g_free(terminal->pvt->im_preedit);
11578
		g_free(terminal->pvt->im_preedit);
11133
		terminal->pvt->im_preedit = NULL;
11579
		terminal->pvt->im_preedit = NULL;
11134
	}
11580
	}
11581
	if (terminal->pvt->im_preedit_attrs != NULL) {
11582
		pango_attr_list_unref(terminal->pvt->im_preedit_attrs);
11583
		terminal->pvt->im_preedit_attrs = NULL;
11584
	}
11135
	terminal->pvt->im_preedit_cursor = 0;
11585
	terminal->pvt->im_preedit_cursor = 0;
11136
11586
11137
	/* Unmap the widget if it hasn't been already. */
11587
	/* Unmap the widget if it hasn't been already. */
Lines 11214-11219 Link Here
11214
		pango_font_description_free(terminal->pvt->fontdesc);
11664
		pango_font_description_free(terminal->pvt->fontdesc);
11215
		terminal->pvt->fontdesc = NULL;
11665
		terminal->pvt->fontdesc = NULL;
11216
	}
11666
	}
11667
	terminal->pvt->fontantialias = VTE_ANTI_ALIAS_USE_DEFAULT;
11217
	vte_terminal_disconnect_xft_settings(terminal);
11668
	vte_terminal_disconnect_xft_settings(terminal);
11218
11669
11219
	/* Free matching data. */
11670
	/* Free matching data. */
Lines 11238-11244 Link Here
11238
				gdk_cursor_unref(regex->cursor);
11689
				gdk_cursor_unref(regex->cursor);
11239
				regex->cursor = NULL;
11690
				regex->cursor = NULL;
11240
			}
11691
			}
11241
			regfree(&regex->reg);
11692
			_vte_regex_free(regex->reg);
11693
			regex->reg = NULL;
11242
			regex->tag = 0;
11694
			regex->tag = 0;
11243
		}
11695
		}
11244
		g_array_free(terminal->pvt->match_regexes, TRUE);
11696
		g_array_free(terminal->pvt->match_regexes, TRUE);
Lines 11497-11503 Link Here
11497
	GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
11949
	GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
11498
11950
11499
	/* Actually load the font. */
11951
	/* Actually load the font. */
11500
	vte_terminal_set_font(terminal, terminal->pvt->fontdesc);
11952
	vte_terminal_set_font_full(terminal, terminal->pvt->fontdesc,
11953
				   terminal->pvt->fontantialias);
11501
11954
11502
	/* Allocate colors. */
11955
	/* Allocate colors. */
11503
	for (i = 0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) {
11956
	for (i = 0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) {
Lines 11573-11585 Link Here
11573
static void
12026
static void
11574
vte_terminal_determine_colors(VteTerminal *terminal,
12027
vte_terminal_determine_colors(VteTerminal *terminal,
11575
			      const struct vte_charcell *cell,
12028
			      const struct vte_charcell *cell,
11576
			      gboolean reverse, int *fore, int *back)
12029
			      gboolean reverse,
12030
			      gboolean highlight,
12031
			      gboolean cursor,
12032
			      int *fore, int *back)
11577
{
12033
{
11578
	g_assert(fore != NULL);
12034
	g_assert(fore != NULL);
11579
	g_assert(back != NULL);
12035
	g_assert(back != NULL);
11580
12036
11581
	/* Determine what the foreground and background colors for rendering
12037
	/* Determine what the foreground and background colors for rendering
11582
	 * text should be. */
12038
	 * text should be.  If highlight is set and we have a highlight color,
12039
	 * use that scheme.  If cursor is set and we have a cursor color, use
12040
	 * that scheme.  If neither is set, and reverse is set, then use
12041
	 * reverse colors, else use the defaults.  This means that many callers
12042
	 * who specify highlight or cursor should also specify reverse. */
12043
	if (cursor && !highlight && terminal->pvt->cursor_color_set) {
12044
		*fore = cell ? cell->back : VTE_DEF_BG;
12045
		*back = VTE_CUR_BG;
12046
	} else
12047
	if (highlight && !cursor && terminal->pvt->highlight_color_set) {
12048
		*fore = cell ? cell->fore : VTE_DEF_FG;
12049
		*back = VTE_DEF_HL;
12050
	} else
11583
	if (reverse ^ ((cell != NULL) && (cell->reverse))) {
12051
	if (reverse ^ ((cell != NULL) && (cell->reverse))) {
11584
		*fore = cell ? cell->back : VTE_DEF_BG;
12052
		*fore = cell ? cell->back : VTE_DEF_BG;
11585
		*back = cell ? cell->fore : VTE_DEF_FG;
12053
		*back = cell ? cell->fore : VTE_DEF_FG;
Lines 12682-12687 Link Here
12682
	}
13150
	}
12683
}
13151
}
12684
13152
13153
/* Try to map a PangoColor to a palette entry and return its index. */
13154
static int
13155
_vte_terminal_map_pango_color(VteTerminal *terminal, PangoColor *color)
13156
{
13157
	long distance[G_N_ELEMENTS(terminal->pvt->palette)];
13158
	struct vte_palette_entry *entry;
13159
	int i, ret;
13160
13161
	/* Calculate a "distance" value.  Could stand to be improved a bit. */
13162
	for (i = 0; i < G_N_ELEMENTS(distance); i++) {
13163
		entry = &terminal->pvt->palette[i];
13164
		distance[i] = 0;
13165
		distance[i] += ((entry->red >> 8) - (color->red >> 8)) *
13166
			       ((entry->red >> 8) - (color->red >> 8));
13167
		distance[i] += ((entry->blue >> 8) - (color->blue >> 8)) *
13168
			       ((entry->blue >> 8) - (color->blue >> 8));
13169
		distance[i] += ((entry->green >> 8) - (color->green >> 8)) *
13170
			       ((entry->green >> 8) - (color->green >> 8));
13171
	}
13172
13173
	/* Find the index of the minimum value. */
13174
	ret = 0;
13175
	for (i = 1; i < G_N_ELEMENTS(distance); i++) {
13176
		if (distance[i] < distance[ret]) {
13177
			ret = i;
13178
		}
13179
	}
13180
13181
#ifdef VTE_DEBUG
13182
	if (_vte_debug_on(VTE_DEBUG_UPDATES)) {
13183
		fprintf(stderr, "mapped PangoColor(%04x,%04x,%04x) to "
13184
			"palette entry (%04x,%04x,%04x)\n",
13185
			color->red, color->green, color->blue,
13186
			terminal->pvt->palette[ret].red,
13187
			terminal->pvt->palette[ret].green,
13188
			terminal->pvt->palette[ret].blue);
13189
	}
13190
#endif
13191
13192
	return ret;
13193
}
13194
13195
/* FIXME: we don't have a way to tell GTK+ what the default text attributes
13196
 * should be, so for now at least it's assuming white-on-black is the norm and
13197
 * is using "black-on-white" to signify "inverse".  Pick up on that state and
13198
 * fix things.  Do this here, so that if we suddenly get red-on-black, we'll do
13199
 * the right thing. */
13200
static void
13201
_vte_terminal_fudge_pango_colors(VteTerminal *terminal, GSList *attributes,
13202
				 struct vte_charcell *cells, gssize n)
13203
{
13204
	gboolean saw_fg, saw_bg;
13205
	PangoAttribute *attr;
13206
	PangoAttrColor *color;
13207
	PangoColor fg, bg;
13208
	int i;
13209
13210
	saw_fg = saw_bg = FALSE;
13211
13212
	while (attributes != NULL) {
13213
		attr = attributes->data;
13214
		switch (attr->klass->type) {
13215
		case PANGO_ATTR_FOREGROUND:
13216
			saw_fg = TRUE;
13217
			color = (PangoAttrColor*) attr;
13218
			fg = color->color;
13219
			break;
13220
		case PANGO_ATTR_BACKGROUND:
13221
			saw_bg = TRUE;
13222
			color = (PangoAttrColor*) attr;
13223
			bg = color->color;
13224
			break;
13225
		default:
13226
			break;
13227
		}
13228
		attributes = g_slist_next(attributes);
13229
	}
13230
13231
	if (saw_fg && saw_bg &&
13232
	    (fg.red == 0xffff) && (fg.green == 0xffff) && (fg.blue == 0xffff) &&
13233
	    (bg.red == 0) && (bg.green == 0) && (bg.blue == 0)) {
13234
		for (i = 0; i < n; i++) {
13235
			cells[i].fore = terminal->pvt->screen->color_defaults.fore;
13236
			cells[i].back = terminal->pvt->screen->color_defaults.back;
13237
			cells[i].reverse = TRUE;
13238
		}
13239
	}
13240
}
13241
13242
/* Apply the attribute given in the PangoAttribute to the list of cells. */
13243
static void
13244
_vte_terminal_apply_pango_attr(VteTerminal *terminal, PangoAttribute *attr,
13245
			       struct vte_charcell *cells, gsize n_cells)
13246
{
13247
	int i, ival;
13248
	PangoAttrInt *attrint;
13249
	PangoAttrColor *attrcolor;
13250
13251
	switch (attr->klass->type) {
13252
	case PANGO_ATTR_FOREGROUND:
13253
	case PANGO_ATTR_BACKGROUND:
13254
		attrcolor = (PangoAttrColor*) attr;
13255
		ival = _vte_terminal_map_pango_color(terminal,
13256
						     &attrcolor->color);
13257
		for (i = attr->start_index;
13258
		     (ival >= 0) && (i < attr->end_index) && (i < n_cells);
13259
		     i++) {
13260
			if (attr->klass->type == PANGO_ATTR_FOREGROUND) {
13261
				cells[i].fore = ival;
13262
			}
13263
			if (attr->klass->type == PANGO_ATTR_BACKGROUND) {
13264
				cells[i].back = ival;
13265
			}
13266
		}
13267
		break;
13268
	case PANGO_ATTR_STRIKETHROUGH:
13269
		attrint = (PangoAttrInt*) attr;
13270
		ival = attrint->value;
13271
		for (i = attr->start_index;
13272
		     (i < attr->end_index) && (i < n_cells);
13273
		     i++) {
13274
			cells[i].strikethrough = (ival != FALSE);
13275
		}
13276
		break;
13277
	case PANGO_ATTR_UNDERLINE:
13278
		attrint = (PangoAttrInt*) attr;
13279
		ival = attrint->value;
13280
		for (i = attr->start_index;
13281
		     (i < attr->end_index) && (i < n_cells);
13282
		     i++) {
13283
			cells[i].underline = (ival != PANGO_UNDERLINE_NONE);
13284
		}
13285
		break;
13286
	case PANGO_ATTR_WEIGHT:
13287
		attrint = (PangoAttrInt*) attr;
13288
		ival = attrint->value;
13289
		for (i = attr->start_index;
13290
		     (i < attr->end_index) && (i < n_cells);
13291
		     i++) {
13292
			cells[i].bold = (ival >= PANGO_WEIGHT_BOLD);
13293
		}
13294
		break;
13295
	default:
13296
		break;
13297
	}
13298
}
13299
13300
/* Convert a PangoAttrList and a location in that list to settings in a
13301
 * charcell structure.  The cells array is assumed to contain enough items
13302
 * so that all ranges in the attribute list can be mapped into the array, which
13303
 * typically means that the cell array should have the same length as the
13304
 * string (byte-wise) which the attributes describe. */
13305
static void
13306
_vte_terminal_pango_attribute_destroy(gpointer attr, gpointer data)
13307
{
13308
	pango_attribute_destroy(attr);
13309
}
13310
static void
13311
_vte_terminal_translate_pango_cells(VteTerminal *terminal, PangoAttrList *attrs,
13312
				    struct vte_charcell *cells, gsize n_cells)
13313
{
13314
	PangoAttribute *attr;
13315
	PangoAttrIterator *attriter;
13316
	GSList *list, *listiter;
13317
	int i;
13318
13319
	for (i = 0; i < n_cells; i++) {
13320
		cells[i] = terminal->pvt->screen->fill_defaults;
13321
	}
13322
13323
	attriter = pango_attr_list_get_iterator(attrs);
13324
	if (attriter != NULL) {
13325
		do {
13326
			list = pango_attr_iterator_get_attrs(attriter);
13327
			if (list != NULL) {
13328
				for (listiter = list;
13329
				     listiter != NULL;
13330
				     listiter = g_slist_next(listiter)) {
13331
					attr = listiter->data;
13332
					_vte_terminal_apply_pango_attr(terminal,
13333
								       attr,
13334
								       cells,
13335
								       n_cells);
13336
				}
13337
				attr = list->data;
13338
				_vte_terminal_fudge_pango_colors(terminal,
13339
								 list,
13340
								 cells +
13341
								 attr->start_index,
13342
								 attr->end_index -
13343
								 attr->start_index);
13344
				g_slist_foreach(list,
13345
						_vte_terminal_pango_attribute_destroy,
13346
						NULL);
13347
				g_slist_free(list);
13348
			}
13349
		} while (pango_attr_iterator_next(attriter) == TRUE);
13350
		pango_attr_iterator_destroy(attriter);
13351
	}
13352
}
13353
13354
/* Draw the listed items using the given attributes.  Tricky because the
13355
 * attribute string is indexed by byte in the UTF-8 representation of the string
13356
 * of characters.  Because we draw a character at a time, this is slower. */
13357
static void
13358
vte_terminal_draw_cells_with_attributes(VteTerminal *terminal,
13359
					struct _vte_draw_text_request *items,
13360
					gssize n,
13361
					PangoAttrList *attrs,
13362
					gboolean draw_default_bg,
13363
					gint column_width, gint height)
13364
{
13365
	int i, j, cell_count;
13366
	struct vte_charcell *cells;
13367
	char scratch_buf[VTE_UTF8_BPC];
13368
	int fore, back;
13369
13370
	for (i = 0, cell_count = 0; i < n; i++) {
13371
		cell_count += g_unichar_to_utf8(items[i].c, scratch_buf);
13372
	}
13373
	cells = g_malloc(cell_count * sizeof(struct vte_charcell));
13374
	_vte_terminal_translate_pango_cells(terminal, attrs, cells, cell_count);
13375
	for (i = 0, j = 0; i < n; i++) {
13376
		vte_terminal_determine_colors(terminal, &cells[j],
13377
					      FALSE,
13378
					      FALSE,
13379
					      FALSE,
13380
					      &fore, &back);
13381
		vte_terminal_draw_cells(terminal, items + i, 1,
13382
					fore,
13383
					back,
13384
					draw_default_bg,
13385
					cells[j].bold,
13386
					cells[j].underline,
13387
					cells[j].strikethrough,
13388
					FALSE, FALSE, column_width, height);
13389
		j += g_unichar_to_utf8(items[i].c, scratch_buf);
13390
	}
13391
	g_free(cells);
13392
}
13393
12685
static gboolean
13394
static gboolean
12686
vte_terminal_get_blink_state(VteTerminal *terminal)
13395
vte_terminal_get_blink_state(VteTerminal *terminal)
12687
{
13396
{
Lines 12736-12742 Link Here
12736
	GArray *items;
13445
	GArray *items;
12737
	int i, j, fore, nfore, back, nback;
13446
	int i, j, fore, nfore, back, nback;
12738
	gboolean underline, nunderline, bold, nbold, hilite, nhilite, reverse,
13447
	gboolean underline, nunderline, bold, nbold, hilite, nhilite, reverse,
12739
		 strikethrough, nstrikethrough, drawn;
13448
		 selected, strikethrough, nstrikethrough, drawn;
12740
	struct _vte_draw_text_request item;
13449
	struct _vte_draw_text_request item;
12741
	struct vte_charcell *cell;
13450
	struct vte_charcell *cell;
12742
13451
Lines 12760-12768 Link Here
12760
		/* Get the character cell's contents. */
13469
		/* Get the character cell's contents. */
12761
		cell = vte_terminal_find_charcell(terminal, i, row);
13470
		cell = vte_terminal_find_charcell(terminal, i, row);
12762
		/* Find the colors for this cell. */
13471
		/* Find the colors for this cell. */
12763
		reverse = vte_cell_is_selected(terminal, i, row, NULL) ^
13472
		reverse = terminal->pvt->screen->reverse_mode;
12764
			  terminal->pvt->screen->reverse_mode;
13473
		selected = vte_cell_is_selected(terminal, i, row, NULL);
12765
		vte_terminal_determine_colors(terminal, cell, reverse,
13474
		vte_terminal_determine_colors(terminal, cell,
13475
					      reverse || selected,
13476
					      selected,
13477
					      FALSE,
12766
					      &fore, &back);
13478
					      &fore, &back);
12767
		underline = (cell != NULL) ? (cell->underline != 0) : FALSE;
13479
		underline = (cell != NULL) ? (cell->underline != 0) : FALSE;
12768
		strikethrough = (cell != NULL) ? (cell->strikethrough != 0) : FALSE;
13480
		strikethrough = (cell != NULL) ? (cell->strikethrough != 0) : FALSE;
Lines 12813-12821 Link Here
12813
			/* Resolve attributes to colors where possible and
13525
			/* Resolve attributes to colors where possible and
12814
			 * compare visual attributes to the first character
13526
			 * compare visual attributes to the first character
12815
			 * in this chunk. */
13527
			 * in this chunk. */
12816
			reverse = vte_cell_is_selected(terminal, j, row, NULL) ^
13528
			reverse = terminal->pvt->screen->reverse_mode;
12817
				  terminal->pvt->screen->reverse_mode;
13529
			selected = vte_cell_is_selected(terminal, j, row, NULL);
12818
			vte_terminal_determine_colors(terminal, cell, reverse,
13530
			vte_terminal_determine_colors(terminal, cell,
13531
						      reverse || selected,
13532
						      selected,
13533
						      FALSE,
12819
						      &nfore, &nback);
13534
						      &nfore, &nback);
12820
			if ((nfore != fore) || (nback != back)) {
13535
			if ((nfore != fore) || (nback != back)) {
12821
				break;
13536
				break;
Lines 12904-12913 Link Here
12904
	struct _vte_draw_text_request item, *items;
13619
	struct _vte_draw_text_request item, *items;
12905
	int row, drow, col, row_stop, col_stop, columns;
13620
	int row, drow, col, row_stop, col_stop, columns;
12906
	char *preedit;
13621
	char *preedit;
13622
	int preedit_cursor;
12907
	long width, height, ascent, descent, delta, cursor_width;
13623
	long width, height, ascent, descent, delta, cursor_width;
12908
	int i, len, fore, back, x, y;
13624
	int i, len, fore, back, x, y;
12909
	GdkRectangle all_area;
13625
	GdkRectangle all_area;
12910
	gboolean blink;
13626
	gboolean blink, selected;
12911
13627
12912
#ifdef VTE_DEBUG
13628
#ifdef VTE_DEBUG
12913
	if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
13629
	if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
Lines 13014-13022 Link Here
13014
								    cell->columns));
13730
								    cell->columns));
13015
		}
13731
		}
13016
		if (GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(terminal))) {
13732
		if (GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(terminal))) {
13733
			selected = vte_cell_is_selected(terminal, col, drow,
13734
							NULL);
13017
			blink = vte_terminal_get_blink_state(terminal) ^
13735
			blink = vte_terminal_get_blink_state(terminal) ^
13018
				terminal->pvt->screen->reverse_mode;
13736
				terminal->pvt->screen->reverse_mode;
13019
			vte_terminal_determine_colors(terminal, cell, blink,
13737
			vte_terminal_determine_colors(terminal, cell,
13738
						      blink,
13739
						      selected,
13740
						      blink,
13020
						      &fore, &back);
13741
						      &fore, &back);
13021
			_vte_draw_clear(terminal->pvt->draw,
13742
			_vte_draw_clear(terminal->pvt->draw,
13022
					col * width + VTE_PAD_WIDTH,
13743
					col * width + VTE_PAD_WIDTH,
Lines 13060-13066 Link Here
13060
		} else {
13781
		} else {
13061
			GdkColor color;
13782
			GdkColor color;
13062
			/* Draw it as a hollow rectangle. */
13783
			/* Draw it as a hollow rectangle. */
13063
			vte_terminal_determine_colors(terminal, cell, FALSE,
13784
			vte_terminal_determine_colors(terminal, cell,
13785
						      FALSE,
13786
						      FALSE,
13787
						      FALSE,
13064
						      &fore, &back);
13788
						      &fore, &back);
13065
			_vte_draw_clear(terminal->pvt->draw,
13789
			_vte_draw_clear(terminal->pvt->draw,
13066
					col * width + VTE_PAD_WIDTH,
13790
					col * width + VTE_PAD_WIDTH,
Lines 13095-13100 Link Here
13095
13819
13096
		/* Find out how many columns the pre-edit string takes up. */
13820
		/* Find out how many columns the pre-edit string takes up. */
13097
		preedit = terminal->pvt->im_preedit;
13821
		preedit = terminal->pvt->im_preedit;
13822
		preedit_cursor = -1;
13098
		columns = vte_terminal_preedit_width(terminal, FALSE);
13823
		columns = vte_terminal_preedit_width(terminal, FALSE);
13099
		len = vte_terminal_preedit_length(terminal, FALSE);
13824
		len = vte_terminal_preedit_length(terminal, FALSE);
13100
13825
Lines 13111-13116 Link Here
13111
					 (len + 1));
13836
					 (len + 1));
13112
			preedit = terminal->pvt->im_preedit;
13837
			preedit = terminal->pvt->im_preedit;
13113
			for (i = columns = 0; i < len; i++) {
13838
			for (i = columns = 0; i < len; i++) {
13839
				if ((preedit - terminal->pvt->im_preedit) ==
13840
				    terminal->pvt->im_preedit_cursor) {
13841
					preedit_cursor = i;
13842
				}
13114
				items[i].c = g_utf8_get_char(preedit);
13843
				items[i].c = g_utf8_get_char(preedit);
13115
				items[i].columns = _vte_iso2022_unichar_width(items[i].c);
13844
				items[i].columns = _vte_iso2022_unichar_width(items[i].c);
13116
				items[i].x = (col + columns) * width;
13845
				items[i].x = (col + columns) * width;
Lines 13118-13123 Link Here
13118
				columns += items[i].columns;
13847
				columns += items[i].columns;
13119
				preedit = g_utf8_next_char(preedit);
13848
				preedit = g_utf8_next_char(preedit);
13120
			}
13849
			}
13850
			if ((preedit - terminal->pvt->im_preedit) ==
13851
			    terminal->pvt->im_preedit_cursor) {
13852
				preedit_cursor = i;
13853
			}
13121
			items[len].c = ' ';
13854
			items[len].c = ' ';
13122
			items[len].columns = 1;
13855
			items[len].columns = 1;
13123
			items[len].x = (col + columns) * width;
13856
			items[len].x = (col + columns) * width;
Lines 13129-13145 Link Here
13129
					height);
13862
					height);
13130
			fore = screen->defaults.fore;
13863
			fore = screen->defaults.fore;
13131
			back = screen->defaults.back;
13864
			back = screen->defaults.back;
13132
			vte_terminal_draw_cells(terminal,
13865
			vte_terminal_draw_cells_with_attributes(terminal,
13133
						items, len + 1,
13866
								items, len + 1,
13134
						fore, back, TRUE,
13867
								terminal->pvt->im_preedit_attrs,
13135
						FALSE,
13868
								TRUE,
13136
						FALSE,
13869
								width, height);
13137
						FALSE,
13870
			if ((preedit_cursor >= 0) && (preedit_cursor < len)) {
13138
						FALSE,
13139
						TRUE,
13140
						width, height);
13141
			if ((terminal->pvt->im_preedit_cursor >= 0) &&
13142
			    (terminal->pvt->im_preedit_cursor < len)) {
13143
				/* Cursored letter in reverse. */
13871
				/* Cursored letter in reverse. */
13144
				vte_terminal_draw_cells(terminal,
13872
				vte_terminal_draw_cells(terminal,
13145
							&items[terminal->pvt->im_preedit_cursor], 1,
13873
							&items[terminal->pvt->im_preedit_cursor], 1,
Lines 13151-13157 Link Here
13151
							TRUE,
13879
							TRUE,
13152
							width, height);
13880
							width, height);
13153
			} else
13881
			} else
13154
			if (terminal->pvt->im_preedit_cursor == len) {
13882
			if (preedit_cursor == len) {
13155
				/* Empty cursor at the end. */
13883
				/* Empty cursor at the end. */
13156
				vte_terminal_draw_cells(terminal,
13884
				vte_terminal_draw_cells(terminal,
13157
							&items[len], 1,
13885
							&items[len], 1,
Lines 13315-13320 Link Here
13315
#endif
14043
#endif
13316
14044
13317
	bindtextdomain(PACKAGE, LOCALEDIR);
14045
	bindtextdomain(PACKAGE, LOCALEDIR);
14046
#ifdef HAVE_DECL_BIND_TEXTDOMAIN_CODESET
14047
	bind_textdomain_codeset(PACKAGE, "UTF-8");
14048
#endif
13318
14049
13319
	gobject_class = G_OBJECT_CLASS(klass);
14050
	gobject_class = G_OBJECT_CLASS(klass);
13320
	widget_class = GTK_WIDGET_CLASS(klass);
14051
	widget_class = GTK_WIDGET_CLASS(klass);
Lines 13338-13349 Link Here
13338
	widget_class->get_accessible = vte_terminal_get_accessible;
14069
	widget_class->get_accessible = vte_terminal_get_accessible;
13339
	widget_class->show = vte_terminal_show;
14070
	widget_class->show = vte_terminal_show;
13340
14071
14072
	/* Initialize default handlers. */
14073
	klass->eof = NULL;
14074
	klass->child_exited = NULL;
14075
	klass->emulation_changed = NULL;
14076
	klass->encoding_changed = NULL;
14077
	klass->char_size_changed = NULL;
14078
	klass->window_title_changed = NULL;
14079
	klass->icon_title_changed = NULL;
14080
	klass->selection_changed = NULL;
14081
	klass->contents_changed = NULL;
14082
	klass->cursor_moved = NULL;
14083
	klass->status_line_changed = NULL;
14084
	klass->commit = NULL;
14085
14086
	klass->deiconify_window = NULL;
14087
	klass->iconify_window = NULL;
14088
	klass->raise_window = NULL;
14089
	klass->lower_window = NULL;
14090
	klass->refresh_window = NULL;
14091
	klass->restore_window = NULL;
14092
	klass->maximize_window = NULL;
14093
	klass->resize_window = NULL;
14094
	klass->move_window = NULL;
14095
14096
	klass->increase_font_size = NULL;
14097
	klass->decrease_font_size = NULL;
14098
14099
	klass->text_modified = NULL;
14100
	klass->text_inserted = NULL;
14101
	klass->text_deleted = NULL;
14102
	klass->text_scrolled = NULL;
14103
13341
	/* Register some signals of our own. */
14104
	/* Register some signals of our own. */
13342
	klass->eof_signal =
14105
	klass->eof_signal =
13343
		g_signal_new("eof",
14106
		g_signal_new("eof",
13344
			     G_OBJECT_CLASS_TYPE(klass),
14107
			     G_OBJECT_CLASS_TYPE(klass),
13345
			     G_SIGNAL_RUN_LAST,
14108
			     G_SIGNAL_RUN_LAST,
13346
			     0,
14109
			     G_STRUCT_OFFSET(VteTerminalClass, eof),
13347
			     NULL,
14110
			     NULL,
13348
			     NULL,
14111
			     NULL,
13349
			     _vte_marshal_VOID__VOID,
14112
			     _vte_marshal_VOID__VOID,
Lines 13352-13358 Link Here
13352
		g_signal_new("child-exited",
14115
		g_signal_new("child-exited",
13353
			     G_OBJECT_CLASS_TYPE(klass),
14116
			     G_OBJECT_CLASS_TYPE(klass),
13354
			     G_SIGNAL_RUN_LAST,
14117
			     G_SIGNAL_RUN_LAST,
13355
			     0,
14118
			     G_STRUCT_OFFSET(VteTerminalClass, child_exited),
13356
			     NULL,
14119
			     NULL,
13357
			     NULL,
14120
			     NULL,
13358
			     _vte_marshal_VOID__VOID,
14121
			     _vte_marshal_VOID__VOID,
Lines 13361-13367 Link Here
13361
		g_signal_new("window-title-changed",
14124
		g_signal_new("window-title-changed",
13362
			     G_OBJECT_CLASS_TYPE(klass),
14125
			     G_OBJECT_CLASS_TYPE(klass),
13363
			     G_SIGNAL_RUN_LAST,
14126
			     G_SIGNAL_RUN_LAST,
13364
			     0,
14127
			     G_STRUCT_OFFSET(VteTerminalClass, window_title_changed),
13365
			     NULL,
14128
			     NULL,
13366
			     NULL,
14129
			     NULL,
13367
			     _vte_marshal_VOID__VOID,
14130
			     _vte_marshal_VOID__VOID,
Lines 13370-13376 Link Here
13370
		g_signal_new("icon-title-changed",
14133
		g_signal_new("icon-title-changed",
13371
			     G_OBJECT_CLASS_TYPE(klass),
14134
			     G_OBJECT_CLASS_TYPE(klass),
13372
			     G_SIGNAL_RUN_LAST,
14135
			     G_SIGNAL_RUN_LAST,
13373
			     0,
14136
			     G_STRUCT_OFFSET(VteTerminalClass, icon_title_changed),
13374
			     NULL,
14137
			     NULL,
13375
			     NULL,
14138
			     NULL,
13376
			     _vte_marshal_VOID__VOID,
14139
			     _vte_marshal_VOID__VOID,
Lines 13379-13385 Link Here
13379
		g_signal_new("encoding-changed",
14142
		g_signal_new("encoding-changed",
13380
			     G_OBJECT_CLASS_TYPE(klass),
14143
			     G_OBJECT_CLASS_TYPE(klass),
13381
			     G_SIGNAL_RUN_LAST,
14144
			     G_SIGNAL_RUN_LAST,
13382
			     0,
14145
			     G_STRUCT_OFFSET(VteTerminalClass, encoding_changed),
13383
			     NULL,
14146
			     NULL,
13384
			     NULL,
14147
			     NULL,
13385
			     _vte_marshal_VOID__VOID,
14148
			     _vte_marshal_VOID__VOID,
Lines 13388-13394 Link Here
13388
		g_signal_new("commit",
14151
		g_signal_new("commit",
13389
			     G_OBJECT_CLASS_TYPE(klass),
14152
			     G_OBJECT_CLASS_TYPE(klass),
13390
			     G_SIGNAL_RUN_LAST,
14153
			     G_SIGNAL_RUN_LAST,
13391
			     0,
14154
			     G_STRUCT_OFFSET(VteTerminalClass, commit),
13392
			     NULL,
14155
			     NULL,
13393
			     NULL,
14156
			     NULL,
13394
			     _vte_marshal_VOID__STRING_UINT,
14157
			     _vte_marshal_VOID__STRING_UINT,
Lines 13397-13403 Link Here
13397
		g_signal_new("emulation-changed",
14160
		g_signal_new("emulation-changed",
13398
			     G_OBJECT_CLASS_TYPE(klass),
14161
			     G_OBJECT_CLASS_TYPE(klass),
13399
			     G_SIGNAL_RUN_LAST,
14162
			     G_SIGNAL_RUN_LAST,
13400
			     0,
14163
			     G_STRUCT_OFFSET(VteTerminalClass, emulation_changed),
13401
			     NULL,
14164
			     NULL,
13402
			     NULL,
14165
			     NULL,
13403
			     _vte_marshal_VOID__VOID,
14166
			     _vte_marshal_VOID__VOID,
Lines 13406-13412 Link Here
13406
		g_signal_new("char-size-changed",
14169
		g_signal_new("char-size-changed",
13407
			     G_OBJECT_CLASS_TYPE(klass),
14170
			     G_OBJECT_CLASS_TYPE(klass),
13408
			     G_SIGNAL_RUN_LAST,
14171
			     G_SIGNAL_RUN_LAST,
13409
			     0,
14172
			     G_STRUCT_OFFSET(VteTerminalClass, char_size_changed),
13410
			     NULL,
14173
			     NULL,
13411
			     NULL,
14174
			     NULL,
13412
			     _vte_marshal_VOID__UINT_UINT,
14175
			     _vte_marshal_VOID__UINT_UINT,
Lines 13415-13421 Link Here
13415
		g_signal_new ("selection-changed",
14178
		g_signal_new ("selection-changed",
13416
			      G_OBJECT_CLASS_TYPE(klass),
14179
			      G_OBJECT_CLASS_TYPE(klass),
13417
			      G_SIGNAL_RUN_LAST,
14180
			      G_SIGNAL_RUN_LAST,
13418
			      0,
14181
			      G_STRUCT_OFFSET(VteTerminalClass, selection_changed),
13419
			      NULL,
14182
			      NULL,
13420
			      NULL,
14183
			      NULL,
13421
			      _vte_marshal_VOID__VOID,
14184
			      _vte_marshal_VOID__VOID,
Lines 13424-13430 Link Here
13424
		g_signal_new("contents-changed",
14187
		g_signal_new("contents-changed",
13425
			     G_OBJECT_CLASS_TYPE(klass),
14188
			     G_OBJECT_CLASS_TYPE(klass),
13426
			     G_SIGNAL_RUN_LAST,
14189
			     G_SIGNAL_RUN_LAST,
13427
			     0,
14190
			     G_STRUCT_OFFSET(VteTerminalClass, contents_changed),
13428
			     NULL,
14191
			     NULL,
13429
			     NULL,
14192
			     NULL,
13430
			     _vte_marshal_VOID__VOID,
14193
			     _vte_marshal_VOID__VOID,
Lines 13433-13439 Link Here
13433
		g_signal_new("cursor-moved",
14196
		g_signal_new("cursor-moved",
13434
			     G_OBJECT_CLASS_TYPE(klass),
14197
			     G_OBJECT_CLASS_TYPE(klass),
13435
			     G_SIGNAL_RUN_LAST,
14198
			     G_SIGNAL_RUN_LAST,
13436
			     0,
14199
			     G_STRUCT_OFFSET(VteTerminalClass, cursor_moved),
13437
			     NULL,
14200
			     NULL,
13438
			     NULL,
14201
			     NULL,
13439
			     _vte_marshal_VOID__VOID,
14202
			     _vte_marshal_VOID__VOID,
Lines 13442-13448 Link Here
13442
		g_signal_new("deiconify-window",
14205
		g_signal_new("deiconify-window",
13443
			     G_OBJECT_CLASS_TYPE(klass),
14206
			     G_OBJECT_CLASS_TYPE(klass),
13444
			     G_SIGNAL_RUN_LAST,
14207
			     G_SIGNAL_RUN_LAST,
13445
			     0,
14208
			     G_STRUCT_OFFSET(VteTerminalClass, deiconify_window),
13446
			     NULL,
14209
			     NULL,
13447
			     NULL,
14210
			     NULL,
13448
			     _vte_marshal_VOID__VOID,
14211
			     _vte_marshal_VOID__VOID,
Lines 13451-13457 Link Here
13451
		g_signal_new("iconify-window",
14214
		g_signal_new("iconify-window",
13452
			     G_OBJECT_CLASS_TYPE(klass),
14215
			     G_OBJECT_CLASS_TYPE(klass),
13453
			     G_SIGNAL_RUN_LAST,
14216
			     G_SIGNAL_RUN_LAST,
13454
			     0,
14217
			     G_STRUCT_OFFSET(VteTerminalClass, iconify_window),
13455
			     NULL,
14218
			     NULL,
13456
			     NULL,
14219
			     NULL,
13457
			     _vte_marshal_VOID__VOID,
14220
			     _vte_marshal_VOID__VOID,
Lines 13460-13466 Link Here
13460
		g_signal_new("raise-window",
14223
		g_signal_new("raise-window",
13461
			     G_OBJECT_CLASS_TYPE(klass),
14224
			     G_OBJECT_CLASS_TYPE(klass),
13462
			     G_SIGNAL_RUN_LAST,
14225
			     G_SIGNAL_RUN_LAST,
13463
			     0,
14226
			     G_STRUCT_OFFSET(VteTerminalClass, raise_window),
13464
			     NULL,
14227
			     NULL,
13465
			     NULL,
14228
			     NULL,
13466
			     _vte_marshal_VOID__VOID,
14229
			     _vte_marshal_VOID__VOID,
Lines 13469-13475 Link Here
13469
		g_signal_new("lower-window",
14232
		g_signal_new("lower-window",
13470
			     G_OBJECT_CLASS_TYPE(klass),
14233
			     G_OBJECT_CLASS_TYPE(klass),
13471
			     G_SIGNAL_RUN_LAST,
14234
			     G_SIGNAL_RUN_LAST,
13472
			     0,
14235
			     G_STRUCT_OFFSET(VteTerminalClass, lower_window),
13473
			     NULL,
14236
			     NULL,
13474
			     NULL,
14237
			     NULL,
13475
			     _vte_marshal_VOID__VOID,
14238
			     _vte_marshal_VOID__VOID,
Lines 13478-13484 Link Here
13478
		g_signal_new("refresh-window",
14241
		g_signal_new("refresh-window",
13479
			     G_OBJECT_CLASS_TYPE(klass),
14242
			     G_OBJECT_CLASS_TYPE(klass),
13480
			     G_SIGNAL_RUN_LAST,
14243
			     G_SIGNAL_RUN_LAST,
13481
			     0,
14244
			     G_STRUCT_OFFSET(VteTerminalClass, refresh_window),
13482
			     NULL,
14245
			     NULL,
13483
			     NULL,
14246
			     NULL,
13484
			     _vte_marshal_VOID__VOID,
14247
			     _vte_marshal_VOID__VOID,
Lines 13487-13493 Link Here
13487
		g_signal_new("restore-window",
14250
		g_signal_new("restore-window",
13488
			     G_OBJECT_CLASS_TYPE(klass),
14251
			     G_OBJECT_CLASS_TYPE(klass),
13489
			     G_SIGNAL_RUN_LAST,
14252
			     G_SIGNAL_RUN_LAST,
13490
			     0,
14253
			     G_STRUCT_OFFSET(VteTerminalClass, restore_window),
13491
			     NULL,
14254
			     NULL,
13492
			     NULL,
14255
			     NULL,
13493
			     _vte_marshal_VOID__VOID,
14256
			     _vte_marshal_VOID__VOID,
Lines 13496-13502 Link Here
13496
		g_signal_new("maximize-window",
14259
		g_signal_new("maximize-window",
13497
			     G_OBJECT_CLASS_TYPE(klass),
14260
			     G_OBJECT_CLASS_TYPE(klass),
13498
			     G_SIGNAL_RUN_LAST,
14261
			     G_SIGNAL_RUN_LAST,
13499
			     0,
14262
			     G_STRUCT_OFFSET(VteTerminalClass, maximize_window),
13500
			     NULL,
14263
			     NULL,
13501
			     NULL,
14264
			     NULL,
13502
			     _vte_marshal_VOID__VOID,
14265
			     _vte_marshal_VOID__VOID,
Lines 13505-13511 Link Here
13505
		g_signal_new("resize-window",
14268
		g_signal_new("resize-window",
13506
			     G_OBJECT_CLASS_TYPE(klass),
14269
			     G_OBJECT_CLASS_TYPE(klass),
13507
			     G_SIGNAL_RUN_LAST,
14270
			     G_SIGNAL_RUN_LAST,
13508
			     0,
14271
			     G_STRUCT_OFFSET(VteTerminalClass, resize_window),
13509
			     NULL,
14272
			     NULL,
13510
			     NULL,
14273
			     NULL,
13511
			     _vte_marshal_VOID__UINT_UINT,
14274
			     _vte_marshal_VOID__UINT_UINT,
Lines 13514-13520 Link Here
13514
		g_signal_new("move-window",
14277
		g_signal_new("move-window",
13515
			     G_OBJECT_CLASS_TYPE(klass),
14278
			     G_OBJECT_CLASS_TYPE(klass),
13516
			     G_SIGNAL_RUN_LAST,
14279
			     G_SIGNAL_RUN_LAST,
13517
			     0,
14280
			     G_STRUCT_OFFSET(VteTerminalClass, move_window),
13518
			     NULL,
14281
			     NULL,
13519
			     NULL,
14282
			     NULL,
13520
			     _vte_marshal_VOID__UINT_UINT,
14283
			     _vte_marshal_VOID__UINT_UINT,
Lines 13523-13529 Link Here
13523
		g_signal_new("status-line-changed",
14286
		g_signal_new("status-line-changed",
13524
			     G_OBJECT_CLASS_TYPE(klass),
14287
			     G_OBJECT_CLASS_TYPE(klass),
13525
			     G_SIGNAL_RUN_LAST,
14288
			     G_SIGNAL_RUN_LAST,
13526
			     0,
14289
			     G_STRUCT_OFFSET(VteTerminalClass, status_line_changed),
13527
			     NULL,
14290
			     NULL,
13528
			     NULL,
14291
			     NULL,
13529
			     _vte_marshal_VOID__VOID,
14292
			     _vte_marshal_VOID__VOID,
Lines 13532-13538 Link Here
13532
		g_signal_new("increase-font-size",
14295
		g_signal_new("increase-font-size",
13533
			     G_OBJECT_CLASS_TYPE(klass),
14296
			     G_OBJECT_CLASS_TYPE(klass),
13534
			     G_SIGNAL_RUN_LAST,
14297
			     G_SIGNAL_RUN_LAST,
13535
			     0,
14298
			     G_STRUCT_OFFSET(VteTerminalClass, increase_font_size),
13536
			     NULL,
14299
			     NULL,
13537
			     NULL,
14300
			     NULL,
13538
			     _vte_marshal_VOID__VOID,
14301
			     _vte_marshal_VOID__VOID,
Lines 13541-13547 Link Here
13541
		g_signal_new("decrease-font-size",
14304
		g_signal_new("decrease-font-size",
13542
			     G_OBJECT_CLASS_TYPE(klass),
14305
			     G_OBJECT_CLASS_TYPE(klass),
13543
			     G_SIGNAL_RUN_LAST,
14306
			     G_SIGNAL_RUN_LAST,
13544
			     0,
14307
			     G_STRUCT_OFFSET(VteTerminalClass, decrease_font_size),
13545
			     NULL,
14308
			     NULL,
13546
			     NULL,
14309
			     NULL,
13547
			     _vte_marshal_VOID__VOID,
14310
			     _vte_marshal_VOID__VOID,
Lines 13550-13556 Link Here
13550
		g_signal_new("text-modified",
14313
		g_signal_new("text-modified",
13551
			     G_OBJECT_CLASS_TYPE(klass),
14314
			     G_OBJECT_CLASS_TYPE(klass),
13552
			     G_SIGNAL_RUN_LAST,
14315
			     G_SIGNAL_RUN_LAST,
13553
			     0,
14316
			     G_STRUCT_OFFSET(VteTerminalClass, text_modified),
13554
			     NULL,
14317
			     NULL,
13555
			     NULL,
14318
			     NULL,
13556
			     _vte_marshal_VOID__VOID,
14319
			     _vte_marshal_VOID__VOID,
Lines 13559-13565 Link Here
13559
		g_signal_new("text-inserted",
14322
		g_signal_new("text-inserted",
13560
			     G_OBJECT_CLASS_TYPE(klass),
14323
			     G_OBJECT_CLASS_TYPE(klass),
13561
			     G_SIGNAL_RUN_LAST,
14324
			     G_SIGNAL_RUN_LAST,
13562
			     0,
14325
			     G_STRUCT_OFFSET(VteTerminalClass, text_inserted),
13563
			     NULL,
14326
			     NULL,
13564
			     NULL,
14327
			     NULL,
13565
			     _vte_marshal_VOID__VOID,
14328
			     _vte_marshal_VOID__VOID,
Lines 13568-13574 Link Here
13568
		g_signal_new("text-deleted",
14331
		g_signal_new("text-deleted",
13569
			     G_OBJECT_CLASS_TYPE(klass),
14332
			     G_OBJECT_CLASS_TYPE(klass),
13570
			     G_SIGNAL_RUN_LAST,
14333
			     G_SIGNAL_RUN_LAST,
13571
			     0,
14334
			     G_STRUCT_OFFSET(VteTerminalClass, text_deleted),
13572
			     NULL,
14335
			     NULL,
13573
			     NULL,
14336
			     NULL,
13574
			     _vte_marshal_VOID__VOID,
14337
			     _vte_marshal_VOID__VOID,
Lines 13577-13583 Link Here
13577
		g_signal_new("text-scrolled",
14340
		g_signal_new("text-scrolled",
13578
			     G_OBJECT_CLASS_TYPE(klass),
14341
			     G_OBJECT_CLASS_TYPE(klass),
13579
			     G_SIGNAL_RUN_LAST,
14342
			     G_SIGNAL_RUN_LAST,
13580
			     0,
14343
			     G_STRUCT_OFFSET(VteTerminalClass, text_scrolled),
13581
			     NULL,
14344
			     NULL,
13582
			     NULL,
14345
			     NULL,
13583
			     _vte_marshal_VOID__INT,
14346
			     _vte_marshal_VOID__INT,
Lines 13613-13618 Link Here
13613
}
14376
}
13614
14377
13615
GtkType
14378
GtkType
14379
vte_terminal_anti_alias_get_type(void)
14380
{
14381
	static GtkType terminal_anti_alias_type = 0;
14382
	static GEnumValue values[] = {
14383
		{VTE_ANTI_ALIAS_USE_DEFAULT, "VTE_ANTI_ALIAS_USE_DEFAULT", "use-default"},
14384
		{VTE_ANTI_ALIAS_FORCE_ENABLE, "VTE_ANTI_ALIAS_FORCE_ENABLE", "force-enable"},
14385
		{VTE_ANTI_ALIAS_FORCE_DISABLE, "VTE_ANTI_ALIAS_FORCE_DISABLE", "force-disable"},
14386
	};
14387
	if (terminal_anti_alias_type == 0) {
14388
		terminal_anti_alias_type =
14389
			g_enum_register_static("VteTerminalAntiAlias",
14390
					       values);
14391
	}
14392
	return terminal_anti_alias_type;
14393
}
14394
14395
GtkType
13616
vte_terminal_get_type(void)
14396
vte_terminal_get_type(void)
13617
{
14397
{
13618
	static GtkType terminal_type = 0;
14398
	static GtkType terminal_type = 0;
Lines 14331-14337 Link Here
14331
 * characters can be specified by separating them with a hyphen.
15111
 * characters can be specified by separating them with a hyphen.
14332
 *
15112
 *
14333
 * As a special case, if @spec is NULL or the empty string, the terminal will
15113
 * As a special case, if @spec is NULL or the empty string, the terminal will
14334
 * treat all graphic non-punctuation characters as word characters.
15114
 * treat all graphic non-punctuation non-space characters as word characters.
14335
 */
15115
 */
14336
void
15116
void
14337
vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
15117
vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)

Return to bug 48728