diff -Nru vte2.91-0.52.2/aclocal.m4 vte2.91-0.54.0/aclocal.m4 --- vte2.91-0.52.2/aclocal.m4 2018-05-21 19:32:15.000000000 +0000 +++ vte2.91-0.54.0/aclocal.m4 2018-09-02 13:20:44.000000000 +0000 @@ -20,44 +20,6 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_REQUIRE_DEFINED(MACRO) -# -# DESCRIPTION -# -# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have -# been defined and thus are available for use. This avoids random issues -# where a macro isn't expanded. Instead the configure script emits a -# non-fatal: -# -# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found -# -# It's like AC_REQUIRE except it doesn't expand the required macro. -# -# Here's an example: -# -# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) -# -# LICENSE -# -# Copyright (c) 2014 Mike Frysinger -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_REQUIRE_DEFINED], [dnl - m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) -])dnl AX_REQUIRE_DEFINED - # Copyright (C) 1995-2002 Free Software Foundation, Inc. # Copyright (C) 2001-2003,2004 Red Hat, Inc. # diff -Nru vte2.91-0.52.2/AUTHORS vte2.91-0.54.0/AUTHORS --- vte2.91-0.52.2/AUTHORS 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/AUTHORS 2018-09-02 13:20:15.000000000 +0000 @@ -1 +1 @@ -Nalin Dahyabhai +Use the git history to get the list of authors and committers. diff -Nru vte2.91-0.52.2/bindings/gir/Makefile.in vte2.91-0.54.0/bindings/gir/Makefile.in --- vte2.91-0.52.2/bindings/gir/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/bindings/gir/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -222,7 +222,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/bindings/Makefile.in vte2.91-0.54.0/bindings/Makefile.in --- vte2.91-0.52.2/bindings/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/bindings/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -254,7 +254,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/bindings/vala/Makefile.in vte2.91-0.54.0/bindings/vala/Makefile.in --- vte2.91-0.52.2/bindings/vala/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/bindings/vala/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -280,7 +280,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/ChangeLog vte2.91-0.54.0/ChangeLog --- vte2.91-0.52.2/ChangeLog 2018-05-21 19:36:43.000000000 +0000 +++ vte2.91-0.54.0/ChangeLog 2018-09-02 13:25:11.000000000 +0000 @@ -1,73 +1,2528 @@ -commit 7322c27fee05bb6dd10289d05b79f53ac386799f +commit 2b7729bab7ba1faa05be0c5b480c0a33f3e360aa +Author: Christian Persch +Date: Sun Sep 2 11:37:04 2018 +0200 + + Version 0.54.0 + + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit bc2f1b390a6fc0ea6913833bf7919500f5c96e35 +Author: Christian Persch +Date: Sun Sep 2 11:29:19 2018 +0200 + + utf8: Don't swallow start bytes in the middle of a sequence + + https://gitlab.gnome.org/GNOME/vte/issues/30 + + src/Makefile.am | 19 ++- + src/parser-cat.cc | 11 ++ + src/utf8-test.cc | 349 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/utf8.hh | 4 + + src/vte.cc | 12 ++ + 5 files changed, 394 insertions(+), 1 deletion(-) + +commit 57c3a07947f301d0363e9449b089da800a7e08d7 +Author: Christian Persch +Date: Sat Sep 1 19:28:40 2018 +0200 + + widget: Avoid invalidation from unrealize + + On unrealize, reset the IM preedit data without causing + an invalidation, which would access data already destroyed. + + https://gitlab.gnome.org/GNOME/vte/issues/29 + + src/vte.cc | 28 +++++++++++++++------------- + src/vteinternal.hh | 1 + + src/widget.cc | 2 +- + 3 files changed, 17 insertions(+), 14 deletions(-) + +commit bd74d0dda1287e137a84d9ed49b45e789685980b +Author: Ask Hjorth Larsen +Date: Sat Sep 1 18:46:10 2018 +0200 + + Updated Danish translation + + po/da.po | 37 ++++++++++++++++--------------------- + 1 file changed, 16 insertions(+), 21 deletions(-) + +commit 390eb885cbbde69e44c1b2138011b6f5163c3a0f +Author: Rūdolfs Mazurs +Date: Fri Aug 31 18:07:08 2018 +0000 + + Update Latvian translation + + po/lv.po | 33 ++++++++++++++++----------------- + 1 file changed, 16 insertions(+), 17 deletions(-) + +commit e12f34cd0820ac4c5e38ee803ed5447f5af45c20 +Author: Balázs Meskó +Date: Fri Aug 31 10:56:58 2018 +0000 + + Update Hungarian translation + + po/hu.po | 36 +++++++++++++++++------------------- + 1 file changed, 17 insertions(+), 19 deletions(-) + +commit efdd7400c0dc59e2252d4aa054a70b94c1632861 +Author: Fran Dieguez +Date: Wed Aug 29 22:35:26 2018 +0000 + + Update Galician translation + + po/gl.po | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit 9abfa272447ad2bbbd87c45e3c13ebe8b4e9eaff +Author: Fran Dieguez +Date: Wed Aug 29 22:29:44 2018 +0000 + + Update Galician translation + + po/gl.po | 35 ++++++++++++++++++----------------- + 1 file changed, 18 insertions(+), 17 deletions(-) + +commit 8a70b7c1c86e587ca5b163118a61f80b1d3cfc49 +Author: Christian Persch +Date: Mon Aug 27 22:42:00 2018 +0200 + + emulation: Fix off-by-one in TSR + + https://gitlab.gnome.org/GNOME/vte/issues/28 + + src/vteseq.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit cb34c788658c8df42859c25b64606c67609b8d24 +Author: Milo Casagrande +Date: Mon Aug 27 08:04:21 2018 +0000 + + Update Italian translation + + po/it.po | 36 +++++++++++++++++------------------- + 1 file changed, 17 insertions(+), 19 deletions(-) + +commit b7b0721af583a5794ce0208017a95ce085159217 +Author: Christian Persch +Date: Sun Aug 26 10:14:50 2018 +0200 + + Version 0.53.92 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f5e863516c2c393d387a19c20cf28d74afa1835d +Author: Christian Persch +Date: Sun Aug 26 10:14:50 2018 +0200 + + emulation: Be more strict in DECRQSS + + Reject the whole sequence if there are extraneous characters + in the string. + + src/vteseq.cc | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +commit 1880afb994ab2cab152b49b703bf02801bef29a8 +Author: Changwoo Ryu +Date: Sun Aug 26 03:59:46 2018 +0000 + + Update Korean translation + + po/ko.po | 70 +++++++++++++--------------------------------------------------- + 1 file changed, 14 insertions(+), 56 deletions(-) + +commit cf5c9560467b69fd2430e798716f0480e0a53e61 +Author: Baurzhan Muftakhidinov +Date: Sat Aug 25 17:39:33 2018 +0000 + + Update Kazakh translation + + po/kk.po | 36 ++++++++++++++++-------------------- + 1 file changed, 16 insertions(+), 20 deletions(-) + +commit 0f6fe003af3a4db5b285b25a14dd7e958cb5af7c +Author: Christian Persch +Date: Fri Aug 24 10:55:05 2018 +0200 + + emulation: Clarify a comment + + src/vteseq.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit 01b5020b163c10112e3da0fb197e208a12bfe84b +Author: Christian Persch +Date: Fri Aug 24 10:55:05 2018 +0200 + + parser: Fix sort order + + src/parser-csi.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 19e85103b9415cc7eabbf5afd7e698c211747d17 +Author: Christian Persch +Date: Fri Aug 24 10:55:05 2018 +0200 + + doap: Fix email address + + vte.doap | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 417b9958a135ca1cb3ccf6252d3ce0dbcf7ded35 +Author: Christian Persch +Date: Mon Aug 20 22:47:46 2018 +0200 + + emulation: Add sequence and no-op handler for new xterm SGR functions + + https://gitlab.gnome.org/GNOME/vte/issues/23 + + src/parser-cmd.hh | 3 +++ + src/parser-csi.hh | 3 +++ + src/parser-reply.hh | 1 + + src/vteseq.cc | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 80 insertions(+) + +commit 6211878c55d262fa28e463edf44c33961dc9f8d6 +Author: Christian Persch +Date: Mon Aug 20 22:47:46 2018 +0200 + + emulation: Add sequence and no-op handler for synchronous update + + https://gitlab.gnome.org/GNOME/vte/issues/15 + + src/parser-cmd.hh | 1 + + src/parser-dcs.hh | 1 + + src/vteseq.cc | 26 ++++++++++++++++++++++++++ + 3 files changed, 28 insertions(+) + +commit 4bdcd7a345e215400819ccf6140b912cf0b31ac9 +Author: Christian Persch +Date: Mon Aug 20 22:47:46 2018 +0200 + + widget: Add nullable annotations + + Add nullable annotations to functions returning a char* that may + be nullptr. (vte_terminal_get_window_title() actually doesn't ever + return nullptr in 0.53 but may have before, and it may do so again, + so add the annoation on it, too.) + + https://gitlab.gnome.org/GNOME/vte/issues/21 + + src/vtegtk.cc | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +commit 3a36e1da3dae7f54f3bfbfbf085a584ac654890d +Author: Christian Persch +Date: Mon Aug 20 22:47:46 2018 +0200 + + widget: Always return non-null from vte_terminal_get_encoding + + Terminal recently changed to storing nullptr instead of "UTF-8". + Make the public accessor continue to return "UTF-8" instead. + + src/vtegtk.cc | 2 +- + src/widget.hh | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +commit 0276859709692ec53f35a8cc158d7553a195c730 +Author: Christian Persch +Date: Mon Aug 20 22:47:46 2018 +0200 + + widget: Always emit the child-exited signal + + When there is still a child process running when the + VteTerminal is destroyed, it gets kill()ed, but since + the child-exited signal was only emitted from the + VteReaper callback, it was never actually emitted, since + by that time VteTerminal has ceased to exist. + + Instead of waiting for the reaper, immediately emit + the child-exited signal in VteTerminal::dispose(). The + exit status is synthesised to be WIFSIGNALED() with + WTERMSIG() == SIGKILL. + + https://gitlab.gnome.org/GNOME/gnome-terminal/issues/16 + + src/app/app.cc | 8 +++++- + src/vte.cc | 79 +++++++++++++++++++++++++++--------------------------- + src/vtegtk.cc | 13 +++++++++ + src/vteinternal.hh | 7 ++--- + src/widget.cc | 19 +++++++++++++ + src/widget.hh | 4 +++ + 6 files changed, 86 insertions(+), 44 deletions(-) + +commit cc5904f9ffcc0bbf13a312d7577966d42ff6fb43 +Author: Christian Persch +Date: Fri Aug 17 21:05:45 2018 +0200 + + emulation: Fix SRM mode documentation + + https://gitlab.gnome.org/GNOME/vte/issues/22 + + src/modes-ecma.hh | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +commit 1d2001c4a2bcc4d637a61dbf7595f8ac48c7618b +Author: Christian Persch +Date: Fri Aug 17 20:51:35 2018 +0200 + + parser: cat: Handle SCI instead of asserting + + src/parser-cat.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit c1dbc12b27b3f2e2de524ca596a9e71a6d98c934 +Author: Jiri Grönroos +Date: Fri Aug 17 18:04:23 2018 +0000 + + Update Finnish translation + + po/fi.po | 38 +++++++++++++++++--------------------- + 1 file changed, 17 insertions(+), 21 deletions(-) + +commit b2316ab8f9655e36a07f73682f695866fd333cba +Author: Ricardo Silva Veloso +Date: Thu Aug 16 20:14:30 2018 +0000 + + Update Brazilian Portuguese translation + + po/pt_BR.po | 37 ++++++++++++++++++------------------- + 1 file changed, 18 insertions(+), 19 deletions(-) + +commit ad010150bfd97fe92382de7bff3eccde575e64e5 +Author: Efstathios Iosifidis +Date: Wed Aug 15 11:14:31 2018 +0000 + + Update Greek translation + + po/el.po | 36 +++++++++++++++++------------------- + 1 file changed, 17 insertions(+), 19 deletions(-) + +commit e2fcd488c874d3306a57ad9a86799d0a1023908a +Author: Christian Persch +Date: Sun Aug 12 23:48:15 2018 +0200 + + widget: Add nullable annotations for functions that can return nullptr + + https://gitlab.gnome.org/GNOME/vte/issues/21 + + src/vtegtk.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 8f74ce70d96a63df7074cb8bc163a35f42f430d6 +Author: Aurimas Černius +Date: Sat Aug 11 18:20:08 2018 +0300 + + Updated Lithuanian translation + + po/lt.po | 31 +++++++++++++++---------------- + 1 file changed, 15 insertions(+), 16 deletions(-) + +commit 21e79fd3642809bf626b52dc2a67af33a6711115 +Author: Christian Persch +Date: Thu Aug 9 21:56:22 2018 +0200 + + emulation: Clamp cursor column + + When setting/unsetting tab stops, make sure to clamp the cursor + column to 0..m_column_count-1. This is necessary because vte's + weird autowrap handling where it puts the cursor on column + m_column_count if there's a wrap pending, instead of keeping + the cursor at the right margin and using a flag, like every other + terminal emulator does. + + Fixes a crash when setting/unsetting a tabstop while the cursor + is in that pending autowrap state. + + src/vteinternal.hh | 8 ++++++-- + src/vteseq.cc | 23 +++++++++++------------ + 2 files changed, 17 insertions(+), 14 deletions(-) + +commit b83970ba3869f55c2758f1362753bb4e2f5fe792 +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + parser: Make reset directly change the state + + Distinguish this from CAN. + + src/parser.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit b934f1bfa0ec4c5c16beffd4045a4a4156e3f568 +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + parser: glue: Add accessor for the introducer character + + src/parser-glue.hh | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +commit 97d9376bd176d665efa125fe40f07a815654959f +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + parser: glue: Minor comment edit + + src/parser-glue.hh | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +commit 983b70d0d491760508fb83fc7766e2e85df814fc +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + emulation: Fix DECRQSS reply + + While the VT525 documentation says that a valid reply returns 0 and + and invalid one 1, the STD 070 documentation actually has that inversed, + and xterm also follows that. Since this seems to just be a documentation + bug, and following xterm makes this more useful, change vte to match + this. + + src/vteseq.cc | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +commit 5c12cd6f84357b08bf849278fa531256382da911 +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + build: Version bump + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit bd732ae1468e64ea58f9e29dae6f0f4328d4d28d +Author: Christian Persch +Date: Thu Aug 9 19:26:14 2018 +0200 + + emulation: Fix DECDSR 6 reply + + DECXPR starts with '?'. + + src/parser-reply.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 5ecf957d95546a3eccd2620390bc11ef920d2373 +Author: Egmont Koblinger +Date: Mon Jul 30 12:54:03 2018 +0200 + + widget: Avoid unnecessary invalidations on mouseover + + Works around (or at least reduces the incidence of) + https://gitlab.gnome.org/GNOME/vte/issues/4 + + src/vte.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 1c56c6342414c53ce285e2a57c1e5aac0a35a804 +Author: Igor Zakharov +Date: Mon Jul 30 12:48:12 2018 +0200 + + build: Fix "cast between incompatible function types" warning + + https://gitlab.gnome.org/GNOME/vte/issues/16 + + src/vte.cc | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +commit f5748452ffb69635b0127bae6b0817bfa1e2c6cb +Author: Tim Sabsch +Date: Fri Jul 27 12:48:39 2018 +0000 + + Update German translation + + po/de.po | 35 +++++++++++++++++------------------ + 1 file changed, 17 insertions(+), 18 deletions(-) + +commit 4331c2748109c9c2b1ba3b0a393cc8ccdfee88fd +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + lib: Add API to enable test mode + + Add API to set the test flags, instead of using an env variable + for this. + + src/app/app.cc | 4 +--- + src/vte.cc | 4 ++-- + src/vte/vteglobals.h | 6 ++++++ + src/vtegtk.cc | 25 ++++++++++++++++++------- + src/vteinternal.hh | 4 +++- + src/vteseq.cc | 2 +- + 6 files changed, 31 insertions(+), 14 deletions(-) + +commit f20a7ccd9cc8fc3bd0f73aa14969231376421c80 +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + widget: Move bell to Widget + + src/vte.cc | 8 ++------ + src/vtegtk.cc | 3 ++- + src/widget.cc | 7 +++++++ + src/widget.hh | 2 ++ + 4 files changed, 13 insertions(+), 7 deletions(-) + +commit 1eee87d2bf1a005f4abc072c8bfa32daa0a12cbb +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + widget: Move GtkSettings change handling to Widget + + src/vte.cc | 54 +++--------------------------------------------------- + src/vteinternal.hh | 5 +++-- + src/widget.cc | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/widget.hh | 4 +++- + 4 files changed, 63 insertions(+), 54 deletions(-) + +commit 69dfd0c37b361adc3d51af6234081989fef9e7d6 +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + widget: Move IM context to Widget + + src/vte.cc | 145 ++++++----------------------------------------------- + src/vtegtk.cc | 4 ++ + src/vteinternal.hh | 10 ++-- + src/widget.cc | 125 ++++++++++++++++++++++++++++++++++++++++++++- + src/widget.hh | 19 +++++++ + 5 files changed, 167 insertions(+), 136 deletions(-) + +commit 9f9b31f8833a3bd3300657e2355b684225621b7b +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + widget: Move event window handling to Widget + + src/vte.cc | 103 ++++++++------------------------------------- + src/vtegtk.cc | 4 +- + src/vteinternal.hh | 23 ++++------ + src/widget.cc | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++-- + src/widget.hh | 62 ++++++++++++++++++++++----- + 5 files changed, 198 insertions(+), 115 deletions(-) + +commit c76874b8d54729df7d998ed776265c8a013cb157 +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + widget: Start separating widget from terminal + + src/Makefile.am | 2 ++ + src/vtegtk.cc | 103 ++++++++++++++++++++++++++++++----------------------- + src/vteinternal.hh | 3 +- + src/widget.cc | 46 ++++++++++++++++++++++++ + src/widget.hh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 202 insertions(+), 46 deletions(-) + +commit 8e0c94b22e17f46053ac9d9332514a23991ab44a +Author: Christian Persch +Date: Tue Jul 24 21:01:15 2018 +0200 + + lib: Rename VteTerminalPrivate + + src/vte.cc | 710 +++++++++++++++++++++++++------------------------ + src/vte/vteterminal.h | 2 +- + src/vtegtk.cc | 10 +- + src/vteinternal.hh | 18 +- + src/vteseq.cc | 724 +++++++++++++++++++++++++------------------------- + 5 files changed, 742 insertions(+), 722 deletions(-) + +commit 935723cad1c324b0769f17f6c2c78083f22ea439 +Author: Matej Urbančič +Date: Wed Jul 11 21:30:23 2018 +0200 + + Added Slovenian translation + + po/sl.po | 38 ++++++++++++++++++-------------------- + 1 file changed, 18 insertions(+), 20 deletions(-) + +commit eb85292b3ef44ac95d3863af68b19f6a8d8131e2 +Author: Christian Persch +Date: Wed Jul 11 21:21:15 2018 +0200 + + widget: Add accessor for the background colour + + https://gitlab.gnome.org/GNOME/vte/issues/9 + + doc/reference/vte-docs.xml | 4 ++++ + doc/reference/vte-sections.txt | 1 + + src/app/app.cc | 17 +++++++++-------- + src/vte/vteterminal.h | 3 +++ + src/vtegtk.cc | 33 +++++++++++++++++++++++++++++++++ + 5 files changed, 50 insertions(+), 8 deletions(-) + +commit 0cb4e79077b2f40ea0ace71c9c18163d40cd9f84 +Author: Christian Persch +Date: Wed Jul 11 21:21:15 2018 +0200 + + lib: debug: Hexdump incoming and outgoing buffers + + Add hexdump of incoming (pre- and post-conversion) and outgoing + buffers. + + src/debug.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ + src/debug.h | 6 +++++- + src/vte.cc | 21 ++++++++++++--------- + 3 files changed, 61 insertions(+), 10 deletions(-) + +commit 297b44b765f8c19ebb5f4c0b600b5015338bb90e +Author: Emin Tufan Çetin +Date: Sat Jul 7 07:33:31 2018 +0000 + + Update Turkish translation + + po/tr.po | 33 +++++++++++++++++---------------- + 1 file changed, 17 insertions(+), 16 deletions(-) + +commit 65d67f6f814df4f4ab800898bb7f4b1bc9f135b0 +Author: Debarshi Ray +Date: Fri Jun 22 13:19:56 2018 +0200 + + widget: Fix race between polling the master & using the PTY in a child + + When a very short-lived process, like true(1), is spawned + asynchronously as a child, there is a race between the child closing + the pseudo-terminal's slave device on exit and VteTerminal receiving + it, and the GAsyncReadyCallback passed to vte_pty_spawn_async being + invoked. If the child closes it and the G_IO_HUP is received before the + callback is invoked, then it causes VterTerminal to unset its VtePty + object, which leads to the following CRITICAL when the callback tries + to set up a watch on the child: + Vte-CRITICAL **: void vte_terminal_watch_child(VteTerminal*, GPid): + assertion 'impl->m_pty != NULL' failed + + The race can be avoided by setting up the GIOChannel to poll the + pseudo-terminal master device only after the callback has been + invoked. If the kernel has already buffered up some activity on the + slave device, then that will be seen in the next iteration of the main + loop, and the VtePty won't be unset before setting up the watch. + + There is a similar race for downstreams that continue to use + gnome-pty-helper. In those cases, the helper is in charge of creating + the pseudo-terminal device pair, and it closes its copies of the file + descriptors after sending them to VteTerminal. If VteTerminal starts + polling the master device immediately after receiving it from the + helper, before the child process has been forked, and the helper loses + the race to close its copy of the slave device's file descriptor + before the master is polled, then VteTerminal will receive a G_IO_HUP + and stop reading further input from the master. The subsequently forked + child process gets left in a defunct state and the same CRITICAL is + logged. + + This also makes vte_terminal_spawn_async match its synchronous variant, + which is nice. + + Fixes GNOME/vte#7: + https://gitlab.gnome.org/GNOME/vte/issues/7 + + src/vtegtk.cc | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 2f2dc9dce0b2ff1d606cc6ddb43393748cdce7f4 +Author: Kukuh Syafaat +Date: Sat Jun 23 03:56:49 2018 +0000 + + Update Indonesian translation + + po/id.po | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +commit a88f8c27542203ee2cbb7f000aa1b760828486ef +Author: Cédric Valmary +Date: Fri Jun 22 06:59:55 2018 +0000 + + Update Occitan translation + + po/oc.po | 33 ++++++++++++++++----------------- + 1 file changed, 16 insertions(+), 17 deletions(-) + +commit 48bfd731fcaabd2a04b8e3ae29afed0d7ed8a5f0 +Author: Piotr Drąg +Date: Wed Jun 20 22:18:58 2018 +0200 + + Update POTFILES.in + + po/POTFILES.in | 1 - + 1 file changed, 1 deletion(-) + +commit 79d84d680527ff04e1d14f76c2f4a7768e10e703 +Author: Christian Persch +Date: Wed Jun 20 21:20:19 2018 +0200 + + lib: Make legacy charset support optional + + configure.ac | 15 +++++++++++++++ + src/vte.cc | 30 ++++++++++++++++++++++++++---- + src/vteinternal.hh | 13 ++++++++----- + 3 files changed, 49 insertions(+), 9 deletions(-) + +commit 82591edee0ce62cc9911434fbef22952f5fb7d17 +Author: Christian Persch +Date: Wed Jun 20 21:20:19 2018 +0200 + + conv: Remove vteconv.{h,cc} + + Move the only function into vte.cc where there are only 2 callers. + + src/Makefile.am | 2 -- + src/vte.cc | 68 +++++++++++++++++++++++++++++++++++++- + src/vteconv.cc | 96 ------------------------------------------------------ + src/vteconv.h | 35 -------------------- + src/vteinternal.hh | 1 - + 5 files changed, 67 insertions(+), 135 deletions(-) + +commit e8f57c242ad6ebfd2abf104e5800e30071a2b222 +Author: Christian Persch +Date: Wed Jun 20 21:20:19 2018 +0200 + + conv: Remove _vte_conv_reset + + There is only caller and the body is a one-liner, so just + put it into the caller. + + src/vte.cc | 6 ++++-- + src/vteconv.cc | 9 --------- + src/vteconv.h | 1 - + 3 files changed, 4 insertions(+), 12 deletions(-) + +commit d82c807a4c00d84c6804493658ff7043ccfae077 +Author: Christian Persch +Date: Wed Jun 20 21:20:19 2018 +0200 + + conv: Remove _vte_conv_open + + Just call g_iconv_open() directly, and lose the //TRANSLIT. + If transliteration is desired, the caller should use + it in the passed encoding string. + + src/vte.cc | 4 ++-- + src/vteconv.cc | 15 +-------------- + src/vteconv.h | 1 - + 3 files changed, 3 insertions(+), 17 deletions(-) + +commit b3b02f643dc4b052d494c3e278e62b47cd793bff +Author: Christian Persch +Date: Wed Jun 20 21:20:19 2018 +0200 + + conv: Remove extra wrapper struct + + VteConv was reduced to only contain a sole GIConv member, + so remove the VteConv struct and use GIConv directly. + + src/vte.cc | 34 +++++++++++++++++----------------- + src/vteconv.cc | 53 +++++++++-------------------------------------------- + src/vteconv.h | 12 +++--------- + src/vteinternal.hh | 4 ++-- + 4 files changed, 31 insertions(+), 72 deletions(-) + +commit d93ea3ec95ecdc468f921bf424926337203eb4c3 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + conv: Remove iso2022.{h,cc} + + Move the remaining, legacy charset conversion code, directly + to vte.cc. + + src/Makefile.am | 2 - + src/iso2022.cc | 193 ----------------------------------------------------- + src/iso2022.h | 42 ------------ + src/vte.cc | 121 +++++++++++++++++++++++---------- + src/vteconv.cc | 22 ++++-- + src/vteconv.h | 5 +- + src/vteinternal.hh | 4 +- + 7 files changed, 107 insertions(+), 282 deletions(-) + +commit 9d0c2e55727097941f3e474f79a54a7ee73ce925 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + conv: Remove UTF-8-to-UTF-8 conversion + + It's unused now. + + src/Makefile.am | 7 - + src/vteconv.cc | 417 +++----------------------------------------------------- + 2 files changed, 21 insertions(+), 403 deletions(-) + +commit 53228783239e9a822c4821498c18caa43d27e951 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + lib: Remove extraneous UTF-8-to-UTF-8 conversion on output + + Only do conversion for legacy encodings; normally + the outgoing data is already in UTF-8 and need not + be converted to itself. + + src/iso2022.cc | 12 ++- + src/vte.cc | 256 ++++++++++++++++++++++++++++----------------------------- + src/vteconv.cc | 2 + + 3 files changed, 141 insertions(+), 129 deletions(-) + +commit 3910a229d14eaee85952e78a681f06cafa4a6213 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + conv: Remove conversion to unichar + + It's unused now. + + src/vteconv.cc | 65 ++++------------------------------------------------------ + src/vteconv.h | 4 ---- + 2 files changed, 4 insertions(+), 65 deletions(-) + +commit 582e2d0848946d1458050a0d0fdb81d22e8c53fe +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + conv: test: Fix test + + src/vteconv.cc | 140 --------------------------------------------------------- + 1 file changed, 140 deletions(-) + +commit a22695724f513324495ca4e775dc4917c91f0b76 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + lib: Remove double conversion for legacy encodings + + Directly convert to UTF-8 instead of going first to UTF-32 + then back to UTF-8. + + src/iso2022.cc | 68 +++++++++++++++++++++---------------------------------- + src/iso2022.h | 4 ++-- + src/vte.cc | 22 ++++-------------- + src/vtedefines.hh | 2 +- + 4 files changed, 34 insertions(+), 62 deletions(-) + +commit dad52a5b2c739842756fb647e7656c09c3ee3bc6 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + parser: cat: Remove legacy encoding support + + src/Makefile.am | 4 --- + src/parser-cat.cc | 93 ++----------------------------------------------------- + 2 files changed, 3 insertions(+), 94 deletions(-) + +commit 3ac8b26212324592806b7def1b35b299cf357efa +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + lib: Make legacy encodings work again + + https://gitlab.gnome.org/GNOME/vte/issues/3 + + src/buffer.h | 1 + + src/vte.cc | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + src/vteinternal.hh | 4 ++- + 3 files changed, 77 insertions(+), 2 deletions(-) + +commit 9774b87e2f0ff1ae48ce666c0698c062875cba22 +Author: Christian Persch +Date: Wed Jun 20 20:39:55 2018 +0200 + + conv: Remove unused code + + Source is never UTF-32. + + src/vteconv.cc | 73 ++++++++-------------------------------------------------- + 1 file changed, 9 insertions(+), 64 deletions(-) + +commit a13b07d346b280592510e7ee6af05bc602197691 +Author: Debarshi Ray +Date: Tue Jun 19 18:28:25 2018 +0200 + + parser: Fix the build with GCC 8.1.1 + + Otherwise it fails with: + + vteseq.cc:47:1: error: declaration of + 'void vte::parser::Sequence::print() const' has a different + exception specifier + vte::parser::Sequence::print() const + ^~~ + In file included from vteinternal.hh:30, + from vteseq.cc:34: + parser-glue.hh:83:14: note: from previous declaration + 'void vte::parser::Sequence::print() const noexcept' + void print() const noexcept; + ^~~~~ + + ... and so on. + + Fixes GNOME/vte#5: + https://gitlab.gnome.org/GNOME/vte/issues/5 + + src/vteseq.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 05c1c6dd46835580091a2750b19b05a1866a0d66 +Author: Daniel Șerbănescu +Date: Sun Jun 17 19:29:19 2018 +0000 + + Update Romanian translation + + po/ro.po | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +commit a17e714d01ea403450d1920347eb04cd3e6afa5b +Author: Christian Persch +Date: Sun Jun 17 19:48:49 2018 +0200 + + widget: Deprecate vte_terminal_[sg]et_encoding() + + https://gitlab.gnome.org/GNOME/vte/issues/3 + + doc/reference/vte-sections.txt | 4 ++-- + src/vte/vtedeprecated.h | 11 +++++++++++ + src/vte/vteterminal.h | 8 -------- + src/vtegtk.cc | 43 +++++++++++++++++++++++++++--------------- + 4 files changed, 41 insertions(+), 25 deletions(-) + +commit 263aa005a5864d74c9d14bce2ecc1c4e95a01646 +Author: Christian Persch +Date: Sat Jun 16 20:51:58 2018 +0200 + + lib: Remove unused defines + + src/vtedefines.hh | 8 -------- + 1 file changed, 8 deletions(-) + +commit 7cd6819682dae4bcb167e26c40712d36644e5fba +Author: Christian Persch +Date: Sat Jun 16 20:51:58 2018 +0200 + + lib: Use branchless, streaming UTF-8 converter + + Previously vte used to convert the whole chunk of input from + the PTY into UTF-32 in one go, and feed that to the parser. + Replace this with a streaming converter, which consumes the + bytes one-by-one and feeds the result to the parser whenever + a unicode character falls out of it. + + Also simplify the chunk handling by using C++ standard classes + to manage the queue (and stack of reserve chunks) instead + of a hand-grown list handling code. + + As a result of the converter change, vte currently doesn't work + with non-UTF-8 I/O encoding. This will either be reimplemented + or non-UTF-8 support will be dropped completely (to be discussed + in bugzilla). + + The change fixes a bug in parser-cat (and potentially also in vte + itself, haven't been able to check) where occasionally a + character at the end (or start?) of a chunk was discarded. That can + be observed by comparing the output of 'parser-cat --charset "UTF-8"' + (old converter) vs just parser-cat (new converter). + + src/Makefile.am | 6 + + src/chunk.cc | 65 ++++++ + src/chunk.hh | 80 +++++++ + src/parser-cat.cc | 90 +++++++- + src/utf8.cc | 47 ++++ + src/utf8.hh | 79 +++++++ + src/vte.cc | 620 ++++++++++++++++++++--------------------------------- + src/vtedefines.hh | 1 - + src/vteinternal.hh | 26 +-- + 9 files changed, 601 insertions(+), 413 deletions(-) + +commit 5edc2dba692e8132c6f8190f4477330918a83789 +Author: Christian Persch +Date: Sat Jun 16 20:51:58 2018 +0200 + + conv: Remove unused functions + + src/vteconv.cc | 20 -------------------- + src/vteconv.h | 6 ------ + 2 files changed, 26 deletions(-) + +commit a167d8b52697a44dc4db39e5bd7a0768b896dcb4 +Author: Christian Persch +Date: Sat Jun 16 20:51:58 2018 +0200 + + doap: Cleanup + + vte.doap | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit fdf194112384e76fc80a9e9ba98f4da170e5b155 +Author: Yi-Jyun Pan +Date: Wed Jun 13 13:35:42 2018 +0000 + + Update Chinese (Taiwan) translation + + po/zh_TW.po | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +commit 079683ed10ea1b817bfaf71935523fd17f5f0a53 +Author: Charles Monzat +Date: Thu May 31 09:34:13 2018 +0000 + + Update French translation + + po/fr.po | 32 ++++++++++++++++++-------------- + 1 file changed, 18 insertions(+), 14 deletions(-) + +commit cfc3fedb046141ae74c4a39a9cbbd1ebb2e81a72 +Author: Mingcong Bai +Date: Mon May 28 09:46:41 2018 +0000 + + Update Chinese (China) translation + + po/zh_CN.po | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +commit b1753f33bdb2929cab2f91b738cca4f758571b25 +Author: Piotr Drąg +Date: Sun May 27 07:49:25 2018 +0200 + + Update Polish translation + + po/pl.po | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +commit 6cf37ab6dd22f4f3027f56ed87c7c0e0304fe91f +Author: Fabio Tomat +Date: Sat May 26 09:00:44 2018 +0000 + + Update Friulian translation + + po/fur.po | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +commit d8b485cb6b82729ac6c6c810e9c33f7adcc4f525 +Author: Christian Persch +Date: Wed May 23 22:41:11 2018 +0200 + + app: Dim terminal when toplevel has backdrop + + https://bugzilla.gnome.org/show_bug.cgi?id=758368 + + src/app/app.cc | 35 ++++++++++++++++++++++++++++++++++- + 1 file changed, 34 insertions(+), 1 deletion(-) + +commit c0b50d05eb5d0a8fe070a1ecadfb53c486e9ae30 +Author: Anders Jonsson +Date: Wed May 23 20:40:40 2018 +0000 + + Update Swedish translation + + po/sv.po | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +commit 0cd931c15ebaec0e7f34148e2588a2a251f7766f +Author: Marek Cernocky +Date: Tue May 22 13:55:07 2018 +0200 + + Updated Czech translation + + po/cs.po | 64 ++++++++++++---------------------------------------------------- + 1 file changed, 12 insertions(+), 52 deletions(-) + +commit 14d6d348d2a466a6fdfd3cb4b8207325a8e8eed2 +Author: Daniel Mustieles +Date: Tue May 22 13:07:24 2018 +0200 + + Updated Spanish translation + + po/es.po | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +commit 2ad88cd2eb74a42da30b65f963e222c7e9ec65bd +Author: Christian Persch +Date: Mon May 21 20:54:52 2018 +0200 + + Post release version bump + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 961927a8115c82f35deafe09c1d68689ff069905 Author: Christian Persch Date: Mon May 21 20:37:54 2018 +0200 - all: Fix spelling + all: Fix spelling + + https://bugzilla.gnome.org/show_bug.cgi?id=795278 + + configure.ac | 8 ++++---- + src/vte.cc | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +commit d7df8276158dd448cf6813fb1039e7b5c464a1c2 +Author: Egmont Koblinger +Date: Sun May 13 15:27:17 2018 +0200 + + ring: Proper boundary checking for hyperlink position + + This fixes a rare crash around hyperlinks in a non grid aligned + VTE widget when the mouse enters the extra padding at the bottom. + + https://bugzilla.gnome.org/show_bug.cgi?id=795826 + + src/ring.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit fd1956fb96e229d4176cc118274f325696f46e8e +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + parser: Update copyright notice + + src/parser.hh | 1 + + 1 file changed, 1 insertion(+) + +commit 8b72b407f01055a7780d5b6e48c4e6fd15502e66 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + widget: Use RefPtr for the cursors + + src/vte.cc | 22 +++++++++------------- + src/vteinternal.hh | 9 +++++---- + 2 files changed, 14 insertions(+), 17 deletions(-) + +commit d282b59690df3edf164274a082792d4b1a87bae6 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + lib: Add RefPtr type for holding a GObject + + src/Makefile.am | 19 +++++++- + src/refptr-test.cc | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/refptr.hh | 38 +++++++++++++++ + src/vteinternal.hh | 1 + + src/vtetypes.hh | 1 + + 5 files changed, 193 insertions(+), 1 deletion(-) + +commit 71a3550e5372b6636fc276dab1f48fd9418179d4 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + widget: Deprecate vte_terminal_match_set_cursor_type + + GdkCursorType is gone from gtk4, so deprecate its use here + also on gtk3 already. + + doc/reference/vte-sections.txt | 2 +- + src/vte/vtedeprecated.h | 6 ++++++ + src/vte/vteterminal.h | 4 ---- + src/vtegtk.cc | 4 +++- + 4 files changed, 10 insertions(+), 6 deletions(-) + +commit 12b024c83830147434c3daa5011d7f251843ed67 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + lib: Store preedit string in a string + + Avoid manual memory management. + + src/vte.cc | 57 ++++++++++++++++++++++++------------------------------ + src/vteinternal.hh | 2 +- + 2 files changed, 26 insertions(+), 33 deletions(-) + +commit 38daca643c2aedf0606fde5ec9dce23b501566ce +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + lib: Store word char exceptions in a string + + Avoid manual memory management. + + src/vte.cc | 69 ++++++++++++++++++++---------------------------------- + src/vtegtk.cc | 3 ++- + src/vteinternal.hh | 8 +++---- + 3 files changed, 30 insertions(+), 50 deletions(-) + +commit 33a64ff18ea36e2c946678a60ff013f17763ae69 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + ring: Replace some assertions with static_assert + + src/cell.hh | 8 ++++---- + src/vterowdata.hh | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +commit 20c47ad8f28b7b25c4cc8f4839d0d7ce632bb45e +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + ring: Split cell and rowdata headers + + doc/reference/Makefile.am | 1 + + src/Makefile.am | 1 + + src/cell.hh | 187 ++++++++++++++++++++++++++++++++++++++++++++++ + src/vterowdata.hh | 159 +-------------------------------------- + 4 files changed, 190 insertions(+), 158 deletions(-) + +commit 9da1685123387d5c59e455dd5fb278e97514e9ed +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + cxx: ring: Move to C++ + + Straight port; improvements will come later. + + src/ring.cc | 1038 +++++++++++++++++++++++++--------------------------- + src/ring.hh | 253 ++++++++++--- + src/vte.cc | 27 +- + src/vteinternal.hh | 27 +- + src/vterowdata.cc | 8 +- + src/vterowdata.hh | 9 - + 6 files changed, 726 insertions(+), 636 deletions(-) + +commit 838150fbdc2ffff1b18e739d1deb19d9bef00afc +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + ring: Add some static assertions + + Just to make sure nothing breaks during refactoring. + + src/vterowdata.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +commit c3755f9a9dcc8a41b1bf9a90e11f0f69ca768d98 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + ring: Move some types to ring.cc + + These types are only used internally by the ring and only in + this one file, so there is no need to put them into the header. + + src/ring.cc | 5 +++++ + src/ring.hh | 6 ------ + src/vte.cc | 1 + + 3 files changed, 6 insertions(+), 6 deletions(-) + +commit 728684cd7db14960ba8cc9aa631163dea1c512c2 +Author: Christian Persch +Date: Mon Apr 23 20:51:18 2018 +0200 + + cxx: Move some headers to .hh + + doc/reference/Makefile.am | 4 ++-- + src/Makefile.am | 4 ++-- + src/ring.cc | 2 +- + src/{ring.h => ring.hh} | 7 ++----- + src/vte.cc | 3 +-- + src/vteinternal.hh | 2 +- + src/vterowdata.cc | 2 +- + src/{vterowdata.h => vterowdata.hh} | 5 +---- + 8 files changed, 11 insertions(+), 18 deletions(-) + +commit dff76fa217f8c6e1909e46e715416f01c0df397e +Author: Christian Persch +Date: Sat Apr 14 23:49:27 2018 +0200 + + parser: glue: StringTokeniser must not be used with a temporary + + StringTokeniser requires the string to be kept alive + while iterating over its tokens. + + https://bugzilla.gnome.org/show_bug.cgi?id=795269 + + src/parser-glue.hh | 2 +- + src/vteseq.cc | 5 +++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +commit 691db2070ead5894947c7db7c87568aa494fbcfd +Author: Christian Persch +Date: Mon Apr 9 10:55:04 2018 +0200 + + lib: Filter out BS and DEL from paste + + https://bugzilla.gnome.org/show_bug.cgi?id=794653 + + src/vte.cc | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +commit 88239d9fca8365397bd1f069eabf24bc74de95d3 +Author: Christian Persch +Date: Fri Apr 6 10:01:08 2018 +0200 + + parser: Fix warning with GCC < 7 + + The -Wimplicit-fallthrough option is a GCC 7 addition, + so don't try ignoring it on GCC < 7. + + src/parser-glue.hh | 2 ++ + 1 file changed, 2 insertions(+) + +commit 346ada29f448ade931ee1febeda5218433c76970 +Author: Debarshi Ray +Date: Tue Apr 3 12:07:59 2018 +0200 + + parser: Ignore -Wimplicit-fallthrough + + https://bugzilla.gnome.org/show_bug.cgi?id=789778 + + src/parser-glue.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit b54395869c408656f31493a25f9e9fe89cd56bb7 +Author: Debarshi Ray +Date: Fri Mar 9 19:51:03 2018 +0100 + + widget: Remove GdkVisibilityState handling + + GtkWidget::visibility-notify-event doesn't work on modern composited + windowing systems. In such cases one can only assume that the widget + is always completely visible (ie. GDK_VISIBILITY_UNOBSCURED). + + These days most users have a compositor, and therefore bugs in this + optimization often manage to survive undetected. + + https://bugzilla.gnome.org/show_bug.cgi?id=794214 + + src/vte.cc | 53 +---------------------------------------------------- + src/vtegtk.cc | 9 --------- + src/vteinternal.hh | 4 ---- + 3 files changed, 1 insertion(+), 65 deletions(-) + +commit 513220cd80272947ccdcb6b13d7b48ba9bd1d601 +Author: Debarshi Ray +Date: Wed Mar 14 12:36:38 2018 +0100 + + ring: Silence -Wunsafe-loop-optimizations + + https://bugzilla.gnome.org/show_bug.cgi?id=789778 + + src/ring.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 43cd3d176264656956febf4f6f29c120e5c73df9 +Author: Christian Persch +Date: Sat Mar 31 22:22:12 2018 +0200 + + all: Cleanup some cruft + + AUTHORS | 2 +- + HACKING | 11 --------- + Makefile.am | 1 - + README | 10 --------- + configure.ac | 1 - + doc/Makefile.am | 3 +-- + doc/openi18n/Makefile.am | 7 ------ + doc/openi18n/UTF-8.txt | 18 --------------- + doc/openi18n/cursor.c | 57 ----------------------------------------------- + doc/openi18n/wrap.txt | 1 - + doc/readme.txt | 10 --------- + doc/vttest.tar.gz | Bin 100593 -> 0 bytes + src/Makefile.am | 2 +- + src/iso2022.txt | 15 ------------- + 14 files changed, 3 insertions(+), 135 deletions(-) + +commit 073a5600c11025660893a6558ae7db7bc9ecf874 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + build: Update macros from autoconf-archive + + m4/ax_cxx_compile_stdcxx.m4 | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +commit 8c8ac7c7b0e65525a11f5ccb8eb570639672d017 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Remove excessive clearing of sequence fields + + seq.command is set when the sequence is executed, + seq.terminator is set when the final character is received, + and seq.introducer is set when the introducer is received, + and all this happens before the sequence is dispatched. + + Therefore these fiedls need not be cleared in any case. + + src/parser.cc | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +commit ac5a03b0246ffdf3aa986c6254f5736a26eec246 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Only clear the intermediates and params when necessary + + The intermediates need only be cleared when entering ESCAPE, + CSI or DCS sequence states, and the params only be cleared for + CSI and DCS sequence states, since in all other sequence types, + there are no intermediates/parameters, and thus handlers must + not access these fields. + + src/parser-glue.hh | 16 ++++++++------ + src/parser.cc | 61 ++++++++++++++++++++++++++++++++++++------------------ + 2 files changed, 51 insertions(+), 26 deletions(-) + +commit 64db63956b9e3a1861f593d4249897880db9964a +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: No need to clear the charset + + seq.charset is only allowed to be accessed if the command + is GnDm, GnDMm, CnD or DOCS; so there is no need to clear + this field for all other commands and sequence types. + + src/parser.cc | 6 ------ + 1 file changed, 6 deletions(-) + +commit f7d39f6d130a871b14eaea2ec42e29823346f5a3 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: No need to clear for GRAPHIC sequence + + On GRAPHIC, the only field allowed to access are the type, + command, and final character; so there's no need to clear + the other data. + + src/parser.cc | 2 -- + 1 file changed, 2 deletions(-) + +commit 0c2f5bb95d8feda694f2d73dc3a741af9119af82 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: No need to clear for IGNORE sequence + + On IGNORE, the only field allowed to access are the type, + command, and final character; so there's no need to clear + the other data. + + src/parser.cc | 2 -- + 1 file changed, 2 deletions(-) + +commit 50457ebadacfc2cf503d210052e1604f55f28614 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + docs: Update list of ignored files + + doc/reference/Makefile.am | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +commit e934d70d8bcf61a0e0e518caa8da40c52c79fd1c +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Increase maximum number of parameters + + 16 parameters is a bit tight for SGR, considering we allow + specifying 3 colours ([345]8:2:id:r:g:b), each taking 6 + parameters, and then other attributes too, in the same call. + + Increase the maximum to 32, which should be enough. + + src/parser.hh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 1ae56290c08acd59626387bc3b0914c6bb24d66e +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Clear only used parameters + + At most n_args + 1 parameters have been touched, and + therefore only clear these. + + This provides an almost ⅓ speedup on the pure parsing time. + + src/parser.cc | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +commit a7385b19423cd33d723715bbc039561a85e5e616 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Remove redundant assignment + + Don't clear seq.command first and then immediately overwrite + the value again. + + src/parser.cc | 3 --- + 1 file changed, 3 deletions(-) + +commit e2bd1889ec229e718a2ad4ccd7c3e2fecfe3d1c8 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Ignore sequence with too many parameters + + Also ignore sequences with too many default parameters. + + src/parser-test.cc | 4 ++-- + src/parser.cc | 9 +++++++-- + 2 files changed, 9 insertions(+), 4 deletions(-) + +commit 100df735dce712f2512723ed943f7c7260438cf8 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Ignore sequence with too many parameters + + src/parser-test.cc | 50 +++++++++++++++ + src/parser.cc | 181 ++++++++++++++++++++++++++++++++--------------------- + 2 files changed, 159 insertions(+), 72 deletions(-) + +commit d89930ed35031f9b009f9f5f60befe36ba8aa186 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: test: Check parameter clearing + + src/parser-glue.hh | 2 +- + src/parser-test.cc | 36 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 37 insertions(+), 1 deletion(-) + +commit 3596fa22cfeff920c025380ed532c11003a3dcc2 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Annotate unlikely conditionals + + src/parser.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 23bf9277df7109467031daa88a08bf3e905ac952 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Limit window title length + + Same as xterm does. + + src/vtedefines.hh | 3 +++ + src/vteseq.cc | 3 ++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +commit 45949df16692ac56bb4ab86e1fef3732e1e4d601 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + widget: Remove extraneous refresh-window emissions + + Palette changes are already doing an invalidate_all(), no + need to emit refresh-window too. + + src/vteinternal.hh | 2 +- + src/vteseq.cc | 35 +++-------------------------------- + 2 files changed, 4 insertions(+), 33 deletions(-) + +commit 32243017bc520c512eaca79d7664ef5654c9f180 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Implement OSC 5 + + https://bugzilla.gnome.org/show_bug.cgi?id=722751 + + src/vteinternal.hh | 18 ++++++- + src/vteseq.cc | 155 ++++++++++++++++++++++++++++++++++++----------------- + src/vtetypes.hh | 4 ++ + 3 files changed, 127 insertions(+), 50 deletions(-) + +commit a64a06f4753573010951f6b23206ffa742a93267 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Implement SUB + + src/vteseq.cc | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +commit 38f09c5ec29a0d00cfbf12aa0d7acf67d1d226f4 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Implement DECSR + + src/vteseq.cc | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +commit 774d43cdda268fc89e39c36b616cd409622bb36e +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Add more functions + + ...and mark them as implemented / unimplemented accordingly. + + src/Makefile.am | 6 + + src/modes-ecma.hh | 145 ++- + src/modes-private.hh | 603 +++++++++- + src/parser-c01.hh | 73 ++ + src/parser-cat.cc | 9 +- + src/parser-cmd.hh | 482 +++++--- + src/parser-csi.hh | 202 ++-- + src/parser-dcs.hh | 40 +- + src/parser-esc.hh | 47 +- + src/parser-reply.hh | 7 +- + src/parser-test.cc | 79 +- + src/parser.cc | 90 +- + src/parser.hh | 5 +- + src/vte.cc | 15 + + src/vteinternal.hh | 8 + + src/vteseq.cc | 3258 +++++++++++++++++++++++++++++++++++++++++++++----- + 16 files changed, 4308 insertions(+), 761 deletions(-) + +commit 33e84644162ac3b5deea493433ac0e40f68738a0 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Update DA1 response + + Use 65 to indicate VT5xx. + + src/vteseq.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 181752d26586c050204a56616255ac1473abff91 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Reject mixed-control OSC and DCS sequences + + Only accept OSC/DCS sequences where the introducer (OSC or DCS) + and the string terminator (ST) are either both C1 or C0. + + Note that this doesn't regress bug 730154; we still parse the + sequences but return VTE_SEQ_IGNORE. + + src/parser-test.cc | 50 +++++++++++++++++++++++++++++++++++++------------- + src/parser.cc | 36 ++++++++++++++++++++++++++++++++++++ + src/parser.hh | 1 + + 3 files changed, 74 insertions(+), 13 deletions(-) + +commit 771e9f7f20270936ab3a99402626ad9c41c0aa4a +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: test: Use SequenceBuilder + + src/parser-glue.hh | 44 ++++- + src/parser-test.cc | 476 +++++++++++++++-------------------------------------- + 2 files changed, 174 insertions(+), 346 deletions(-) + +commit a7c9e797fecf9ea1bbad1c076564ca6ea13c4572 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + lib: Use an enum for the SGR codes + + src/vteinternal.hh | 41 +++++++++++++++++++++++++++++++++ + src/vteseq.cc | 66 +++++++++++++++++++++++++++--------------------------- + 2 files changed, 74 insertions(+), 33 deletions(-) + +commit 5288de355453232bb0c18e6d0a65885fb8204155 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: test: Test DCS sequences without intermediates + + src/parser-test.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 7686ffe760f184a92898e9ff5191c0d6a9fc9d03 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Ignore overflowing OSC and DCS sequences + + When the length of the data string exceeds the limit, + ignore these sequences. + + src/parser-test.cc | 44 +++++++++++++++++++++++++++++++------------- + src/parser.cc | 6 ++++-- + 2 files changed, 35 insertions(+), 15 deletions(-) + +commit c38cfbf5b7dedfe8eeaa2c6abefd13ca840a636e +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Implement DECRQSS + + For now, only DECSCUSR and DECSTBM requests are supported. + + src/parser-glue.hh | 32 ++++++++++++++++++-- + src/parser-reply.hh | 62 +++++++++++++++++++++----------------- + src/vte.cc | 21 +++++++++++-- + src/vteinternal.hh | 5 ++++ + src/vteseq.cc | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 174 insertions(+), 32 deletions(-) + +commit f2fb1f76b838d842b0b0d547aaeb3bb4e7bbdd8b +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: glue: Add wrapper class for struct vte_parser + + src/parser-cat.cc | 12 +++---- + src/parser-glue.hh | 45 ++++++++++++++++++++++++++ + src/parser-test.cc | 17 +++++----- + src/parser.cc | 95 ++++++++++++++---------------------------------------- + src/parser.hh | 10 ++++-- + src/vte.cc | 15 ++------- + src/vteinternal.hh | 3 +- + 7 files changed, 95 insertions(+), 102 deletions(-) + +commit 3c35e09be098206beb586f18d67a0f6f44856011 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Remove leftover from initial import + + These bits are unused. + + src/parser.hh | 33 --------------------------------- + 1 file changed, 33 deletions(-) + +commit 418350bdbd129ea8ff1da6c4fbd9ee6ef687ac11 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Distinguish between state changes and actions + + src/parser.cc | 391 ++++++++++++++++++++++++++++------------------------------ + 1 file changed, 188 insertions(+), 203 deletions(-) + +commit ff66c7352b27c087f419e0ccbc74086c8f388a1f +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Simplify parameter parsing + + The state machine already knows if it's processing + a character '0'..'9', or the parameter delimiters ':' + and ';'. Split parameter collection into 3 different + actions: collecting the value, and finishing a parameter + or subparameter. + + src/parser.cc | 73 ++++++++++++++++++++++++++++++++++++++++------------------- + 1 file changed, 50 insertions(+), 23 deletions(-) + +commit e25a901cf561a3b884f6ab83884309632e56e533 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Record intermediates in order + + Previously the parser would store intermediates as + a bit mask, which loses the order and, when matching, + makes any permutation of the intermediates match the + same sequence. + + This commit changes that to record the intermediates in + the order they are used. + + Store the intermediate (and, for CSI and DCS sequences, + the optional parameter character at the beginning of the + parameters) in one unsigned int, packed as much as possible. + + Simplify the ESC, CSI and DCS matchers by using a combined + code of final character and intermediates. + + src/Makefile.am | 11 +- + src/parser-cat.cc | 67 ++-- + src/parser-cmd.hh | 2 + + src/parser-csi.hh | 143 +++++++ + src/parser-dcs.hh | 36 ++ + src/parser-esc.hh | 49 +++ + src/parser-glue.hh | 24 +- + src/parser-test.cc | 164 ++++++-- + src/parser.cc | 1052 ++++++++++++++++------------------------------------ + src/parser.hh | 121 +++--- + src/vteseq.cc | 51 ++- + 11 files changed, 851 insertions(+), 869 deletions(-) + +commit 887f744b6e8c84204fa9bd66167ada88a9e7293a +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Don't collect invalid characters in escape sequences + + Intermediates must be 2/0..2/15, and finals must be 3/0..7/14. + Characters outside of that range shouldn't be silently ignored, + but instead abort the sequence. + + src/parser.cc | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 6d7e27736203c9210a3e4fec2cc44efcf9890d84 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + app: Fix option output in help + + src/app/app.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 039d85213be271c91b2609369a2cf87dc21e8a3a +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Ignore most C0 controls in OSC string + + Instead of clearing the sequence, just drop the character, + except for CAN, SUB and ESC. + + Note that this differs from xterm's behaviour. + + src/parser.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 8306373fd374bc203e9ae515c67e31fc97146ca6 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Speed up no-op strings + + Perform no action while dropping DCS IGNORE, APC, PM, SOS. + + src/parser.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit c21e714b44fccdd9374483bbf46767638a902cdd +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Ignore DEL in all states + + DEL does not change state or performs any action. + + src/parser-test.cc | 21 ++++++++++----------- + src/parser.cc | 41 ++++++----------------------------------- + 2 files changed, 16 insertions(+), 46 deletions(-) + +commit ada093ad1f965d90688ef05f33b87f0810570684 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + parser: Accept C0 ST to terminate OSC, DCS + + ... as well as the ignored APC, PM, SOS. + + src/parser-test.cc | 57 ++++++++++++------------- + src/parser.cc | 119 ++++++++++++++++++++++++++++++++++++++++++----------- + 2 files changed, 124 insertions(+), 52 deletions(-) + +commit 6c8fbbe2698ca8f374b63c047e3bf571f0f45fe7 +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Implement DECRQCRA + + This will be used in the test suite later. + + https://bugzilla.gnome.org/show_bug.cgi?id=745045 + + src/vte.cc | 43 ++++++++++++++++++-------- + src/vteinternal.hh | 8 ++++- + src/vteseq.cc | 89 +++++++++++++++++++++++++++++++++++++++++++++++++----- + 3 files changed, 119 insertions(+), 21 deletions(-) + +commit 02521cba6add9374f716b1e774a4943cccc626ad +Author: Christian Persch +Date: Tue Mar 27 19:40:13 2018 +0200 + + emulation: Fix DECSTBM parameters + + The comment about requiring 2 lines was inaccurate; + xterm does not actually work like that. + + https://bugzilla.gnome.org/show_bug.cgi?id=791451 + + src/vteseq.cc | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +commit fcdd6958e49571ed51c7b6f342047319d1caf85f +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Fix typo - https://bugzilla.gnome.org/show_bug.cgi?id=795278 - (cherry picked from commit 961927a8115c82f35deafe09c1d68689ff069905) + DEL is 7/15. - configure.ac | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) + src/parser.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit 5966e8bfbaa99dc778367e8433efeca6d50ebcf9 -Author: Egmont Koblinger -Date: Sun May 13 15:27:17 2018 +0200 +commit ef0a81b2cf08c5514772ee818316c094dda7d64e +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 - ring: Proper boundary checking for hyperlink position + emulation: Refactor tabstop handling - This fixes a rare crash around hyperlinks in a non grid aligned - VTE widget when the mouse enters the extra padding at the bottom. + Use a bitmask to store the tabstops instead of a hash table, + and add tests. + + src/Makefile.am | 18 ++- + src/parser-cmd.hh | 5 + + src/parser.cc | 10 ++ + src/tabstops-test.cc | 234 +++++++++++++++++++++++++++++++++++++++ + src/tabstops.hh | 222 +++++++++++++++++++++++++++++++++++++ + src/vte.cc | 84 +++----------- + src/vteinternal.hh | 16 ++- + src/vteseq.cc | 306 +++++++++++++++++++++++++++------------------------ + 8 files changed, 675 insertions(+), 220 deletions(-) + +commit db9ca29cfb593468bfabe8f4ac036e1521732692 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Implement SCI parsing + + src/parser-cat.cc | 1 + + src/parser-cmd.hh | 1 - + src/parser-glue.hh | 5 ++++- + src/parser-test.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++-- + src/parser.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++-------- + src/parser.hh | 2 +- + src/vteseq.cc | 11 ----------- + 7 files changed, 105 insertions(+), 24 deletions(-) + +commit 23c44f1f18b7985d9fba3205500d8873ecde51aa +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Implement the window title stack - https://bugzilla.gnome.org/show_bug.cgi?id=795826 - (cherry picked from commit d7df8276158dd448cf6813fb1039e7b5c464a1c2) + https://bugzilla.gnome.org/show_bug.cgi?id=699819 - src/ring.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/vte.cc | 5 +++++ + src/vtedefines.hh | 3 +++ + src/vteinternal.hh | 5 +++++ + src/vteseq.cc | 39 +++++++++++++++++++++++++++++++++++++++ + 4 files changed, 52 insertions(+) -commit 629cda75f2e664badc24477a0288424ca60307e4 +commit d17321a21c37369bd1383611d245b0ccb80c8cac Author: Christian Persch -Date: Mon Apr 9 21:48:28 2018 +0200 +Date: Tue Mar 27 19:40:12 2018 +0200 - Post release version bump + emulation: Remove icon title support + + Remove OSC 1 (icon title) support; this is a relic and not + useful anymore. + + Deprecate vte_terminal_get_icon_title(), the "icon-title-changed" + signal and the "icon-title" property, as well. + + https://bugzilla.gnome.org/show_bug.cgi?id=793203 - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + doc/reference/vte-sections.txt | 2 +- + src/vte.cc | 14 -------------- + src/vte/vtedeprecated.h | 4 ++++ + src/vte/vteterminal.h | 2 -- + src/vtegtk.cc | 10 ++++++---- + src/vteinternal.hh | 3 --- + src/vteseq.cc | 23 +++-------------------- + 7 files changed, 14 insertions(+), 44 deletions(-) -commit d00c15afcd4f50cc57d6bf3bcc87bd6cedf25529 +commit 20eb6baeb78652a585154150a27dd3ec8e58ca2d Author: Christian Persch -Date: Mon Apr 9 10:55:04 2018 +0200 +Date: Tue Mar 27 19:40:12 2018 +0200 - lib: Filter out BS and DEL from paste + emulation: Implement DECRQM - https://bugzilla.gnome.org/show_bug.cgi?id=794653 - (cherry picked from commit 691db2070ead5894947c7db7c87568aa494fbcfd) + https://bugzilla.gnome.org/show_bug.cgi?id=787007 - src/vte.cc | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) + src/parser-cmd.hh | 2 +- + src/parser.cc | 4 ++-- + src/vteseq.cc | 48 ++++++++++++++++++++++++++++++++++++++++++------ + 3 files changed, 45 insertions(+), 9 deletions(-) -commit 9058e0eaa19e982a83724fdd24d6badf891d02fa -Author: Debarshi Ray -Date: Fri Mar 9 19:51:03 2018 +0100 +commit 6cd4713c561dba2188ecc78b6be648225cab7dda +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 - widget: Remove GdkVisibilityState handling + parser: glue: Add sequence builder - GtkWidget::visibility-notify-event doesn't work on modern composited - windowing systems. In such cases one can only assume that the widget - is always completely visible (ie. GDK_VISIBILITY_UNOBSCURED). + ... and use it throughout. + + src/Makefile.am | 3 + + src/debug.cc | 1 + + src/debug.h | 1 + + src/parser-arg.hh | 9 + + src/parser-cat.cc | 3 + + src/parser-glue.hh | 312 +++++++++++++++++++++++++++++++ + src/parser-reply.hh | 54 ++++++ + src/parser-test.cc | 15 ++ + src/parser.hh | 42 +++++ + src/vte.cc | 83 ++++++++- + src/vteinternal.hh | 15 ++ + src/vteseq.cc | 515 +++++++++++++++++++++++++++++++--------------------- + 12 files changed, 836 insertions(+), 217 deletions(-) + +commit fbeb9cb88eecdc032c7bb0e5e229834eb45b7a9b +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Use an enum for the XTERM_WM param values + + src/vteinternal.hh | 22 ++++++++++++++++++++ + src/vteseq.cc | 60 +++++++++++++++++++++++++++++++++++++++--------------- + 2 files changed, 66 insertions(+), 16 deletions(-) + +commit b3d8fe0e25f6e59d368a4101bd361300fe060177 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Implement DCS parsing + + src/parser-cmd.hh | 17 ++++++ + src/parser-test.cc | 92 +++++++++++++++++++++++++++++- + src/parser.cc | 149 ++++++++++++++++++++++++++++++++++++++++-------- + src/vteseq.cc | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 398 insertions(+), 23 deletions(-) + +commit 1e29c00aaae00069aed92370a8eb1c46fe4455e7 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Remove leftovers from old parser + + src/Makefile.am | 1 - + src/vteinternal.hh | 8 ----- + src/vteseq-list.hh | 96 ------------------------------------------------------ + 3 files changed, 105 deletions(-) + +commit c4cd94d2b5ef472d83888a320c0d3744561d5ecc +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Implement OSC parsing + + src/Makefile.am | 6 + + src/parser-arg.hh | 2 +- + src/parser-cat.cc | 24 +- + src/parser-cmd.hh | 1 + + src/parser-glue.hh | 324 ++++++++++++++++----- + src/parser-osc.hh | 100 +++++++ + src/parser-string.hh | 138 +++++++++ + src/parser-test.cc | 393 +++++++++++++++++++++++-- + src/parser.cc | 58 ++-- + src/parser.hh | 12 +- + src/vte.cc | 53 ++-- + src/vtegtk.cc | 10 +- + src/vteinternal.hh | 63 ++-- + src/vteseq.cc | 808 +++++++++++++++++++++++++-------------------------- + 14 files changed, 1399 insertions(+), 593 deletions(-) + +commit e9fa511fe35ed38020671f1867ff0d3ccb76f07c +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + vte.sh: Use C1 controls in OSC sequences + + src/vte.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit b0bb1540a5e1321aa4944310416b3d072596a002 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Unify mode handling + + src/Makefile.am | 23 +- + src/debug.cc | 1 + + src/debug.h | 1 + + src/modes-ecma.hh | 65 ++++++ + src/modes-private.hh | 250 +++++++++++++++++++++ + src/modes-test.cc | 90 ++++++++ + src/modes.hh | 250 +++++++++++++++++++++ + src/vte.cc | 131 +++++------ + src/vteinternal.hh | 68 ++---- + src/vteseq.cc | 612 ++++++++++++++++----------------------------------- + 10 files changed, 934 insertions(+), 557 deletions(-) + +commit 011856ac1904f79ddabce4d72c6dd6e9b428d5a9 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Remove LNM mode support - These days most users have a compositor, and therefore bugs in this - optimization often manage to survive undetected. + LNM has been deprecated for so long that it's been removed + from ECMA-48, see § F.5.2. + + src/vte.cc | 50 +++++++------------------------------------------- + src/vteinternal.hh | 5 +---- + src/vteseq.cc | 3 --- + 3 files changed, 8 insertions(+), 50 deletions(-) + +commit 0b24be7830137b7b099da1b5b102bbdb3a55a86c +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 3 - + src/vteseq.cc | 216 +++++++++++------------------------------------------ + 2 files changed, 44 insertions(+), 175 deletions(-) + +commit 983769e2879a0d3eb31c6e4114d586054f240860 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/parser-cmd.hh | 4 +-- + src/parser.cc | 8 +++--- + src/vteseq-list.hh | 4 --- + src/vteseq.cc | 79 ++++++++++++++++++------------------------------------ + 4 files changed, 32 insertions(+), 63 deletions(-) + +commit fde88ef7f9226a0849ca62663bc1eaa9862178b8 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 3 -- + src/vteseq.cc | 99 ++++++++++++++++++++++-------------------------------- + 2 files changed, 40 insertions(+), 62 deletions(-) + +commit d6e594de6fed766e874888cf44f396a6fd94ffb4 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 3 --- + src/vteseq.cc | 70 +++++++++++++++++++++++------------------------------- + 2 files changed, 30 insertions(+), 43 deletions(-) + +commit f96b1326ab5db3701ef0dfda1044b76bede6bbe9 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 5 ---- + src/vteseq.cc | 75 +++++++++++++----------------------------------------- + 2 files changed, 18 insertions(+), 62 deletions(-) + +commit 37db400d6b5c254d3df46328a170a3f325b59356 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 93 +++++++++++++++++++++++------------------------------- + 2 files changed, 39 insertions(+), 56 deletions(-) + +commit 15e9df6f359deb6b670eb714f74775e6e9b8fd93 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Move sequence handler code directly into the handler + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 24 ++++++++---------------- + 2 files changed, 8 insertions(+), 18 deletions(-) + +commit 13b3ac515590c7e874c4317ae927e06743e10c22 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port DECSTBM to new parameter glue + + src/vteinternal.hh | 3 -- + src/vteseq-list.hh | 3 -- + src/vteseq.cc | 131 +++++++++++++++++++---------------------------------- + 3 files changed, 46 insertions(+), 91 deletions(-) + +commit 33ce2d03b16b6a46c8cb1032864e7b4dc29db0f3 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port DL, IL to new parameter glue + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 28 ++++++++-------------------- + 2 files changed, 8 insertions(+), 21 deletions(-) + +commit 0064f8a157dc2e296d8c4c50f63b651e015d6fd1 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port HTS, TBC to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 62 +++++++++++++++++++++++++++++------------------------- + 2 files changed, 33 insertions(+), 31 deletions(-) + +commit a85c4d30dbc7c97cddf1d47ccfe4bc68a1f9eeb5 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port CBT, CHT to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 62 ++++++++++++++++++++++++------------------------------ + 2 files changed, 27 insertions(+), 37 deletions(-) + +commit 8a1b704d84a3b97842238d417641fa288a78b453 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port REP to new parameter glue + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 25 ++++++++++--------------- + 2 files changed, 10 insertions(+), 16 deletions(-) + +commit e1687cf958dec87df509ecff0bbbabceeb67a783 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port ICH to new parameter glue + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 20 +++++++------------- + 2 files changed, 7 insertions(+), 14 deletions(-) + +commit b7262c35463bde2474f8a17defcec2b9cec0252d +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port DCH, ECH to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 39 ++++++++++++++++----------------------- + 2 files changed, 16 insertions(+), 25 deletions(-) + +commit 1aa9681b7be2079252d9a20333b1abe32c377176 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port CPL, CUU to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 32 +++++++++++--------------------- + 2 files changed, 11 insertions(+), 23 deletions(-) + +commit 87385bb7ba0354e764ed652711f2c073cfaa40a2 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port SD, SU to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 30 +++++++++--------------------- + 2 files changed, 9 insertions(+), 23 deletions(-) + +commit fcbe649e7b04c584af56ece29060f450cad635d3 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port CUB, CUF to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 26 ++++++++------------------ + 2 files changed, 8 insertions(+), 20 deletions(-) + +commit b28f3dceb4b7aad6de98d966ee8fbd30fb66d010 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port CNL, CUD to new parameter glue + + src/vteseq-list.hh | 2 -- + src/vteseq.cc | 28 ++++++++++------------------ + 2 files changed, 10 insertions(+), 20 deletions(-) + +commit 8f223ebdd619846f2f9c1f04c3888eabecde67a6 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port VPA to new parameter glue + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 17 +++++------------ + 2 files changed, 5 insertions(+), 13 deletions(-) + +commit 58f7727b74e8e0957682121dd8a1dbb527f3c9b7 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port CHA, HPA, CUP to new parameter glue + + src/vteinternal.hh | 4 +++ + src/vteseq-list.hh | 4 --- + src/vteseq.cc | 71 +++++++++++++++++++++++++++--------------------------- + 3 files changed, 39 insertions(+), 40 deletions(-) + +commit 7e0af2d46aed31eb53da558c5b2324d71d521693 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port XTERM_WM to new parameter glue + + src/parser-test.cc | 4 + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 385 ++++++++++++++++++++++++++--------------------------- + 3 files changed, 190 insertions(+), 200 deletions(-) + +commit 2dbfddd9e5f866a5aa146a1af8c9b5b2012853bb +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port DECSCUSR to new parameter glue + + src/vteseq-list.hh | 1 - + src/vteseq.cc | 37 +++++++++++++------------------------ + 2 files changed, 13 insertions(+), 25 deletions(-) + +commit 2d8e0f8f27fb57347ebb4f95baaf8ed8c6c04cad +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + emulation: Port DSR to new parameter glue + + src/parser-cmd.hh | 2 +- + src/parser.cc | 4 +- + src/vteseq-list.hh | 2 - + src/vteseq.cc | 193 +++++++++++++++++++++++++++-------------------------- + 4 files changed, 100 insertions(+), 101 deletions(-) + +commit 35b484de9c4f559b445e48535bb39b79170f7c5a +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: glue: Add some convenience function to collect parameters + + src/parser-arg.hh | 14 +++++++++++ + src/parser-glue.hh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/parser-test.cc | 68 ++++++++++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 153 insertions(+), 2 deletions(-) + +commit edcb9d8ffaf3aa755df90637767c4dd04f949588 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Improve glue for subparameters - https://bugzilla.gnome.org/show_bug.cgi?id=794214 - (cherry picked from commit b54395869c408656f31493a25f9e9fe89cd56bb7) + ... and use it to parse SGR with subparameters. - src/vte.cc | 53 +---------------------------------------------------- - src/vtegtk.cc | 9 --------- - src/vteinternal.hh | 4 ---- - 3 files changed, 1 insertion(+), 65 deletions(-) + src/parser-arg.hh | 8 +- + src/parser-glue.hh | 178 ++++++++++++++++-- + src/parser-test.cc | 84 ++++++++- + src/vteinternal.hh | 6 +- + src/vteseq-list.hh | 1 - + src/vteseq.cc | 520 ++++++++++++++++++----------------------------------- + 6 files changed, 426 insertions(+), 371 deletions(-) + +commit 02bb51a508a8d368f529ee031cc47db5ba9d599b +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: cat: Add benchmark mode + + Add benchmark mode and repeat counter to parser-cat. + This is useful to measure the time spent in the parser only. + + src/parser-cat.cc | 97 +++++++++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 87 insertions(+), 10 deletions(-) + +commit cc76ded64133f942d5074fbc22120ab3f2c73f9a +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Improve test programme + + src/Makefile.am | 25 ++-- + src/interpret.cc | 231 ------------------------------ + src/iso2022.cc | 2 - + src/iso2022.h | 1 - + src/parser-cat.cc | 414 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 424 insertions(+), 249 deletions(-) + +commit 45561b86c5855a3a2c17582b033ef1aace20f2fb +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Parse subparameters in CSI sequences + + This is used in SGR. -commit 30d951d243e526a7cdbc7e958cf5aa0723283fb6 + src/parser-test.cc | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +commit db833edf98f881085b14ae5240ea65bcff383b91 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Parse subparameters in CSI sequences + + This is used in SGR. + + src/parser-arg.hh | 112 +++++++++++++++++++++++++++++++++++++++++++++++------ + src/parser-test.cc | 107 ++++++++++++++++++++++++++++++++++++++------------ + src/parser.cc | 42 +++++++++++--------- + src/parser.hh | 1 + + 4 files changed, 208 insertions(+), 54 deletions(-) + +commit 0b17caececdc1cf02fe66fd04a2e855b5a83dc2a +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Use 0 as the default arg value + + Instead of using -1 as the default value, use 0, and mark actual values + with a flag. + + This is in preparation to implement parsing subparameters. + + src/parser-arg.hh | 22 +++++++++++----------- + src/parser-test.cc | 1 - + src/vteseq.cc | 2 +- + 3 files changed, 12 insertions(+), 13 deletions(-) + +commit b512050c16e8ae9e9c40efc41b1eba6a52abdca7 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Fix charset detection + + And remove the old parser and test programme. + + src/Makefile.am | 42 +-- + src/caps-list.hh | 318 ------------------ + src/interpret-old.cc | 302 ----------------- + src/matcher.cc | 221 ------------- + src/matcher.hh | 88 ----- + src/parser-charset-tables.hh | 230 +++++++++++++ + src/parser-charset.hh | 306 +++++++++++++++++ + src/parser-cmd.hh | 15 +- + src/parser-glue.hh | 4 + + src/parser-test.cc | 246 +++++++++++++- + src/parser.cc | 508 ++++++++++++----------------- + src/parser.hh | 61 +--- + src/table.cc | 761 ------------------------------------------- + src/table.hh | 55 ---- + src/vteseq-list.hh | 8 - + src/vteseq-str.hh | 156 --------- + src/vteseq.cc | 403 +++++++++++------------ + 17 files changed, 1211 insertions(+), 2513 deletions(-) + +commit bec2fff7f9431f9765f165c3a54b7d2fc19542a9 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Define a type for CSI parameters + + This is in preparation to parse subparameters delimited by ':'. + + src/Makefile.am | 2 ++ + src/interpret.cc | 2 +- + src/parser-arg.hh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/parser-glue.hh | 4 +-- + src/parser-test.cc | 62 +++++++++++++++++++++++++++++++++++++++++------ + src/parser.cc | 33 +++++++++---------------- + src/parser.hh | 4 ++- + 7 files changed, 145 insertions(+), 33 deletions(-) + +commit e215bc5136e088f51700ba3e7baf6104d6669cc6 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Don't clear state when executing a control character + + C0 controls can occur inside an ESC or CSI sequence, where + they must be executed immediately but not abort the sequence, + and therefore also not clear the parameters. + + src/parser.cc | 1 - + 1 file changed, 1 deletion(-) + +commit 78b37c0ef1e6266cd10789991fcc6bf1d1b9cc3c +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Import new parser + + doc/reference/Makefile.am | 3 + + src/Makefile.am | 73 +- + src/debug.cc | 3 +- + src/debug.h | 27 +- + src/interpret-old.cc | 302 +++++ + src/interpret.cc | 281 ++-- + src/iso2022.h | 1 - + src/matcher.cc | 2 +- + src/parser-cmd.hh | 193 +++ + src/parser-glue.hh | 148 ++ + src/parser-test.cc | 539 ++++++++ + src/parser.cc | 115 +- + src/parser.hh | 218 +-- + src/table.cc | 4 +- + src/table.hh | 1 + + src/vte.cc | 290 ++-- + src/vteinternal.hh | 140 +- + src/vteseq-str.hh | 156 +++ + src/vteseq.cc | 3257 ++++++++++++++++++++++++++++++++++++++++++--- + 19 files changed, 4879 insertions(+), 874 deletions(-) + +commit 032a5c6622ff9ae8131a39c52623e595a2c94f54 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + parser: Import new parser + + COPYING.GPL3 | 675 ++++++++++++++++++++ + COPYING => COPYING.LGPL2 | 0 + COPYING.LGPL3 | 165 +++++ + Makefile.am | 3 + + src/parser.cc | 1578 ++++++++++++++++++++++++++++++++++++++++++++++ + src/parser.hh | 362 +++++++++++ + 6 files changed, 2783 insertions(+) + +commit f1b8a29ae7182ab76cad1867a7fa8a87867e06b4 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + build: Update requirements + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 899ce4558fd6c870813b552f78ab98278823e9b1 +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + Revert "emulation: Add support for OSC 5;0 (bold color)" + + This reverts commit e258bda404f146262545abf7c332d7917a55d5d6. + + src/caps-list.hh | 6 ------ + src/vteinternal.hh | 2 +- + src/vteseq-list.hh | 3 --- + src/vteseq.cc | 57 ++++++++++++++++-------------------------------------- + 4 files changed, 18 insertions(+), 50 deletions(-) + +commit 340233e40b96b69fb17ead2dea6d55e4a875993d +Author: Christian Persch +Date: Tue Mar 27 19:40:12 2018 +0200 + + Revert "emulation: Implement DECRQCRA" + + To avoid merge conflicts, this reverts + commit cac7b40b507c8ef705c0d7a3c2fee8a4bc3ee6ef + which will be re-implemented later on. + + src/caps-list.hh | 2 -- + src/vte.cc | 29 ------------------ + src/vteinternal.hh | 5 --- + src/vteseq-list.hh | 1 - + src/vteseq.cc | 89 ------------------------------------------------------ + 5 files changed, 126 deletions(-) + +commit e258bda404f146262545abf7c332d7917a55d5d6 Author: Egmont Koblinger Date: Wed Mar 21 22:36:55 2018 +0100 @@ -76,7 +2531,6 @@ Also OSC 4;256 does the same. Resetting counterparts (104, 105) added too. https://bugzilla.gnome.org/show_bug.cgi?id=722751 - (cherry picked from commit e258bda404f146262545abf7c332d7917a55d5d6) src/caps-list.hh | 6 ++++++ src/vteinternal.hh | 2 +- @@ -84,11 +2538,38 @@ src/vteseq.cc | 57 ++++++++++++++++++++++++++++++++++++++---------------- 4 files changed, 50 insertions(+), 18 deletions(-) -commit e14805149784afd2c69caadcbe4d2c33d6f63661 +commit f0ee057544f7ba255e92c171203e8b4a8de09121 +Author: Egmont Koblinger +Date: Wed Mar 21 21:20:39 2018 +0100 + + widget: Remove faux bold support + + When no suitable bold counterpart is found for a font, simply use the + base font rather than printing it twice with a 1px offset. + + https://bugzilla.gnome.org/show_bug.cgi?id=756010 + + src/vte.cc | 3 +-- + src/vtedraw.cc | 22 ---------------------- + src/vtedraw.hh | 1 - + 3 files changed, 1 insertion(+), 25 deletions(-) + +commit cac3f1d87583932bbac803e036baf5739a03565c +Author: Egmont Koblinger +Date: Wed Mar 21 21:19:21 2018 +0100 + + widget: Do not extend the background under faux bold characters + + https://bugzilla.gnome.org/show_bug.cgi?id=682692#c5 + + src/vte.cc | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +commit 6f330cc1aac2975540d45d88b703131f351c51b2 Author: Christian Persch -Date: Mon Mar 12 21:43:22 2018 +0100 +Date: Mon Mar 12 21:44:43 2018 +0100 - Post release version bump + Post branch version bump configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -Nru vte2.91-0.52.2/config.h.in vte2.91-0.54.0/config.h.in --- vte2.91-0.52.2/config.h.in 2018-05-21 19:32:16.000000000 +0000 +++ vte2.91-0.54.0/config.h.in 2018-09-02 13:20:46.000000000 +0000 @@ -26,8 +26,8 @@ the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE -/* define if the compiler supports basic C++11 syntax */ -#undef HAVE_CXX11 +/* define if the compiler supports basic C++14 syntax */ +#undef HAVE_CXX14 /* Define to 1 if you have the `dcgettext' function. */ #undef HAVE_DCGETTEXT @@ -217,6 +217,9 @@ /* Define to 1 to enable GnuTLS support */ #undef WITH_GNUTLS +/* Enable legacy charset support using iconv */ +#undef WITH_ICONV + /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 diff -Nru vte2.91-0.52.2/configure vte2.91-0.54.0/configure --- vte2.91-0.52.2/configure 2018-05-21 19:32:15.000000000 +0000 +++ vte2.91-0.54.0/configure 2018-09-02 13:20:45.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for vte 0.52.2. +# Generated by GNU Autoconf 2.69 for vte 0.54.0. # # Report bugs to . # @@ -651,8 +651,8 @@ # Identity of this package. PACKAGE_NAME='vte' PACKAGE_TARNAME='vte' -PACKAGE_VERSION='0.52.2' -PACKAGE_STRING='vte 0.52.2' +PACKAGE_VERSION='0.54.0' +PACKAGE_STRING='vte 0.54.0' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=vte' PACKAGE_URL='' @@ -852,7 +852,7 @@ build_cpu build LIBTOOL -HAVE_CXX11 +HAVE_CXX14 SED EGREP GREP @@ -980,6 +980,7 @@ enable_nls enable_Bsymbolic with_gnutls +with_iconv enable_glade_catalogue enable_introspection enable_vala @@ -1571,7 +1572,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures vte 0.52.2 to adapt to many kinds of systems. +\`configure' configures vte 0.54.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1642,7 +1643,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of vte 0.52.2:";; + short | recursive ) echo "Configuration of vte 0.54.0:";; esac cat <<\_ACEOF @@ -1690,6 +1691,7 @@ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --without-gnutls Disable GnuTLS support + --without-iconv Disable legacy charset support using iconv --with-html-dir=PATH path to installed docs Some influential environment variables: @@ -1801,7 +1803,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -vte configure 0.52.2 +vte configure 0.54.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2337,7 +2339,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by vte $as_me 0.52.2, which was +It was created by vte $as_me 0.54.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3206,7 +3208,7 @@ # Define the identity of the package. PACKAGE='vte' - VERSION='0.52.2' + VERSION='0.54.0' cat >>confdefs.h <<_ACEOF @@ -3435,7 +3437,7 @@ -LT_VERSION_INFO="5200:2:5200" +LT_VERSION_INFO="5400:0:5400" ################################################################################ @@ -5628,16 +5630,16 @@ - ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true + ax_cxx_compile_alternatives="14 1y" ax_cxx_compile_cxx14_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 -$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } -if ${ax_cv_cxx_compile_cxx11+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features by default" >&5 +$as_echo_n "checking whether $CXX supports C++14 features by default... " >&6; } +if ${ax_cv_cxx_compile_cxx14+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5928,26 +5930,146 @@ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv_cxx_compile_cxx11=yes + ax_cv_cxx_compile_cxx14=yes else - ax_cv_cxx_compile_cxx11=no + ax_cv_cxx_compile_cxx14=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 -$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } - if test x$ax_cv_cxx_compile_cxx11 = xyes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx14" >&5 +$as_echo "$ax_cv_cxx_compile_cxx14" >&6; } + if test x$ax_cv_cxx_compile_cxx14 = xyes; then ac_success=yes fi if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" - cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 -$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } + cachevar=`$as_echo "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++14 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6241,6 +6363,126 @@ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes @@ -6267,9 +6509,9 @@ if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 -$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } + cachevar=`$as_echo "ax_cv_cxx_compile_cxx14_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++14 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++14 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6563,6 +6805,126 @@ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes @@ -6595,25 +6957,24 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ax_cxx_compile_cxx14_required = xtrue; then if test x$ac_success = xno; then - as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 + as_fn_error $? "*** A compiler with support for C++14 language features is required." "$LINENO" 5 fi fi if test x$ac_success = xno; then - HAVE_CXX11=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 -$as_echo "$as_me: No compiler with C++11 support was found" >&6;} + HAVE_CXX14=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++14 support was found" >&5 +$as_echo "$as_me: No compiler with C++14 support was found" >&6;} else - HAVE_CXX11=1 + HAVE_CXX14=1 -$as_echo "#define HAVE_CXX11 1" >>confdefs.h +$as_echo "#define HAVE_CXX14 1" >>confdefs.h fi - # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; @@ -20303,6 +20664,28 @@ fi +######################## +# Legacy Charset Support +######################## + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable legacy charset support using iconv" >&5 +$as_echo_n "checking whether to enable legacy charset support using iconv... " >&6; } + +# Check whether --with-iconv was given. +if test "${with_iconv+set}" = set; then : + withval=$with_iconv; +else + with_iconv=yes +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_iconv" >&5 +$as_echo "$with_iconv" >&6; } +if test "$with_iconv" = "yes"; then + +$as_echo "#define WITH_ICONV 1" >>confdefs.h + +fi + ################################################################################ # Glade catalogue ################################################################################ @@ -21419,9 +21802,9 @@ VTE_MAJOR_VERSION=0 -VTE_MINOR_VERSION=52 +VTE_MINOR_VERSION=54 -VTE_MICRO_VERSION=2 +VTE_MICRO_VERSION=0 @@ -21431,7 +21814,7 @@ ################################################################################ -ac_config_files="$ac_config_files Makefile src/Makefile src/vte.gresource.xml src/vte/vteversion.h src/app/Makefile bindings/Makefile bindings/gir/Makefile bindings/vala/Makefile perf/Makefile po/Makefile.in doc/Makefile doc/openi18n/Makefile doc/reference/Makefile doc/reference/version.xml glade/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile src/vte.gresource.xml src/vte/vteversion.h src/app/Makefile bindings/Makefile bindings/gir/Makefile bindings/vala/Makefile perf/Makefile po/Makefile.in doc/Makefile doc/reference/Makefile doc/reference/version.xml glade/Makefile" ac_config_files="$ac_config_files vte-${VTE_API_VERSION}.pc:vte.pc.in" @@ -22037,7 +22420,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by vte $as_me 0.52.2, which was +This file was extended by vte $as_me 0.54.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22103,7 +22486,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -vte config.status 0.52.2 +vte config.status 0.54.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -22629,7 +23012,6 @@ "perf/Makefile") CONFIG_FILES="$CONFIG_FILES perf/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "doc/openi18n/Makefile") CONFIG_FILES="$CONFIG_FILES doc/openi18n/Makefile" ;; "doc/reference/Makefile") CONFIG_FILES="$CONFIG_FILES doc/reference/Makefile" ;; "doc/reference/version.xml") CONFIG_FILES="$CONFIG_FILES doc/reference/version.xml" ;; "glade/Makefile") CONFIG_FILES="$CONFIG_FILES glade/Makefile" ;; @@ -24108,6 +24490,7 @@ Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION GnuTLS: $with_gnutls + IConv: $with_iconv Installing Glade catalogue: $enable_glade_catalogue Debugging: $enable_debug Introspection: $enable_introspection diff -Nru vte2.91-0.52.2/configure.ac vte2.91-0.54.0/configure.ac --- vte2.91-0.52.2/configure.ac 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/configure.ac 2018-09-02 13:20:22.000000000 +0000 @@ -1,6 +1,6 @@ m4_define([version_major],0) -m4_define([version_minor],52) -m4_define([version_micro],2) +m4_define([version_minor],54) +m4_define([version_micro],0) m4_define([version_triplet],version_major.version_minor.version_micro) AC_PREREQ([2.63]) @@ -97,7 +97,7 @@ AM_PROG_CC_C_O AC_PROG_SED -AX_CXX_COMPILE_STDCXX([11]) +AX_CXX_COMPILE_STDCXX([14]) AC_SYS_LARGEFILE @@ -322,6 +322,20 @@ gdk-pixbuf-2.0 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED]) +######################## +# Legacy Charset Support +######################## + +AC_MSG_CHECKING([whether to enable legacy charset support using iconv]) +AC_ARG_WITH([iconv], + [AS_HELP_STRING([--without-iconv], + [Disable legacy charset support using iconv])], + [],[with_iconv=yes]) +AC_MSG_RESULT([$with_iconv]) +if test "$with_iconv" = "yes"; then + AC_DEFINE([WITH_ICONV],[1],[Enable legacy charset support using iconv]) +fi + ################################################################################ # Glade catalogue ################################################################################ @@ -439,7 +453,6 @@ perf/Makefile po/Makefile.in doc/Makefile -doc/openi18n/Makefile doc/reference/Makefile doc/reference/version.xml glade/Makefile @@ -461,6 +474,7 @@ Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION GnuTLS: $with_gnutls + IConv: $with_iconv Installing Glade catalogue: $enable_glade_catalogue Debugging: $enable_debug Introspection: $enable_introspection diff -Nru vte2.91-0.52.2/COPYING vte2.91-0.54.0/COPYING --- vte2.91-0.52.2/COPYING 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff -Nru vte2.91-0.52.2/COPYING.GPL3 vte2.91-0.54.0/COPYING.GPL3 --- vte2.91-0.52.2/COPYING.GPL3 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/COPYING.GPL3 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,675 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff -Nru vte2.91-0.52.2/COPYING.LGPL2 vte2.91-0.54.0/COPYING.LGPL2 --- vte2.91-0.52.2/COPYING.LGPL2 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/COPYING.LGPL2 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff -Nru vte2.91-0.52.2/COPYING.LGPL3 vte2.91-0.54.0/COPYING.LGPL3 --- vte2.91-0.52.2/COPYING.LGPL3 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/COPYING.LGPL3 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff -Nru vte2.91-0.52.2/debian/changelog vte2.91-0.54.0/debian/changelog --- vte2.91-0.52.2/debian/changelog 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/changelog 2018-09-12 14:29:35.000000000 +0000 @@ -1,3 +1,54 @@ +vte2.91 (0.54.0-1ubuntu1) cosmic; urgency=medium + + [ Marco Trevisan (Treviño) ] + * Merge with debian (LP: #1791373). Remaining changes: + - debian/rules: + + Use --without-pcre2 + - Add revert-pcre2.patch: + + Revert changes that require PCRE2 since it's not in main + (see MIR #1636666) + - Add 91_keep_fds.patch since gdebi still requires it (LP: #1756238) + - 0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch: + + Keep as it is required for the Ubuntu theming + * Rebased debian/patches + + d/p/revert-pcre2.patch: + - Updated to work with Terminal class + + [ Iain Lane ] + * 0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch: Add an + upstream bug reference. + + -- Marco Trevisan (Treviño) Wed, 12 Sep 2018 15:29:35 +0100 + +vte2.91 (0.54.0-1) unstable; urgency=medium + + [ Marco Trevisan (Treviño) ] + * New upstream release + * Update symbols file + + [ Jeremy Bicha ] + * Update debian/gbp.conf + * Release to unstable + + -- Jeremy Bicha Sat, 08 Sep 2018 10:36:42 -0400 + +vte2.91 (0.53.0-1) experimental; urgency=medium + + * Team upload + * New upstream development release + * d/watch: Watch for development versions + * d/copyright: Update + * Set Rules-Requires-Root to no + * Stop installing AUTHORS file, which just points to git history + * Stop installing README, which no longer exists + * Standards-Version: 4.2.0 + * Refresh patch series + * d/libvte-2.91-0.symbols: Ignore C++ symbols. + These are template instantiations, and are not part of vte's + public ABI. + + -- Simon McVittie Wed, 22 Aug 2018 11:17:41 +0100 + vte2.91 (0.52.2-1ubuntu1) cosmic; urgency=medium [ Iain Lane ] diff -Nru vte2.91-0.52.2/debian/control vte2.91-0.54.0/debian/control --- vte2.91-0.52.2/debian/control 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/control 2018-09-12 14:29:35.000000000 +0000 @@ -7,7 +7,7 @@ Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian GNOME Maintainers -Uploaders: Iain Lane , Jeremy Bicha , Michael Biebl +Uploaders: Iain Lane , Jeremy Bicha Build-Depends: debhelper (>= 11), gnome-pkg-tools (>= 0.10), libglib2.0-dev (>= 2.40.0), @@ -23,8 +23,9 @@ libgladeui-dev, intltool (>= 0.35), valac (>= 0.31.1) +Rules-Requires-Root: no Build-Depends-Indep: libglib2.0-doc, libgtk-3-doc, libatk1.0-doc -Standards-Version: 4.1.4 +Standards-Version: 4.2.0 Vcs-Browser: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/vte2.91 Vcs-Git: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/vte2.91 XS-Debian-Vcs-Browser: https://salsa.debian.org/gnome-team/vte2.91 diff -Nru vte2.91-0.52.2/debian/control.in vte2.91-0.54.0/debian/control.in --- vte2.91-0.52.2/debian/control.in 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/control.in 2018-09-12 14:29:35.000000000 +0000 @@ -19,8 +19,9 @@ libgladeui-dev, intltool (>= 0.35), valac (>= 0.31.1) +Rules-Requires-Root: no Build-Depends-Indep: libglib2.0-doc, libgtk-3-doc, libatk1.0-doc -Standards-Version: 4.1.4 +Standards-Version: 4.2.0 Vcs-Browser: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/vte2.91 Vcs-Git: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/vte2.91 XS-Debian-Vcs-Browser: https://salsa.debian.org/gnome-team/vte2.91 diff -Nru vte2.91-0.52.2/debian/copyright vte2.91-0.54.0/debian/copyright --- vte2.91-0.52.2/debian/copyright 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/copyright 2018-09-12 14:29:35.000000000 +0000 @@ -3,36 +3,89 @@ Source: https://download.gnome.org/sources/vte/ Files: * -Copyright: 2001-2004,2009,2010 Red Hat, Inc. - 2008-2010,2012-2014 Christian Persch +Copyright: 2001-2010 Red Hat, Inc. + 2008-2018 Christian Persch License: LGPL-2.1+ -Files: src/vtetree.* -Copyright: 2004 Benjamin Otte +Files: po/*.po +Copyright: 2002-2017 Free Software Foundation, Inc. + 2003-2017 the vte authors + 2002-2014 Kjartan Maraas + 2003 Mətin Əmirov + 2003 The FarsiWeb Project Group + 2003-2008 GNOME Foundation + 2004 Tamil Translation Team + 2004 Aiet Kolkhi + 2005 Canonical Ltd. + 2006 Gnome i18n Project for Latvian + 2007 Swecha Telugu Localisation Team + 2007-2010 The GNOME Project + 2010 The IFSUG Translation Group + 2010 Fran Diéguez + Adam Weinberger + Croatiann team License: LGPL-2.1+ +Files: + src/attr.hh + src/color-triple.hh + src/modes-ecma.hh + src/modes-private.hh + src/modes-test.cc + src/modes.hh + src/parser-arg.hh + src/parser-c01.hh + src/parser-charset-tables.hh + src/parser-charset.hh + src/parser-cmd.hh + src/parser-csi.hh + src/parser-dcs.hh + src/parser-esc.hh + src/parser-glue.hh + src/parser-osc.hh + src/parser-reply.hh + src/parser-string.hh + src/parser-test.cc + src/parser.cc + src/parser.hh + src/refptr-test.cc + src/refptr.hh + src/tabstops-test.cc + src/tabstops.hh + src/vteseq.cc +Copyright: 2001-2009 Red Hat, Inc. + 2015 David Herrmann + 2008-2018 Christian Persch +License: LGPL-3+ + Files: src/vtestream-file.h Copyright: 2009,2010 Red Hat, Inc. 2013 Google, Inc. License: LGPL-2.1+ -Files: src/vte.sh -Copyright: 2006 Shaun McCance +Files: + src/app/* + src/parser-cat.cc + src/vte.sh +Copyright: 2001-2003 Red Hat, Inc. + 2006 Shaun McCance 2013 Peter De Wachter + 2017-2018 Christian Persch License: GPL-3+ Files: src/box_drawing_generate.sh perf/img.sh perf/256test.sh -Copyright: 2014 Egmont Koblinger + perf/sgr-test.sh +Copyright: 2014-2017 Egmont Koblinger License: GPL-2+ Files: src/test-vte-sh.sh Copyright: 2013 Christian Persch License: GPL-2+ -Files: bindings/vala/app.vala - bindings/vala/app.c +Files: src/app/app.gresource.xml + bindings/vala/app.vala bindings/vala/app.gresource.xml Copyright: 2001,2002 Red Hat, Inc. 2014 Christian Persch @@ -55,6 +108,23 @@ On Debian systems, the complete text of the GNU Lesser General Public License can be found in "/usr/share/common-licenses/LGPL-2". +License: LGPL-3+ + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + . + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License can be found in "/usr/share/common-licenses/LGPL-3". + License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru vte2.91-0.52.2/debian/gbp.conf vte2.91-0.54.0/debian/gbp.conf --- vte2.91-0.52.2/debian/gbp.conf 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/gbp.conf 2018-09-12 14:29:35.000000000 +0000 @@ -4,3 +4,12 @@ upstream-branch = upstream/latest upstream-vcs-tag = %(version)s debian-tag = ubuntu/%(version)s + +[buildpackage] +sign-tags = True + +[import-orig] +postimport = dch -v%(version)s New upstream release; git add debian/changelog; debcommit + +[pq] +patch-numbers = False diff -Nru vte2.91-0.52.2/debian/libvte-2.91-0.docs vte2.91-0.54.0/debian/libvte-2.91-0.docs --- vte2.91-0.52.2/debian/libvte-2.91-0.docs 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/libvte-2.91-0.docs 2018-09-12 14:29:35.000000000 +0000 @@ -1,3 +1 @@ -AUTHORS NEWS -README diff -Nru vte2.91-0.52.2/debian/libvte-2.91-0.symbols vte2.91-0.54.0/debian/libvte-2.91-0.symbols --- vte2.91-0.52.2/debian/libvte-2.91-0.symbols 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/libvte-2.91-0.symbols 2018-09-12 14:29:35.000000000 +0000 @@ -31,6 +31,7 @@ vte_regex_new_for_search@Base 0.45.90 vte_regex_ref@Base 0.45.90 vte_regex_unref@Base 0.45.90 + (optional=useful only for debugging, skipped by introspection too)vte_set_test_flags@Base 0.54.0 vte_terminal_copy_clipboard@Base 0 vte_terminal_copy_clipboard_format@Base 0.49.92 vte_terminal_copy_primary@Base 0 @@ -48,6 +49,7 @@ vte_terminal_get_char_height@Base 0 vte_terminal_get_char_width@Base 0 vte_terminal_get_cjk_ambiguous_width@Base 0 + vte_terminal_get_color_background_for_draw@Base 0.54.0 vte_terminal_get_column_count@Base 0 vte_terminal_get_current_directory_uri@Base 0 vte_terminal_get_current_file_uri@Base 0 @@ -141,3 +143,4 @@ vte_terminal_write_contents_sync@Base 0 vte_text_blink_mode_get_type@Base 0.51.90 vte_write_flags_get_type@Base 0 + (optional=template|regex)"_ZN.*@Base" 0 diff -Nru vte2.91-0.52.2/debian/patches/0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch vte2.91-0.54.0/debian/patches/0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch --- vte2.91-0.52.2/debian/patches/0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/patches/0001-Add-the-style-context-provider-with-FALLBACK-priorit.patch 2018-09-12 14:29:35.000000000 +0000 @@ -8,15 +8,17 @@ colours. This can be overridden by the theme. This reverts commit bd86e7637d89a55941674756e3e223c82aee2305. + +Bug-Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=740123 --- src/vtegtk.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/vtegtk.cc b/src/vtegtk.cc -index 516e042..fd3ea2b 100644 +index 89e3d7a..0e26909 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc -@@ -67,6 +67,7 @@ +@@ -68,6 +68,7 @@ struct _VteTerminalClassPrivate { GtkStyleProvider *style_provider; @@ -24,7 +26,7 @@ }; #ifdef VTE_DEBUG -@@ -382,6 +383,9 @@ vte_terminal_init(VteTerminal *terminal) +@@ -394,6 +395,9 @@ vte_terminal_init(VteTerminal *terminal) context = gtk_widget_get_style_context(&terminal->widget); gtk_style_context_add_provider (context, VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider, @@ -34,15 +36,15 @@ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); /* Initialize private data. NOTE: place is zeroed */ -@@ -416,6 +420,7 @@ vte_terminal_get_property (GObject *object, +@@ -442,6 +446,7 @@ vte_terminal_get_property (GObject *object, case PROP_HADJUSTMENT: - g_value_set_object (value, impl->m_hadjustment); + g_value_set_object (value, widget->get_hadjustment()); break; + case PROP_VADJUSTMENT: - g_value_set_object (value, impl->m_vadjustment); + g_value_set_object (value, widget->get_vadjustment()); break; -@@ -1645,6 +1650,7 @@ vte_terminal_class_init(VteTerminalClass *klass) +@@ -1669,6 +1674,7 @@ vte_terminal_class_init(VteTerminalClass *klass) klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, VTE_TYPE_TERMINAL, VteTerminalClassPrivate); klass->priv->style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); @@ -50,7 +52,7 @@ gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider), "VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n" "padding: 1px 1px 1px 1px;\n" -@@ -1653,6 +1659,11 @@ vte_terminal_class_init(VteTerminalClass *klass) +@@ -1677,6 +1683,11 @@ vte_terminal_class_init(VteTerminalClass *klass) "}\n", -1, NULL); diff -Nru vte2.91-0.52.2/debian/patches/01_scroll_notebook.patch vte2.91-0.54.0/debian/patches/01_scroll_notebook.patch --- vte2.91-0.52.2/debian/patches/01_scroll_notebook.patch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/patches/01_scroll_notebook.patch 2018-09-12 14:29:35.000000000 +0000 @@ -12,10 +12,10 @@ 1 file changed, 7 insertions(+) diff --git a/src/vte.cc b/src/vte.cc -index bc7ff14..aa41095 100644 +index 75f3299..97ec969 100644 --- a/src/vte.cc +++ b/src/vte.cc -@@ -10180,6 +10180,13 @@ VteTerminalPrivate::widget_scroll(GdkEventScroll *event) +@@ -9823,6 +9823,13 @@ Terminal::widget_scroll(GdkEventScroll *event) read_modifiers(base_event); diff -Nru vte2.91-0.52.2/debian/patches/91_keep_fds.patch vte2.91-0.54.0/debian/patches/91_keep_fds.patch --- vte2.91-0.52.2/debian/patches/91_keep_fds.patch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/patches/91_keep_fds.patch 2018-09-12 14:29:35.000000000 +0000 @@ -1,14 +1,18 @@ -Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=320128 -Description: Keep file descriptors open on vte_fork_pty(). +From: Ubuntu Developers +Date: Mon, 10 Sep 2018 09:30:52 -0500 +Subject: Keep file descriptors open on vte_fork_pty(). +Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=320128 https://launchpad.net/bugs/1756238 --- - src/pty.cc | 38 ++++++++++++++++++++++++++++++++++++++ + src/pty.cc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) +diff --git a/src/pty.cc b/src/pty.cc +index aa03c5a..8cc0ade 100644 --- a/src/pty.cc +++ b/src/pty.cc -@@ -87,6 +87,7 @@ typedef struct _VtePtyPrivate VtePtyPriv +@@ -87,6 +87,7 @@ typedef struct _VtePtyPrivate VtePtyPrivate; typedef struct { GSpawnChildSetupFunc extra_child_setup; gpointer extra_child_setup_data; diff -Nru vte2.91-0.52.2/debian/patches/pthread-vs-nostdlib.patch vte2.91-0.54.0/debian/patches/pthread-vs-nostdlib.patch --- vte2.91-0.52.2/debian/patches/pthread-vs-nostdlib.patch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/patches/pthread-vs-nostdlib.patch 2018-09-12 14:29:35.000000000 +0000 @@ -8,7 +8,7 @@ 1 file changed, 14 insertions(+) diff --git a/configure.ac b/configure.ac -index d2dcc92..9ce10e6 100644 +index 3d73a4a..56de0ea 100644 --- a/configure.ac +++ b/configure.ac @@ -242,6 +242,20 @@ fi diff -Nru vte2.91-0.52.2/debian/patches/revert-pcre2.patch vte2.91-0.54.0/debian/patches/revert-pcre2.patch --- vte2.91-0.52.2/debian/patches/revert-pcre2.patch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/patches/revert-pcre2.patch 2018-09-12 14:29:35.000000000 +0000 @@ -1,5 +1,5 @@ From: Egmont Koblinger -Date: Mon, 20 Feb 2017 17:49:25 -0500 +Date: Mon, 20 Feb 2017 23:49:25 +0100 Subject: Revert changes that require PCRE2 Bug-Ubuntu: https://launchpad.net/bugs/1636666 @@ -9,17 +9,17 @@ configure.ac | 23 ++- src/app/app.cc | 38 +++- src/vte.cc | 478 +++++++++++++++++++++++++++++++++++++++------- - src/vtegtk.cc | 89 +++++---- + src/vtegtk.cc | 83 ++++---- src/vteinternal.hh | 59 +++++- src/vteregex.cc | 158 +++++---------- src/vteregexinternal.hh | 10 +- - 9 files changed, 669 insertions(+), 241 deletions(-) + 9 files changed, 666 insertions(+), 238 deletions(-) -Index: b/bindings/vala/Makefile.am -=================================================================== +diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am +index 208d118..07ef304 100644 --- a/bindings/vala/Makefile.am +++ b/bindings/vala/Makefile.am -@@ -73,6 +73,10 @@ +@@ -73,6 +73,10 @@ if HAVE_GTK_3_16 app_valaflags += -D GTK_3_16 endif @@ -30,11 +30,11 @@ CLEANFILES += \ app.c \ appresources.c \ -Index: b/bindings/vala/app.vala -=================================================================== +diff --git a/bindings/vala/app.vala b/bindings/vala/app.vala +index 8663d63..c522d60 100644 --- a/bindings/vala/app.vala +++ b/bindings/vala/app.vala -@@ -36,8 +36,12 @@ +@@ -36,8 +36,12 @@ class SearchPopover : Gtk.Popover [GtkChild] private Gtk.Revealer revealer; private bool regex_caseless = false; @@ -48,7 +48,7 @@ public SearchPopover(Vte.Terminal term, Gtk.Widget relative_to) -@@ -69,7 +73,11 @@ +@@ -69,7 +73,11 @@ class SearchPopover : Gtk.Popover private bool have_regex() { @@ -61,7 +61,7 @@ } private void update_sensitivity() -@@ -85,14 +93,18 @@ +@@ -85,14 +93,18 @@ class SearchPopover : Gtk.Popover string search_text; string pattern = null; bool caseless = false; @@ -80,7 +80,7 @@ } else { pattern = GLib.Regex.escape_string(search_text); } -@@ -101,20 +113,25 @@ +@@ -101,20 +113,25 @@ class SearchPopover : Gtk.Popover pattern = "\\b" + pattern + "\\b"; if (caseless == regex_caseless && @@ -107,7 +107,7 @@ regex = new Vte.Regex.for_search(pattern, pattern.length, flags); try { -@@ -124,13 +141,16 @@ +@@ -124,13 +141,16 @@ class SearchPopover : Gtk.Popover if (e.code != -45 /* PCRE2_ERROR_JIT_BADOPTION */) /* JIT not supported */ printerr("JITing regex \"%s\" failed: %s\n", pattern, e.message); } @@ -127,7 +127,7 @@ gregex = new GLib.Regex(pattern, flags, 0); } -@@ -138,23 +158,26 @@ +@@ -138,23 +158,26 @@ class SearchPopover : Gtk.Popover regex_pattern = pattern; search_entry.set_tooltip_text(null); } catch (Error e) { @@ -159,7 +159,7 @@ update_sensitivity(); } -@@ -374,7 +397,7 @@ +@@ -374,7 +397,7 @@ class Window : Gtk.ApplicationWindow for (int i = 0; i < dingus.length; ++i) { try { int tag; @@ -168,7 +168,7 @@ if (!App.Options.no_pcre) { Vte.Regex regex; -@@ -389,7 +412,9 @@ +@@ -389,7 +412,9 @@ class Window : Gtk.ApplicationWindow } tag = terminal.match_add_regex(regex, 0); @@ -179,11 +179,11 @@ GLib.Regex regex; regex = new GLib.Regex(dingus[i], -Index: b/configure.ac -=================================================================== +diff --git a/configure.ac b/configure.ac +index 56de0ea..320cf3e 100644 --- a/configure.ac +++ b/configure.ac -@@ -283,6 +283,26 @@ +@@ -283,6 +283,26 @@ fi AM_CONDITIONAL([WITH_GNUTLS],[test "$with_gnutls" = "yes"]) @@ -210,7 +210,7 @@ # GLIB tools AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal]) -@@ -320,7 +340,7 @@ +@@ -320,7 +340,7 @@ AC_CHECK_FUNCS([ceil floor round]) # Search for the required modules. @@ -219,19 +219,19 @@ PKG_CHECK_MODULES([VTE],[$VTE_PKGS]) AC_SUBST([VTE_PKGS]) -@@ -475,6 +495,7 @@ - +@@ -489,6 +509,7 @@ cat < #include #include @@ -241,7 +241,7 @@ #include -@@ -57,7 +59,9 @@ +@@ -59,7 +61,9 @@ public: gboolean object_notifications{false}; gboolean reverse{false}; gboolean test_mode{false}; @@ -251,10 +251,10 @@ gboolean version{false}; gboolean whole_window_transparent{false}; bool bg_color_set{false}; -@@ -363,8 +367,10 @@ +@@ -367,8 +371,10 @@ public: "Specify a font to use", nullptr }, { "foreground-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_fg_color, - "Set default foreground color", nullptr }, + "Set default foreground color", "COLOR" }, +#ifdef WITH_PCRE2 { "gregex", 0, 0, G_OPTION_ARG_NONE, &use_gregex, "Use GRegex instead of PCRE2", nullptr }, @@ -262,7 +262,7 @@ { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, "Set the size (in characters) and position", "GEOMETRY" }, { "highlight-background-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_hl_bg_color, -@@ -513,6 +519,7 @@ +@@ -517,6 +523,7 @@ compile_gregex(char const* pattern, return g_regex_new(pattern, flags, GRegexMatchFlags(0), error); } @@ -270,7 +270,7 @@ static void jit_regex(VteRegex* regex, char const* pattern) -@@ -557,6 +564,7 @@ +@@ -561,6 +568,7 @@ compile_regex_for_match(char const* pattern, return regex; } @@ -278,7 +278,7 @@ /* search popover */ -@@ -644,17 +652,23 @@ +@@ -648,17 +656,23 @@ vteapp_search_popover_update_regex(VteappSearchPopover* popover) if (search_text[0] != '\0') { GError* error = nullptr; @@ -304,7 +304,7 @@ if (error == nullptr) { popover->has_regex = true; -@@ -970,20 +984,26 @@ +@@ -1005,20 +1019,26 @@ vteapp_window_add_dingus(VteappWindow* window, for (auto i = 0; dingus[i] != nullptr; i++) { int tag = -1; GError* error = nullptr; @@ -333,7 +333,7 @@ if (error != nullptr) { verbose_printerr("Failed to compile regex \"%s\": %s\n", dingus[i], error->message); -@@ -1431,20 +1451,26 @@ +@@ -1466,20 +1486,26 @@ vteapp_window_show_context_menu(VteappWindow* window, /* Test extra match API */ char* extra_match = nullptr; @@ -362,11 +362,11 @@ if (extra_match != nullptr) { verbose_print("\\d+ match: %s\n", extra_match); -Index: b/src/vte.cc -=================================================================== +diff --git a/src/vte.cc b/src/vte.cc +index 97ec969..5d693e6 100644 --- a/src/vte.cc +++ b/src/vte.cc -@@ -1057,10 +1057,14 @@ +@@ -906,10 +906,14 @@ regex_match_clear_cursor (struct vte_match_regex *regex) static void regex_and_flags_clear(struct vte_regex_and_flags *regex) { @@ -384,7 +384,7 @@ } static void -@@ -1156,6 +1160,9 @@ +@@ -999,6 +1003,9 @@ Terminal::regex_match_add(struct vte_match_regex *new_regex_match) struct vte_match_regex *regex_match; guint ret, len; @@ -394,7 +394,7 @@ /* Search for a hole. */ len = m_match_regexes->len; for (ret = 0; ret < len; ret++) { -@@ -1368,6 +1375,8 @@ +@@ -1211,6 +1218,8 @@ Terminal::match_rowcol_to_offset(vte::grid::column_t column, return true; } @@ -402,8 +402,8 @@ + /* creates a pcre match context with appropriate limits */ pcre2_match_context_8 * - VteTerminalPrivate::create_match_context() -@@ -1539,9 +1548,11 @@ + Terminal::create_match_context() +@@ -1382,9 +1391,11 @@ Terminal::match_check_internal_pcre(vte::grid::column_t column, continue; } @@ -417,23 +417,23 @@ sattr, eattr, offset, &dingu_match, start, end, -@@ -1586,6 +1597,180 @@ +@@ -1429,6 +1440,180 @@ Terminal::match_check_internal_pcre(vte::grid::column_t column, return dingu_match; } +#endif /* WITH_PCRE2 */ + +bool -+VteTerminalPrivate::match_check_gregex(GRegex *regex, -+ GRegexMatchFlags match_flags, -+ gsize sattr, -+ gsize eattr, -+ gsize offset, -+ char **result_ptr, -+ gsize *start, -+ gsize *end, -+ gsize *sblank_ptr, -+ gsize *eblank_ptr) ++Terminal::match_check_gregex(GRegex *regex, ++ GRegexMatchFlags match_flags, ++ gsize sattr, ++ gsize eattr, ++ gsize offset, ++ char **result_ptr, ++ gsize *start, ++ gsize *end, ++ gsize *sblank_ptr, ++ gsize *eblank_ptr) +{ + GMatchInfo *match_info; + const char *line; @@ -516,11 +516,11 @@ +} + +char * -+VteTerminalPrivate::match_check_internal_gregex(vte::grid::column_t column, -+ vte::grid::row_t row, -+ int *tag, -+ gsize *start, -+ gsize *end) ++Terminal::match_check_internal_gregex(vte::grid::column_t column, ++ vte::grid::row_t row, ++ int *tag, ++ gsize *start, ++ gsize *end) +{ + guint i; + struct vte_match_regex *regex = nullptr; @@ -598,7 +598,7 @@ /* * vte_terminal_match_check_internal: * @terminal: -@@ -1621,7 +1806,14 @@ +@@ -1464,7 +1649,14 @@ Terminal::match_check_internal(vte::grid::column_t column, *start = 0; *end = 0; @@ -614,7 +614,7 @@ } char * -@@ -1852,6 +2044,7 @@ +@@ -1701,6 +1893,7 @@ Terminal::regex_match_check_extra(GdkEvent *event, guint32 match_flags, char **matches) { @@ -622,21 +622,22 @@ gsize offset, sattr, eattr; pcre2_match_data_8 *match_data; pcre2_match_context_8 *match_context; -@@ -1901,6 +2094,58 @@ +@@ -1749,6 +1942,58 @@ Terminal::regex_match_check_extra(GdkEvent *event, + pcre2_match_data_free_8(match_data); pcre2_match_context_free_8(match_context); - return any_matches; ++ return any_matches; +#else + return false; +#endif +} + +bool -+VteTerminalPrivate::regex_match_check_extra(GdkEvent *event, -+ GRegex **regexes, -+ gsize n_regexes, -+ GRegexMatchFlags match_flags, -+ char **matches) ++Terminal::regex_match_check_extra(GdkEvent *event, ++ GRegex **regexes, ++ gsize n_regexes, ++ GRegexMatchFlags match_flags, ++ char **matches) +{ + gsize offset, sattr, eattr; + gboolean any_matches = FALSE; @@ -677,11 +678,10 @@ + matches[i] = nullptr; + } + -+ return any_matches; + return any_matches; } - /* Emit an adjustment changed signal on our adjustment object. */ -@@ -8163,6 +8408,7 @@ +@@ -8079,6 +8324,7 @@ Terminal::Terminal(vte::platform::Widget* w, save_cursor(&m_alternate_screen); /* Matching data. */ @@ -689,7 +689,7 @@ m_match_regexes = g_array_new(FALSE, TRUE, sizeof(struct vte_match_regex)); m_match_tag = -1; -@@ -8170,8 +8416,7 @@ +@@ -8086,8 +8332,7 @@ Terminal::Terminal(vte::platform::Widget* w, match_hilite_clear(); // FIXMEchpe unnecessary /* Search data */ @@ -699,16 +699,16 @@ /* Rendering data */ m_draw = _vte_draw_new(); -@@ -11278,6 +11523,8 @@ +@@ -10959,6 +11204,8 @@ Terminal::write_contents_sync (GOutputStream *stream, /* TODO Add properties & signals */ +#ifdef WITH_PCRE2 + /* - * VteTerminalPrivate::search_set_regex: + * Terminal::search_set_regex: * @regex: (allow-none): a #VteRegex, or %nullptr -@@ -11293,15 +11540,50 @@ +@@ -10974,15 +11221,50 @@ Terminal::search_set_regex (VteRegex *regex, rx = &m_search_regex; @@ -738,15 +738,15 @@ +#endif /* WITH_PCRE2 */ + +/* -+ * VteTerminalPrivate::search_set_gregex: ++ * Terminal::search_set_gregex: + * @gregex: (allow-none): a #GRegex, or %nullptr + * @gflags: flags from #GRegexMatchFlags + * + * Sets the #GRegex regex to search for. Unsets the search regex when passed %nullptr. + */ +bool -+VteTerminalPrivate::search_set_gregex(GRegex *gregex, -+ GRegexMatchFlags gflags) ++Terminal::search_set_gregex(GRegex *gregex, ++ GRegexMatchFlags gflags) +{ + struct vte_regex_and_flags *rx = &m_search_regex; + @@ -764,12 +764,12 @@ } invalidate_all(); -@@ -11320,8 +11602,11 @@ +@@ -11001,8 +11283,11 @@ Terminal::search_set_wrap_around(bool wrap) } bool --VteTerminalPrivate::search_rows(pcre2_match_context_8 *match_context, -+VteTerminalPrivate::search_rows( +-Terminal::search_rows(pcre2_match_context_8 *match_context, ++Terminal::search_rows( +#ifdef WITH_PCRE2 + pcre2_match_context_8 *match_context, pcre2_match_data_8 *match_data, @@ -777,7 +777,7 @@ vte::grid::row_t start_row, vte::grid::row_t end_row, bool backward) -@@ -11339,45 +11624,71 @@ +@@ -11020,45 +11305,71 @@ Terminal::search_rows(pcre2_match_context_8 *match_context, false /* include trailing whitespace */, /* FIXMEchpe maybe do include it since the match may depend on it? */ nullptr); @@ -817,12 +817,6 @@ + PCRE2_NO_UTF_CHECK | PCRE2_NOTEMPTY | PCRE2_PARTIAL_SOFT /* FIXME: HARD? */, + match_data, + match_context); -+ -+ if (r == PCRE2_ERROR_NOMATCH) -+ return false; -+ // FIXME: handle partial matches (PCRE2_ERROR_PARTIAL) -+ if (r < 0) -+ return false; - if (r == PCRE2_ERROR_NOMATCH) { - g_string_free (row_text, TRUE); @@ -833,10 +827,10 @@ - g_string_free (row_text, TRUE); - return false; - } -+ ovector = pcre2_get_ovector_pointer_8(match_data); -+ so = ovector[0]; -+ eo = ovector[1]; -+ if (G_UNLIKELY(so == PCRE2_UNSET || eo == PCRE2_UNSET)) ++ if (r == PCRE2_ERROR_NOMATCH) ++ return false; ++ // FIXME: handle partial matches (PCRE2_ERROR_PARTIAL) ++ if (r < 0) + return false; - ovector = pcre2_get_ovector_pointer_8(match_data); @@ -846,6 +840,12 @@ - g_string_free (row_text, TRUE); - return false; - } ++ ovector = pcre2_get_ovector_pointer_8(match_data); ++ so = ovector[0]; ++ eo = ovector[1]; ++ if (G_UNLIKELY(so == PCRE2_UNSET || eo == PCRE2_UNSET)) ++ return false; ++ + start = so; + end = eo; + } else @@ -853,7 +853,9 @@ + { + GMatchInfo *match_info; + GError *error = NULL; -+ + +- start = so; +- end = eo; + g_assert_cmpint(m_search_regex.mode, ==, VTE_REGEX_GREGEX); + + g_regex_match_full (m_search_regex.gregex.regex, row_text->str, row_text->len, 0, @@ -875,20 +877,18 @@ + + /* This gives us the offset in the buffer */ + g_match_info_fetch_pos (match_info, 0, &start, &end); - -- start = so; -- end = eo; ++ + g_match_info_free (match_info); + } /* Fetch text again, with attributes */ g_string_free(row_text, TRUE); -@@ -11416,8 +11727,11 @@ +@@ -11097,8 +11408,11 @@ Terminal::search_rows(pcre2_match_context_8 *match_context, } bool --VteTerminalPrivate::search_rows_iter(pcre2_match_context_8 *match_context, -+VteTerminalPrivate::search_rows_iter( +-Terminal::search_rows_iter(pcre2_match_context_8 *match_context, ++Terminal::search_rows_iter( +#ifdef WITH_PCRE2 + pcre2_match_context_8 *match_context, pcre2_match_data_8 *match_data, @@ -896,7 +896,7 @@ vte::grid::row_t start_row, vte::grid::row_t end_row, bool backward) -@@ -11435,8 +11749,11 @@ +@@ -11116,8 +11430,11 @@ Terminal::search_rows_iter(pcre2_match_context_8 *match_context, row = find_row_data(iter_start_row); } while (row && row->attr.soft_wrapped); @@ -910,7 +910,7 @@ return true; } } else { -@@ -11449,8 +11766,11 @@ +@@ -11130,8 +11447,11 @@ Terminal::search_rows_iter(pcre2_match_context_8 *match_context, iter_end_row++; } while (row && row->attr.soft_wrapped); @@ -924,7 +924,7 @@ return true; } } -@@ -11464,17 +11784,25 @@ +@@ -11145,17 +11465,25 @@ Terminal::search_find (bool backward) vte::grid::row_t buffer_start_row, buffer_end_row; vte::grid::row_t last_start_row, last_end_row; bool match_found = true; @@ -954,7 +954,7 @@ buffer_start_row = _vte_ring_delta (m_screen->row_data); buffer_end_row = _vte_ring_next (m_screen->row_data); -@@ -11492,12 +11820,18 @@ +@@ -11173,12 +11501,18 @@ Terminal::search_find (bool backward) /* If search fails, we make an empty selection at the last searched * position... */ if (backward) { @@ -977,7 +977,7 @@ goto found; if (m_has_selection) { if (m_search_wrap_around) -@@ -11507,12 +11841,18 @@ +@@ -11188,12 +11522,18 @@ Terminal::search_find (bool backward) } match_found = false; } else { @@ -1000,7 +1000,7 @@ goto found; if (m_has_selection) { if (m_search_wrap_around) -@@ -11525,8 +11865,12 @@ +@@ -11206,8 +11546,12 @@ Terminal::search_find (bool backward) found: @@ -1015,24 +1015,24 @@ return match_found; } -Index: b/src/vtegtk.cc -=================================================================== +diff --git a/src/vtegtk.cc b/src/vtegtk.cc +index 0e26909..45cf432 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc -@@ -1679,6 +1679,12 @@ +@@ -1711,6 +1711,12 @@ vte_get_features (void) + "+GNUTLS" #else "-GNUTLS" - #endif ++#endif + " " +#ifdef WITH_PCRE2 + "+PCRE2" +#else + "-PCRE2" -+#endif + #endif ; } - -@@ -1879,7 +1885,7 @@ +@@ -1927,7 +1933,7 @@ vte_terminal_paste_primary(VteTerminal *terminal) * this expression, the text will be highlighted. * * Returns: an integer associated with this expression, or -1 if @gregex could not be @@ -1041,7 +1041,7 @@ * * Deprecated: 0.46: Use vte_terminal_match_add_regex() or vte_terminal_match_add_regex_full() instead. */ -@@ -1888,16 +1894,24 @@ +@@ -1936,16 +1942,24 @@ vte_terminal_match_add_gregex(VteTerminal *terminal, GRegex *gregex, GRegexMatchFlags gflags) { @@ -1053,15 +1053,14 @@ - auto regex = _vte_regex_new_gregex(VteRegexPurpose::match, gregex); - if (regex == NULL) - return -1; -- ++ auto impl = IMPL(terminal); ++ /* Can't mix GRegex and PCRE2 */ ++ g_return_val_if_fail(impl->m_match_regex_mode != VTE_REGEX_PCRE2, -1); + - auto rv = vte_terminal_match_add_regex(terminal, regex, - _vte_regex_translate_gregex_match_flags(gflags)); - vte_regex_unref(regex); - return rv; -+ auto impl = IMPL(terminal); -+ /* Can't mix GRegex and PCRE2 */ -+ g_return_val_if_fail(impl->m_match_regex_mode != VTE_REGEX_PCRE2, -1); -+ + g_warn_if_fail(g_regex_get_compile_flags(gregex) & G_REGEX_MULTILINE); + + new_regex_match.regex.mode = VTE_REGEX_GREGEX; @@ -1074,7 +1073,7 @@ } /** -@@ -1924,12 +1938,14 @@ +@@ -1972,12 +1986,14 @@ vte_terminal_match_add_regex(VteTerminal *terminal, g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1); g_return_val_if_fail(regex != NULL, -1); g_return_val_if_fail(_vte_regex_has_purpose(regex, VteRegexPurpose::match), -1); @@ -1092,7 +1091,7 @@ new_regex_match.cursor_mode = VTE_REGEX_CURSOR_GDKCURSORTYPE; new_regex_match.cursor.cursor_type = VTE_DEFAULT_CURSOR; -@@ -2048,10 +2064,8 @@ +@@ -2096,10 +2112,8 @@ vte_terminal_event_check_regex_simple(VteTerminal *terminal, g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE); g_return_val_if_fail(event != NULL, FALSE); g_return_val_if_fail(regexes != NULL || n_regexes == 0, FALSE); @@ -1104,7 +1103,7 @@ g_return_val_if_fail(matches != NULL, FALSE); return IMPL(terminal)->regex_match_check_extra(event, regexes, n_regexes, match_flags, matches); -@@ -2066,9 +2080,12 @@ +@@ -2114,9 +2128,12 @@ vte_terminal_event_check_regex_simple(VteTerminal *terminal, * @match_flags: the #GRegexMatchFlags to use when matching the regexes * @matches: (out caller-allocates) (array length=n_regexes): a location to store the matches * @@ -1119,7 +1118,7 @@ * * Since: 0.44 * Deprecated: 0.46: Use vte_terminal_event_check_regex_simple() instead. -@@ -2086,7 +2103,7 @@ +@@ -2134,7 +2151,7 @@ vte_terminal_event_check_gregex_simple(VteTerminal *terminal, g_return_val_if_fail(regexes != NULL || n_regexes == 0, FALSE); g_return_val_if_fail(matches != NULL, FALSE); @@ -1128,7 +1127,7 @@ } /** -@@ -2183,7 +2200,7 @@ +@@ -2233,7 +2250,7 @@ vte_terminal_match_remove_all(VteTerminal *terminal) * @terminal: a #VteTerminal * * Searches the previous string matching the search regex set with @@ -1137,7 +1136,7 @@ * * Returns: %TRUE if a match was found */ -@@ -2199,7 +2216,7 @@ +@@ -2249,7 +2266,7 @@ vte_terminal_search_find_previous (VteTerminal *terminal) * @terminal: a #VteTerminal * * Searches the next string matching the search regex set with @@ -1146,7 +1145,7 @@ * * Returns: %TRUE if a match was found */ -@@ -2225,11 +2242,12 @@ +@@ -2275,11 +2292,12 @@ vte_terminal_search_set_regex (VteTerminal *terminal, VteRegex *regex, guint32 flags) { @@ -1161,7 +1160,7 @@ } /** -@@ -2246,7 +2264,10 @@ +@@ -2296,7 +2314,10 @@ vte_terminal_search_get_regex(VteTerminal *terminal) g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); auto impl = IMPL(terminal); @@ -1173,7 +1172,7 @@ } /** -@@ -2264,22 +2285,16 @@ +@@ -2314,22 +2335,16 @@ vte_terminal_search_set_gregex (VteTerminal *terminal, GRegex *gregex, GRegexMatchFlags gflags) { @@ -1199,7 +1198,7 @@ * * Deprecated: 0.46: use vte_terminal_search_get_regex() instead. */ -@@ -2288,7 +2303,11 @@ +@@ -2338,7 +2353,11 @@ vte_terminal_search_get_gregex (VteTerminal *terminal) { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); @@ -1212,13 +1211,13 @@ } /** -Index: b/src/vteinternal.hh -=================================================================== +diff --git a/src/vteinternal.hh b/src/vteinternal.hh +index 1652ca5..0f04223 100644 --- a/src/vteinternal.hh +++ b/src/vteinternal.hh -@@ -28,8 +28,16 @@ - #include "buffer.h" - #include "matcher.hh" +@@ -32,8 +32,16 @@ + #include "tabstops.hh" + #include "refptr.hh" +#ifdef WITH_PCRE2 #include "vtepcre2.h" @@ -1231,10 +1230,10 @@ + VTE_REGEX_GREGEX +} VteRegexMode; - typedef enum { - VTE_REGEX_CURSOR_GDKCURSOR, -@@ -48,8 +56,17 @@ - } MouseTrackingMode; + #include "chunk.hh" + #include "utf8.hh" +@@ -123,8 +131,17 @@ enum { + }; struct vte_regex_and_flags { - VteRegex *regex; @@ -1253,7 +1252,7 @@ }; /* A match regex, with a tag. */ -@@ -553,6 +570,7 @@ +@@ -506,6 +523,7 @@ public: /* State variables for handling match checks. */ char* m_match_contents; GArray* m_match_attributes; @@ -1261,7 +1260,7 @@ GArray* m_match_regexes; char* m_match; int m_match_tag; -@@ -1123,6 +1141,11 @@ +@@ -1065,6 +1083,11 @@ public: gsize n_regexes, guint32 match_flags, char **matches); @@ -1273,7 +1272,7 @@ int regex_match_add(struct vte_match_regex *new_regex_match); struct vte_match_regex *regex_match_get(int tag); -@@ -1144,7 +1167,7 @@ +@@ -1086,7 +1109,7 @@ public: gsize *offset_ptr, gsize *sattr_ptr, gsize *eattr_ptr); @@ -1282,7 +1281,7 @@ pcre2_match_context_8 *create_match_context(); bool match_check_pcre(pcre2_match_data_8 *match_data, pcre2_match_context_8 *match_context, -@@ -1163,6 +1186,22 @@ +@@ -1105,6 +1128,22 @@ public: int *tag, gsize *start, gsize *end); @@ -1305,7 +1304,7 @@ char *match_check_internal(vte::grid::column_t column, vte::grid::row_t row, -@@ -1184,16 +1223,26 @@ +@@ -1126,16 +1165,26 @@ public: void feed_focus_event_initial(); void maybe_feed_focus_event(bool in); @@ -1334,8 +1333,8 @@ vte::grid::row_t start_row, vte::grid::row_t end_row, bool backward); -Index: b/src/vteregex.cc -=================================================================== +diff --git a/src/vteregex.cc b/src/vteregex.cc +index d9c4841..672bf02 100644 --- a/src/vteregex.cc +++ b/src/vteregex.cc @@ -27,48 +27,32 @@ @@ -1399,7 +1398,7 @@ static VteRegex * regex_new(pcre2_code_8 *code, -@@ -104,6 +88,18 @@ +@@ -104,6 +88,18 @@ set_gerror_from_pcre_error(int errcode, return FALSE; } @@ -1418,7 +1417,7 @@ G_DEFINE_BOXED_TYPE(VteRegex, vte_regex, vte_regex_ref, (GBoxedFreeFunc)vte_regex_unref) -@@ -122,8 +118,9 @@ +@@ -122,8 +118,9 @@ vte_regex_ref(VteRegex *regex) { g_return_val_if_fail (regex, NULL); @@ -1429,7 +1428,7 @@ return regex; } -@@ -141,9 +138,10 @@ +@@ -141,9 +138,10 @@ vte_regex_unref(VteRegex *regex) { g_return_val_if_fail (regex, NULL); @@ -1441,7 +1440,7 @@ return NULL; } -@@ -154,6 +152,7 @@ +@@ -154,6 +152,7 @@ vte_regex_new(VteRegexPurpose purpose, guint32 flags, GError **error) { @@ -1449,7 +1448,7 @@ pcre2_code_8 *code; int r, errcode; guint32 v; -@@ -189,66 +188,10 @@ +@@ -189,66 +188,10 @@ vte_regex_new(VteRegexPurpose purpose, } return regex_new(code, purpose); @@ -1520,7 +1519,7 @@ } /** -@@ -329,6 +272,7 @@ +@@ -329,6 +272,7 @@ VteRegex * vte_regex_new_pcre(pcre2_code_8 *code, GError **error) { @@ -1528,7 +1527,7 @@ guint32 flags; g_return_val_if_fail(code != NULL, NULL); -@@ -339,6 +283,10 @@ +@@ -339,6 +283,10 @@ vte_regex_new_pcre(pcre2_code_8 *code, g_return_val_if_fail(flags & PCRE2_NEVER_BACKSLASH_C, NULL); return regex_new(code); @@ -1539,7 +1538,7 @@ } #endif -@@ -349,6 +297,7 @@ +@@ -349,6 +297,7 @@ _vte_regex_has_purpose(VteRegex *regex, return regex->purpose == purpose; } @@ -1547,7 +1546,7 @@ /* * _vte_regex_get_pcre: * @regex: a #VteRegex -@@ -359,10 +308,15 @@ +@@ -359,10 +308,15 @@ _vte_regex_has_purpose(VteRegex *regex, const pcre2_code_8 * _vte_regex_get_pcre(VteRegex *regex) { @@ -1563,7 +1562,7 @@ /** * vte_regex_jit: -@@ -377,6 +331,7 @@ +@@ -377,6 +331,7 @@ vte_regex_jit(VteRegex *regex, guint flags, GError **error) { @@ -1571,7 +1570,7 @@ int r; g_return_val_if_fail(regex != NULL, FALSE); -@@ -386,6 +341,9 @@ +@@ -386,6 +341,9 @@ vte_regex_jit(VteRegex *regex, return set_gerror_from_pcre_error(r, error); return TRUE; @@ -1581,7 +1580,7 @@ } /* -@@ -399,6 +357,7 @@ +@@ -399,6 +357,7 @@ vte_regex_jit(VteRegex *regex, gboolean _vte_regex_get_jited(VteRegex *regex) { @@ -1589,7 +1588,7 @@ PCRE2_SIZE s; int r; -@@ -407,20 +366,7 @@ +@@ -407,20 +366,7 @@ _vte_regex_get_jited(VteRegex *regex) r = pcre2_pattern_info_8(regex->code, PCRE2_INFO_JITSIZE, &s); return r == 0 && s != 0; @@ -1613,11 +1612,11 @@ + return FALSE; +#endif } -Index: b/src/vteregexinternal.hh -=================================================================== +diff --git a/src/vteregexinternal.hh b/src/vteregexinternal.hh +index 21f43f8..88fb848 100644 --- a/src/vteregexinternal.hh +++ b/src/vteregexinternal.hh -@@ -27,12 +27,6 @@ +@@ -27,12 +27,6 @@ gboolean _vte_regex_has_purpose(VteRegex *regex, gboolean _vte_regex_get_jited(VteRegex *regex); diff -Nru vte2.91-0.52.2/debian/watch vte2.91-0.54.0/debian/watch --- vte2.91-0.52.2/debian/watch 2018-05-30 12:09:28.000000000 +0000 +++ vte2.91-0.54.0/debian/watch 2018-09-12 14:29:35.000000000 +0000 @@ -1,3 +1,3 @@ version=4 -https://download.gnome.org/sources/vte/([\d\.]+[02468])/ \ +https://download.gnome.org/sources/vte/([\d\.]+)/ \ vte@ANY_VERSION@\.tar\.xz diff -Nru vte2.91-0.52.2/doc/Makefile.am vte2.91-0.54.0/doc/Makefile.am --- vte2.91-0.52.2/doc/Makefile.am 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/Makefile.am 2018-09-02 13:20:15.000000000 +0000 @@ -1,11 +1,10 @@ NULL = -SUBDIRS = reference openi18n +SUBDIRS = reference EXTRA_DIST = \ ambiguous.txt \ boxes.txt \ - readme.txt \ rewrap.txt \ $(NULL) diff -Nru vte2.91-0.52.2/doc/Makefile.in vte2.91-0.54.0/doc/Makefile.in --- vte2.91-0.52.2/doc/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/doc/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -252,7 +252,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -399,11 +399,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = -SUBDIRS = reference openi18n +SUBDIRS = reference EXTRA_DIST = \ ambiguous.txt \ boxes.txt \ - readme.txt \ rewrap.txt \ $(NULL) diff -Nru vte2.91-0.52.2/doc/openi18n/cursor.c vte2.91-0.54.0/doc/openi18n/cursor.c --- vte2.91-0.52.2/doc/openi18n/cursor.c 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/openi18n/cursor.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* cursor test for terminal emulator */ -/* - NOTE: This escape sequences come from vt100 - So it is very likey that this program doesn't work - on non vt100 compliant terminal emulator - */ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int c; - struct termios tty, tty_back; - - tcgetattr(STDIN_FILENO,&tty); - - tty_back = tty; - tty.c_lflag &= ~ICANON; - tty.c_lflag &= ~ECHO; - - tcsetattr(STDIN_FILENO,TCSANOW,&tty); - - while(1) - { - c = getchar(); - switch(c) - { - case 'h': - printf(""); - break; - case 'j': - printf(""); - break; - case 'k': - printf(""); - break; - case 'l': - printf(""); - break; - case 'q': - goto out; - break; - default: - /* do nothing */ - break; - } - fflush(stdout); - } - out: - tcsetattr(STDIN_FILENO,TCSANOW,&tty_back); - - printf(""); - printf(""); - fflush(stdout); - return 0; -} diff -Nru vte2.91-0.52.2/doc/openi18n/Makefile.am vte2.91-0.54.0/doc/openi18n/Makefile.am --- vte2.91-0.52.2/doc/openi18n/Makefile.am 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/openi18n/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -EXTRA_DIST = UTF-8.txt wrap.txt - -LIBS= -noinst_PROGRAMS = cursor -cursor_SOURCES = cursor.c - --include $(top_srcdir)/git.mk diff -Nru vte2.91-0.52.2/doc/openi18n/Makefile.in vte2.91-0.54.0/doc/openi18n/Makefile.in --- vte2.91-0.52.2/doc/openi18n/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/doc/openi18n/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,685 +0,0 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2017 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = cursor$(EXEEXT) -subdir = doc/openi18n -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_cursor_OBJECTS = cursor.$(OBJEXT) -cursor_OBJECTS = $(am_cursor_OBJECTS) -cursor_LDADD = $(LDADD) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(cursor_SOURCES) -DIST_SOURCES = $(cursor_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_CFLAGS = @AM_CFLAGS@ -AM_CPPFLAGS = @AM_CPPFLAGS@ -AM_CXXFLAGS = @AM_CXXFLAGS@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_LDFLAGS = @AM_LDFLAGS@ -APP_CFLAGS = @APP_CFLAGS@ -APP_LIBS = @APP_LIBS@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLADE_CATALOGUE_DIR = @GLADE_CATALOGUE_DIR@ -GLADE_ICON_DIR = @GLADE_ICON_DIR@ -GLADE_MODULE_DIR = @GLADE_MODULE_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GLIB_PREFIX = @GLIB_PREFIX@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ -GOBJECT_LIBS = @GOBJECT_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GTK_3_16_CFLAGS = @GTK_3_16_CFLAGS@ -GTK_3_16_LIBS = @GTK_3_16_LIBS@ -GTK_API_MAJOR_VERSION = @GTK_API_MAJOR_VERSION@ -GTK_API_MINOR_VERSION = @GTK_API_MINOR_VERSION@ -GTK_API_VERSION = @GTK_API_VERSION@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -LT_VERSION_INFO = @LT_VERSION_INFO@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -USE_NLS = @USE_NLS@ -VALAC = @VALAC@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -VTE_API_MAJOR_VERSION = @VTE_API_MAJOR_VERSION@ -VTE_API_MINOR_VERSION = @VTE_API_MINOR_VERSION@ -VTE_API_VERSION = @VTE_API_VERSION@ -VTE_API_VERSION_U = @VTE_API_VERSION_U@ -VTE_CFLAGS = @VTE_CFLAGS@ -VTE_CXXLDFLAGS = @VTE_CXXLDFLAGS@ -VTE_LDFLAGS = @VTE_LDFLAGS@ -VTE_LIBS = @VTE_LIBS@ -VTE_MAJOR_VERSION = @VTE_MAJOR_VERSION@ -VTE_MICRO_VERSION = @VTE_MICRO_VERSION@ -VTE_MINOR_VERSION = @VTE_MINOR_VERSION@ -VTE_PKGS = @VTE_PKGS@ -XGETTEXT = @XGETTEXT@ -XMLLINT = @XMLLINT@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = UTF-8.txt wrap.txt -cursor_SOURCES = cursor.c -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/openi18n/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign doc/openi18n/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -cursor$(EXEEXT): $(cursor_OBJECTS) $(cursor_DEPENDENCIES) $(EXTRA_cursor_DEPENDENCIES) - @rm -f cursor$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(cursor_OBJECTS) $(cursor_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - --include $(top_srcdir)/git.mk - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru vte2.91-0.52.2/doc/openi18n/UTF-8.txt vte2.91-0.54.0/doc/openi18n/UTF-8.txt --- vte2.91-0.52.2/doc/openi18n/UTF-8.txt 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/openi18n/UTF-8.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -02: LATIN-1 SUPPLEMENT (0x00A0 - 0x00FF) | ¥µÅ -04: LATIN EXTENDED-B (0x0180 - 0x024F) | ƅƕƥ -05: IPA EXTENSIONS (0x0250 - 0x02AF) | ɕɥɵ -08: BASIC GREEK (0x0370 - 0x03CF) | ͵΅Ε -10: CYRILLIC (0x0400 - 0x04FF) | Ѕҵӕ -11: ARMENIAN (0x0530 - 0x058F) | ԵՅՕ -27: BASIC GEORGIAN (0x10D0 - 0x10FF) | ვქჵ -30: LATIN EXTENDED ADDITIONAL (0x1E00 - 0x1EFF)| ḅḕḥ -31: GREEK EXTENDED (0x1F00 - 0x1FFF) | ἅἕἥ -34: CURRENCY SYMBOLS (0x20A0 - 0x20CF) | ₠₤€ -36: LETTERLIKE SYMBOLS (0x2100 - 0x214F) | ℅℈↠ -38: ARROWS (0x2190 - 0x21FF) | ↕↥↵ -39: MATHEMATICAL OPERATORS (0x2200 - 0x22FF) | ∅∕∥ -40: MISCELLANEOUS TECHNICAL (0x2300 - 0x23FF) | ⌅⌕⌥ -44: BOX DRAWING (0x2500 - 0x257F) | ┅┕┥ -50: HIRAGANA (0x3040 - 0x309F) | ぅさづ -60: CJK UNIFIED IDEOGRAPHS (0x4E00 - 0x9FFF) | 严弥漥 -71: HANGUL EXTENDED (0xAC00 - 0xD7A3) | 갅강갥 diff -Nru vte2.91-0.52.2/doc/openi18n/wrap.txt vte2.91-0.54.0/doc/openi18n/wrap.txt --- vte2.91-0.52.2/doc/openi18n/wrap.txt 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/openi18n/wrap.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -123456789|123456789|123456789|123456789|123456789|123456789|123456789|123456789あ diff -Nru vte2.91-0.52.2/doc/readme.txt vte2.91-0.54.0/doc/readme.txt --- vte2.91-0.52.2/doc/readme.txt 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/readme.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -ctlseqs.ms From the xterm source tree [1]. -vttest.tar.gz From Thomas E. Dickey's site [2]. -openi18n/ From the Openi18n web site [3]. -rfc/ From the IETF web site [4]. - -[0] http://www.invisible-island.net/xterm/ -[1] ftp://invisible-island.net/xterm/xterm.tar.gz -[2] http://www.invisible-island.net/vttest/vttest.html -[3] http://www.openi18n.org/subgroups/testsuites/interactive/terminal-tests/terminal-emulator-test-scenario.html -[4] http://www.ietf.org/ diff -Nru vte2.91-0.52.2/doc/reference/html/annotation-glossary.html vte2.91-0.54.0/doc/reference/html/annotation-glossary.html --- vte2.91-0.52.2/doc/reference/html/annotation-glossary.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/annotation-glossary.html 2018-09-02 13:25:12.000000000 +0000 @@ -6,7 +6,7 @@ - + @@ -21,6 +21,8 @@  |  E  |  + N +  |  O  |  S @@ -28,7 +30,7 @@ T Home -Prev +Prev Next
@@ -50,6 +52,9 @@

E

element-type

Generics and defining elements of containers and arrays.

+

N

+
nullable
+

NULL may be passed as the value in, out, in-out; or as a return value.

O

out

Parameter for returning results. Default is transfer full.

diff -Nru vte2.91-0.52.2/doc/reference/html/api-index-0-52.html vte2.91-0.54.0/doc/reference/html/api-index-0-52.html --- vte2.91-0.52.2/doc/reference/html/api-index-0-52.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/api-index-0-52.html 2018-09-02 13:25:12.000000000 +0000 @@ -7,7 +7,7 @@ - + @@ -17,7 +17,7 @@ Home Prev -Next +Next

diff -Nru vte2.91-0.52.2/doc/reference/html/api-index-0-54.html vte2.91-0.54.0/doc/reference/html/api-index-0-54.html --- vte2.91-0.52.2/doc/reference/html/api-index-0-54.html 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/api-index-0-54.html 2018-09-02 13:25:12.000000000 +0000 @@ -0,0 +1,34 @@ + + + + +Index of new symbols in 0.54: VTE Reference Manual + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.54

+

T

+
+vte_terminal_get_color_background_for_draw, function in VteTerminal +
+
+
+ + + \ No newline at end of file diff -Nru vte2.91-0.52.2/doc/reference/html/api-index-deprecated.html vte2.91-0.54.0/doc/reference/html/api-index-deprecated.html --- vte2.91-0.52.2/doc/reference/html/api-index-deprecated.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/api-index-deprecated.html 2018-09-02 13:25:12.000000000 +0000 @@ -31,6 +31,18 @@

T

+VteTerminal::icon-title-changed, object signal in VteTerminal +
+
+
+VteTerminal:encoding, object property in VteTerminal +
+
+
+VteTerminal:icon-title, object property in VteTerminal +
+
+
vte_terminal_copy_clipboard, function in VteTerminal
@@ -39,10 +51,18 @@
+vte_terminal_get_encoding, function in VteTerminal +
+
+
vte_terminal_get_geometry_hints, function in VteTerminal
+vte_terminal_get_icon_title, function in VteTerminal +
+
+
vte_terminal_match_add_gregex, function in VteTerminal
@@ -55,6 +75,10 @@
+vte_terminal_match_set_cursor_type, function in VteTerminal +
+
+
vte_terminal_search_get_gregex, function in VteTerminal
@@ -63,6 +87,10 @@
+vte_terminal_set_encoding, function in VteTerminal +
+
+
vte_terminal_set_geometry_hints_for_window, function in VteTerminal
diff -Nru vte2.91-0.52.2/doc/reference/html/api-index-full.html vte2.91-0.54.0/doc/reference/html/api-index-full.html --- vte2.91-0.52.2/doc/reference/html/api-index-full.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/api-index-full.html 2018-09-02 13:25:12.000000000 +0000 @@ -502,6 +502,10 @@
+vte_terminal_get_color_background_for_draw, function in VteTerminal +
+
+
vte_terminal_get_column_count, function in VteTerminal
diff -Nru vte2.91-0.52.2/doc/reference/html/index.html vte2.91-0.54.0/doc/reference/html/index.html --- vte2.91-0.52.2/doc/reference/html/index.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/index.html 2018-09-02 13:25:12.000000000 +0000 @@ -15,7 +15,7 @@

- Documentation for VTE version 0.52.2 + Documentation for VTE version 0.54.0 . The latest version of this documentation can be found on-line at the GNOME Library. @@ -75,6 +75,7 @@

Index of new symbols in 0.48
Index of new symbols in 0.50
Index of new symbols in 0.52
+
Index of new symbols in 0.54
Annotation Glossary
A. Licence
diff -Nru vte2.91-0.52.2/doc/reference/html/vte.devhelp2 vte2.91-0.54.0/doc/reference/html/vte.devhelp2 --- vte2.91-0.52.2/doc/reference/html/vte.devhelp2 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/vte.devhelp2 2018-09-02 13:25:12.000000000 +0000 @@ -24,6 +24,7 @@ + @@ -95,12 +96,9 @@ - - - @@ -122,16 +120,17 @@ + - - + + @@ -139,6 +138,9 @@ + + + diff -Nru vte2.91-0.52.2/doc/reference/html/VteTerminal.html vte2.91-0.54.0/doc/reference/html/VteTerminal.html --- vte2.91-0.52.2/doc/reference/html/VteTerminal.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/VteTerminal.html 2018-09-02 13:25:12.000000000 +0000 @@ -583,14 +583,6 @@ void -vte_terminal_match_set_cursor_type () - - - - -void - - vte_terminal_match_set_cursor_name () @@ -612,21 +604,6 @@ -gboolean - - -vte_terminal_set_encoding () - - - -const char * - - -vte_terminal_get_encoding () - - - - void @@ -793,10 +770,10 @@ -glong +void -vte_terminal_get_char_height () +vte_terminal_get_color_background_for_draw () @@ -804,7 +781,7 @@ glong -vte_terminal_get_char_width () +vte_terminal_get_char_height () @@ -812,14 +789,15 @@ glong -vte_terminal_get_column_count () +vte_terminal_get_char_width () -const char * + +glong -vte_terminal_get_icon_title () +vte_terminal_get_column_count () @@ -869,6 +847,14 @@ +void + + +vte_terminal_match_set_cursor_type () + + + + int @@ -923,6 +909,28 @@ vte_terminal_set_geometry_hints_for_window () + +const char * + + +vte_terminal_get_icon_title () + + + + +gboolean + + +vte_terminal_set_encoding () + + + +const char * + + +vte_terminal_get_encoding () + +
@@ -1581,8 +1589,7 @@
void
 vte_terminal_paste_clipboard (VteTerminal *terminal);

Sends the contents of the GDK_SELECTION_CLIPBOARD selection to the -terminal's child. If necessary, the data is converted from UTF-8 to the -terminal's current encoding. It's called on paste menu item, or when +terminal's child. It's called on paste menu item, or when user presses Shift+Insert.

Parameters

@@ -1629,8 +1636,7 @@
void
 vte_terminal_paste_primary (VteTerminal *terminal);

Sends the contents of the GDK_SELECTION_PRIMARY selection to the terminal's -child. If necessary, the data is converted from UTF-8 to the terminal's -current encoding. The terminal will call also paste the +child. The terminal will call also paste the GDK_SELECTION_PRIMARY selection when the user clicks with the the second mouse button.

@@ -3559,44 +3565,6 @@

-

vte_terminal_match_set_cursor_type ()

-
void
-vte_terminal_match_set_cursor_type (VteTerminal *terminal,
-                                    int tag,
-                                    GdkCursorType cursor_type);
-

Sets which cursor the terminal will use if the pointer is over the pattern -specified by tag -.

-
-

Parameters

-
----- - - - - - - - - - - - - - - - - - -

terminal

a VteTerminal

 

tag

the tag of the regex which should use the specified cursor

 

cursor_type

a GdkCursorType

 
-
-
-
-

vte_terminal_match_set_cursor_name ()

void
 vte_terminal_match_set_cursor_name (VteTerminal *terminal,
@@ -3639,9 +3607,10 @@
 
void
 vte_terminal_set_cjk_ambiguous_width (VteTerminal *terminal,
                                       int width);
-

This setting controls whether ambiguous-width characters are narrow or wide -when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, -the width of ambiguous-width characters is fixed.

+

This setting controls whether ambiguous-width characters are narrow or wide. +(Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), +the width of ambiguous-width characters is fixed and determined by the encoding +itself.)

Parameters

@@ -3670,8 +3639,10 @@

vte_terminal_get_cjk_ambiguous_width ()

int
 vte_terminal_get_cjk_ambiguous_width (VteTerminal *terminal);
-

Returns whether ambiguous-width characters are narrow or wide when using -the UTF-8 encoding (vte_terminal_set_encoding()).

+

Returns whether ambiguous-width characters are narrow or wide. +(Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), +the width of ambiguous-width characters is fixed and determined by the encoding +itself.)

Parameters

@@ -3694,79 +3665,6 @@
-

vte_terminal_set_encoding ()

-
gboolean
-vte_terminal_set_encoding (VteTerminal *terminal,
-                           const char *codeset,
-                           GError **error);
-

Changes the encoding the terminal will expect data from the child to -be encoded with. For certain terminal types, applications executing in the -terminal can change the encoding. If codeset - is NULL, it uses "UTF-8".

-
-

Parameters

-
----- - - - - - - - - - - - - - - - - - -

terminal

a VteTerminal

 

codeset

a valid GIConv target, or NULL to use UTF-8.

[allow-none]

error

return location for a GError, or NULL.

[allow-none]
-
-
-

Returns

-

TRUE if the encoding could be changed to the specified one, -or FALSE with error -set to G_CONVERT_ERROR_NO_CONVERSION.

-
-
-
-
-

vte_terminal_get_encoding ()

-
const char *
-vte_terminal_get_encoding (VteTerminal *terminal);
-

Determines the name of the encoding in which the terminal expects data to be -encoded.

-
-

Parameters

-
----- - - - - - -

terminal

a VteTerminal

 
-
-
-

Returns

-

the current encoding for the terminal.

-

[transfer none]

-
-
-
-

vte_terminal_set_word_char_exceptions ()

void
 vte_terminal_set_word_char_exceptions (VteTerminal *terminal,
@@ -3832,7 +3730,7 @@
 

Returns

a string, or NULL.

-

[transfer none]

+

[nullable][transfer none]

Since: 0.40

@@ -4580,6 +4478,46 @@

+

vte_terminal_get_color_background_for_draw ()

+
void
+vte_terminal_get_color_background_for_draw
+                               (VteTerminal *terminal,
+                                GdkRGBA *color);
+

Returns the background colour, as used by terminal + when +drawing the background, which may be different from +the color set by vte_terminal_set_color_background().

+

Note: you must only call this function while handling the +GtkWidget::draw signal.

+

This function is rarely useful. One use for it is if you disable +drawing the background (see vte_terminal_set_clear_background()) +and then need to draw the background yourself.

+
+

Parameters

+
+++++ + + + + + + + + + + + + +

terminal

a VteTerminal

 

color

a location to store a GdbRGBA color.

[out]
+
+

Since: 0.54

+
+
+

vte_terminal_get_char_height ()

glong
 vte_terminal_get_char_height (VteTerminal *terminal);
@@ -4659,32 +4597,6 @@

-

vte_terminal_get_icon_title ()

-
const char *
-vte_terminal_get_icon_title (VteTerminal *terminal);
-
-

Parameters

-
----- - - - - - -

terminal

a VteTerminal

 
-
-
-

Returns

-

the icon title.

-

[transfer none]

-
-
-
-

vte_terminal_get_row_count ()

glong
 vte_terminal_get_row_count (VteTerminal *terminal);
@@ -4730,8 +4642,8 @@

Returns

-

the window title.

-

[transfer none]

+

the window title, or NULL.

+

[nullable][transfer none]


@@ -4759,7 +4671,7 @@

Returns

the URI of the current directory of the process running in the terminal, or NULL.

-

[transfer none]

+

[nullable][transfer none]


@@ -4787,7 +4699,7 @@

the URI of the current file the process running in the terminal is operating on, or NULL if not set.

-

[transfer none]

+

[nullable][transfer none]


@@ -4827,7 +4739,7 @@ GdkCursor *cursor);

vte_terminal_match_set_cursor has been deprecated since version 0.40 and should not be used in newly-written code.

-

Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead.

+

Use vte_terminal_match_set_cursor_name() instead.

Sets which cursor the terminal will use if the pointer is over the pattern specified by tag @@ -4864,6 +4776,48 @@


+

vte_terminal_match_set_cursor_type ()

+
void
+vte_terminal_match_set_cursor_type (VteTerminal *terminal,
+                                    int tag,
+                                    GdkCursorType cursor_type);
+
+

vte_terminal_match_set_cursor_type has been deprecated since version 0.54 and should not be used in newly-written code.

+

Use vte_terminal_match_set_cursor_name() instead.

+
+

Sets which cursor the terminal will use if the pointer is over the pattern +specified by tag +.

+
+

Parameters

+
+++++ + + + + + + + + + + + + + + + + + +

terminal

a VteTerminal

 

tag

the tag of the regex which should use the specified cursor

 

cursor_type

a GdkCursorType

 
+
+
+
+

vte_terminal_match_add_gregex ()

int
 vte_terminal_match_add_gregex (VteTerminal *terminal,
@@ -5250,6 +5204,117 @@
 
+
+
+

vte_terminal_get_icon_title ()

+
const char *
+vte_terminal_get_icon_title (VteTerminal *terminal);
+

vte_terminal_get_icon_title has been deprecated since version 0.54 and should not be used in newly-written code.

+
+

Parameters

+
+++++ + + + + + +

terminal

a VteTerminal

 
+
+
+

Returns

+

NULL.

+

[nullable][transfer none]

+
+
+
+
+

vte_terminal_set_encoding ()

+
gboolean
+vte_terminal_set_encoding (VteTerminal *terminal,
+                           const char *codeset,
+                           GError **error);
+
+

vte_terminal_set_encoding has been deprecated since version 0.54 and should not be used in newly-written code.

+

Support for non-UTF-8 is deprecated.

+
+

Changes the encoding the terminal will expect data from the child to +be encoded with. For certain terminal types, applications executing in the +terminal can change the encoding. If codeset + is NULL, it uses "UTF-8".

+

Note: Support for non-UTF-8 is deprecated and may get removed altogether. +Instead of this function, you should use a wrapper like luit(1) when +spawning the child process.

+
+

Parameters

+
+++++ + + + + + + + + + + + + + + + + + +

terminal

a VteTerminal

 

codeset

a valid GIConv target, or NULL to use UTF-8.

[allow-none]

error

return location for a GError, or NULL.

[allow-none]
+
+
+

Returns

+

TRUE if the encoding could be changed to the specified one, +or FALSE with error +set to G_CONVERT_ERROR_NO_CONVERSION.

+
+
+
+
+

vte_terminal_get_encoding ()

+
const char *
+vte_terminal_get_encoding (VteTerminal *terminal);
+
+

vte_terminal_get_encoding has been deprecated since version 0.54 and should not be used in newly-written code.

+

Support for non-UTF-8 is deprecated.

+
+

Determines the name of the encoding in which the terminal expects data to be +encoded, or NULL if UTF-8 is in use.

+
+

Parameters

+
+++++ + + + + + +

terminal

a VteTerminal

 
+
+
+

Returns

+

the current encoding for the terminal.

+

[nullable][transfer none]

+
+

Types and Values

@@ -5568,9 +5633,10 @@

The “cjk-ambiguous-width” property

  “cjk-ambiguous-width”      gint
-

This setting controls whether ambiguous-width characters are narrow or wide -when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, -the width of ambiguous-width characters is fixed.

+

This setting controls whether ambiguous-width characters are narrow or wide. +(Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), +the width of ambiguous-width characters is fixed and determined by the encoding +itself.)

This setting only takes effect the next time the terminal is reset, either via escape sequence or with vte_terminal_reset().

Flags: Read / Write

@@ -5627,6 +5693,11 @@ be encoded with. For certain terminal types, applications executing in the terminal can change the encoding. The default is defined by the application's locale settings.

+
+

VteTerminal:encoding has been deprecated since version 0.54 and should not be used in newly-written code.

+

Instead of using this, you should use a tool like + luit(1) when support for non-UTF-8 is required

+

Flags: Read / Write

Default value: NULL

@@ -5663,7 +5734,10 @@

The “icon-title” property

  “icon-title”               gchar *
-

The terminal's so-called icon title, or NULL if no icon title has been set.

+
+

VteTerminal:icon-title has been deprecated since version 0.54 and should not be used in newly-written code.

+

This property is always NULL.

+

Flags: Read

Default value: NULL

@@ -6151,9 +6225,8 @@
void
 user_function (VteTerminal *vteterminal,
                gpointer     user_data)
-

Emitted whenever the terminal's current encoding has changed, either -as a result of receiving a control sequence which toggled between the -local and UTF-8 encodings, or at the parent application's request.

+

Emitted whenever the terminal's current encoding has changed.

+

Note: support for non-UTF-8 is deprecated.

Parameters

@@ -6267,7 +6340,10 @@
void
 user_function (VteTerminal *vteterminal,
                gpointer     user_data)
-

Emitted when the terminal's icon_title field is modified.

+
+

VteTerminal::icon-title-changed has been deprecated since version 0.54 and should not be used in newly-written code.

+

This signal is never emitted.

+

Parameters

diff -Nru vte2.91-0.52.2/doc/reference/html/vte-Version-Information.html vte2.91-0.54.0/doc/reference/html/vte-Version-Information.html --- vte2.91-0.52.2/doc/reference/html/vte-Version-Information.html 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/html/vte-Version-Information.html 2018-09-02 13:25:12.000000000 +0000 @@ -193,7 +193,7 @@

VTE_MINOR_VERSION

-
#define VTE_MINOR_VERSION (52)
+
#define VTE_MINOR_VERSION (54)
 

The minor version number of the VTE library (e.g. in version 3.1.4 this is 1).

@@ -201,7 +201,7 @@

VTE_MICRO_VERSION

-
#define VTE_MICRO_VERSION (2)
+
#define VTE_MICRO_VERSION (0)
 

The micro version number of the VTE library (e.g. in version 3.1.4 this is 4).

diff -Nru vte2.91-0.52.2/doc/reference/Makefile.am vte2.91-0.54.0/doc/reference/Makefile.am --- vte2.91-0.52.2/doc/reference/Makefile.am 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/Makefile.am 2018-09-02 13:20:15.000000000 +0000 @@ -79,25 +79,37 @@ config.h \ buffer.h \ caps.hh \ - caps-list.hh \ + cell.hh \ debug.h \ iso2022.h \ keymap.h \ marshal.h \ - matcher.hh \ - ring.h \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + parser.hh \ + parser-arg.hh \ + parser-c01.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + ring.hh \ stamp-vtetypebuiltins.h \ - table.hh \ - trie.h \ + tabstops.hh \ vteconv.h \ vtedraw.h \ vteinternal.hh \ - vterowdata.h \ - vteseq-list.h \ + vterowdata.hh \ vtestream-base.h \ vtestream-file.h \ vtestream.h \ - vtetc.h \ vteunistr.h \ vteunistr.h diff -Nru vte2.91-0.52.2/doc/reference/Makefile.in vte2.91-0.54.0/doc/reference/Makefile.in --- vte2.91-0.52.2/doc/reference/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -217,7 +217,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -447,25 +447,37 @@ config.h \ buffer.h \ caps.hh \ - caps-list.hh \ + cell.hh \ debug.h \ iso2022.h \ keymap.h \ marshal.h \ - matcher.hh \ - ring.h \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + parser.hh \ + parser-arg.hh \ + parser-c01.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + ring.hh \ stamp-vtetypebuiltins.h \ - table.hh \ - trie.h \ + tabstops.hh \ vteconv.h \ vtedraw.h \ vteinternal.hh \ - vterowdata.h \ - vteseq-list.h \ + vterowdata.hh \ vtestream-base.h \ vtestream-file.h \ vtestream.h \ - vtetc.h \ vteunistr.h \ vteunistr.h diff -Nru vte2.91-0.52.2/doc/reference/version.xml vte2.91-0.54.0/doc/reference/version.xml --- vte2.91-0.52.2/doc/reference/version.xml 2018-05-21 19:32:30.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/version.xml 2018-09-02 13:20:57.000000000 +0000 @@ -1 +1 @@ -0.52.2 +0.54.0 diff -Nru vte2.91-0.52.2/doc/reference/vte-docs.xml vte2.91-0.54.0/doc/reference/vte-docs.xml --- vte2.91-0.52.2/doc/reference/vte-docs.xml 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/vte-docs.xml 2018-09-02 13:20:15.000000000 +0000 @@ -110,6 +110,10 @@ Index of new symbols in 0.52 + + Index of new symbols in 0.54 + + diff -Nru vte2.91-0.52.2/doc/reference/vte-sections.txt vte2.91-0.54.0/doc/reference/vte-sections.txt --- vte2.91-0.52.2/doc/reference/vte-sections.txt 2018-05-21 19:36:44.000000000 +0000 +++ vte2.91-0.54.0/doc/reference/vte-sections.txt 2018-09-02 13:25:12.000000000 +0000 @@ -75,12 +75,9 @@ vte_terminal_match_remove_all vte_terminal_match_check vte_terminal_match_check_event -vte_terminal_match_set_cursor_type vte_terminal_match_set_cursor_name vte_terminal_set_cjk_ambiguous_width vte_terminal_get_cjk_ambiguous_width -vte_terminal_set_encoding -vte_terminal_get_encoding vte_terminal_set_word_char_exceptions vte_terminal_get_word_char_exceptions vte_terminal_set_input_enabled @@ -108,6 +105,7 @@ vte_terminal_set_clear_background +vte_terminal_get_color_background_for_draw VTE_TYPE_CURSOR_BLINK_MODE @@ -134,7 +132,6 @@ vte_terminal_get_char_height vte_terminal_get_char_width vte_terminal_get_column_count -vte_terminal_get_icon_title vte_terminal_get_row_count vte_terminal_get_window_title vte_terminal_get_current_directory_uri @@ -143,6 +140,7 @@ vte_terminal_copy_clipboard vte_terminal_match_set_cursor +vte_terminal_match_set_cursor_type vte_terminal_match_add_gregex vte_terminal_search_get_gregex vte_terminal_search_set_gregex @@ -150,6 +148,9 @@ vte_terminal_spawn_sync vte_terminal_get_geometry_hints vte_terminal_set_geometry_hints_for_window +vte_terminal_get_icon_title +vte_terminal_set_encoding +vte_terminal_get_encoding VteCharAttributes diff -Nru vte2.91-0.52.2/glade/Makefile.in vte2.91-0.54.0/glade/Makefile.in --- vte2.91-0.52.2/glade/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/glade/Makefile.in 2018-09-02 13:20:47.000000000 +0000 @@ -222,7 +222,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/HACKING vte2.91-0.54.0/HACKING --- vte2.91-0.52.2/HACKING 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/HACKING 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -This entire tree is "some highly unsupported crackrock", though we are -cleaning it as fast as possible and aiming for a 1.0 release "next year". -Please contact people listed in filed MAINTAINERS if you intend to hack -on it, especially if you want to commit stuff. - -This is the most useful resource in understanding various internal states -as well as control sequences: - - http://invisible-island.net/xterm/ctlseqs/ctlseqs.html - -And to understand termcap, terminfo, etc, "man 5 terminfo" is a great start. diff -Nru vte2.91-0.52.2/m4/ax_cxx_compile_stdcxx.m4 vte2.91-0.54.0/m4/ax_cxx_compile_stdcxx.m4 --- vte2.91-0.52.2/m4/ax_cxx_compile_stdcxx.m4 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/m4/ax_cxx_compile_stdcxx.m4 2018-09-02 13:20:15.000000000 +0000 @@ -40,12 +40,11 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). -AX_REQUIRE_DEFINED([AC_MSG_WARN]) AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], @@ -139,7 +138,6 @@ [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) - m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])]) ]) diff -Nru vte2.91-0.52.2/Makefile.am vte2.91-0.54.0/Makefile.am --- vte2.91-0.52.2/Makefile.am 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/Makefile.am 2018-09-02 13:20:15.000000000 +0000 @@ -5,7 +5,9 @@ SUBDIRS = src bindings po doc perf EXTRA_DIST = \ - HACKING \ + COPYING.GPL3 \ + COPYING.LGPL2 \ + COPYING.LGPL3 \ autogen.sh \ ChangeLog.pre-git \ $(NULL) diff -Nru vte2.91-0.52.2/Makefile.in vte2.91-0.54.0/Makefile.in --- vte2.91-0.52.2/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/Makefile.in 2018-09-02 13:20:46.000000000 +0000 @@ -195,8 +195,8 @@ DIST_SUBDIRS = src bindings po doc perf glade am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/vte.pc.in $(top_srcdir)/src/vte/vteversion.h.in \ - AUTHORS COPYING ChangeLog NEWS README compile config.guess \ - config.sub install-sh ltmain.sh missing + AUTHORS ChangeLog NEWS compile config.guess config.sub \ + install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -307,7 +307,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -457,7 +457,9 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src bindings po doc perf $(am__append_1) EXTRA_DIST = \ - HACKING \ + COPYING.GPL3 \ + COPYING.LGPL2 \ + COPYING.LGPL3 \ autogen.sh \ ChangeLog.pre-git \ $(NULL) diff -Nru vte2.91-0.52.2/perf/Makefile.in vte2.91-0.54.0/perf/Makefile.in --- vte2.91-0.52.2/perf/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/perf/Makefile.in 2018-09-02 13:20:47.000000000 +0000 @@ -192,7 +192,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/po/cs.po vte2.91-0.54.0/po/cs.po --- vte2.91-0.52.2/po/cs.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/cs.po 2018-09-02 13:20:15.000000000 +0000 @@ -4,15 +4,15 @@ # # Miloslav Trmac , 2002, 2003, 2004. # Pavel Šefránek , 2008. -# Marek Černocký , 2010, 2014, 2016. +# Marek Černocký , 2010, 2014, 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-08-13 23:26+0200\n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-22 13:53+0200\n" "Last-Translator: Marek Černocký \n" "Language-Team: čeština \n" "Language: cs\n" @@ -22,67 +22,27 @@ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" "X-Generator: Gtranslator 2.91.7\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Nelze převést znaky z %s do %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Chyba při čtení od potomka: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Chyba (%s) při převodu dat pro potomka, zahazuje se." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "VAROVÁNÍ" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "Není povoleno GNUTLS – data budou na disku uložena nezašifrovaná!" - -#~ msgid "Copy" -#~ msgstr "Kopírovat" - -#~ msgid "Paste" -#~ msgstr "Vložit" - -#~ msgid "Reset (use Ctrl to reset and clear)" -#~ msgstr "Reset (použijte Ctrl pro reset a vymazání)" - -#~ msgid "Reset" -#~ msgstr "Reset" - -#~ msgid "Toggle input enabled setting" -#~ msgstr "Přepnout nastavení povolující vstup" - -#~ msgid "Input" -#~ msgstr "Vstup" - -#~ msgid "Attempt to set invalid NRC map '%c'." -#~ msgstr "Pokus nastavit neplatnou mapu NRC „%c“." - -#~ msgid "Unrecognized identified coding system." -#~ msgstr "Systém kódování, který byl rozpoznán, je neznámý." - -#~ msgid "Attempt to set invalid wide NRC map '%c'." -#~ msgstr "Pokus nastavit neplatnou širokou mapu NRC „%c“." - -#~ msgid "Could not open console.\n" -#~ msgstr "Nelze otevřít konzoli.\n" - -#~ msgid "Could not parse the geometry spec passed to --geometry" -#~ msgstr "Nelze zpracovat rozměry a umístění zadavné v --geometry" - -#~ msgid "Unable to send data to child, invalid charset convertor" -#~ msgstr "" -#~ "Nelze poslat zprávu potomkovi z důvodu neplatného převodníku znakové sady" - -#~ msgid "Error reading PTY size, using defaults: %s\n" -#~ msgstr "Chyba při čtení velikosti PTY, použije se výchozí: %s\n" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "Není povoleno GnuTLS – data budou na disku uložena nezašifrovaná!" diff -Nru vte2.91-0.52.2/po/da.po vte2.91-0.54.0/po/da.po --- vte2.91-0.52.2/po/da.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/da.po 2018-09-02 13:20:15.000000000 +0000 @@ -1,18 +1,17 @@ # Danish translation of vte. -# Copyright (C) 2002-07, 2016 Free Software Foundation, Inc. +# Copyright (C) 2002-07, 2016, 2018 Free Software Foundation, Inc. # This file is distributed under the same license as the vte package. # Ole Laursen , 2002, 03. # Peter Bach , 2007. # Kenneth Nielsen . 2010 -# Ask Hjorth Larsen , 2016. +# Ask Hjorth Larsen , 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: " -"https://bugzilla.gnome.org/enter_bug.cgi?product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2017-02-28 06:44+0000\n" -"PO-Revision-Date: 2016-09-08 23:41+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-30 21:05+0200\n" "Last-Translator: Ask Hjorth Larsen \n" "Language-Team: Danish \n" "Language: da\n" @@ -20,31 +19,29 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3262 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Kunne ikke konvertere tegn fra %s til %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4014 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Fejl ved læsning fra underproces: %s." -#: ../src/vte.cc:4153 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Fejl (%s) ved konvertering af data for underproces, dropper." -#: ../src/vte.cc:7922 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "ADVARSEL" -#: ../src/vte.cc:7923 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "" -"GNUTLS er ikke slået til; data vil blive skrevet ukrypteret til disken!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS er ikke slået til; data vil blive skrevet ukrypteret til disken!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Kunne ikke konvertere tegn fra %s til %s." #~ msgid "Copy" #~ msgstr "Kopiér" @@ -130,5 +127,3 @@ #~ msgid "Character 0x%x is undefined, allocating one column." #~ msgstr "Tegn 0x%x er ikke defineret, allokerer en kolonne." - - diff -Nru vte2.91-0.52.2/po/de.po vte2.91-0.54.0/po/de.po --- vte2.91-0.52.2/po/de.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/de.po 2018-09-02 13:20:15.000000000 +0000 @@ -5,49 +5,48 @@ # Hendrik Richter , 2007. # Andre Klapper , 2007. # Mario Blättermann , 2010, 2014, 2016. +# Tim Sabsch , 2018. # msgid "" msgstr "" "Project-Id-Version: vte master\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-06-22 13:29+0200\n" -"Last-Translator: Mario Blättermann \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-07-27 14:47+0200\n" +"Last-Translator: Tim Sabsch \n" "Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.8\n" - -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Zeichen konnten nicht von %s nach %s konvertiert werden." +"X-Generator: Poedit 2.0.9\n" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Fehler beim Lesen von Kind: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Fehler (%s) beim Konvertieren der Daten für Kind, abgebrochen." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "WARNUNG" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"GNUTLS ist nicht aktiviert, die Daten werden unverschlüsselt auf die " +"GnuTLS ist nicht aktiviert, die Daten werden unverschlüsselt auf die " "Festplatte geschrieben!" +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Zeichen konnten nicht von %s nach %s konvertiert werden." + #~ msgid "Copy" #~ msgstr "Kopieren" diff -Nru vte2.91-0.52.2/po/el.po vte2.91-0.54.0/po/el.po --- vte2.91-0.52.2/po/el.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/el.po 2018-09-02 13:20:15.000000000 +0000 @@ -10,47 +10,45 @@ msgid "" msgstr "" "Project-Id-Version: el\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2016-09-12 00:19+0300\n" -"Last-Translator: Tom Tryfonidis \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-15 14:13+0300\n" +"Last-Translator: Efstathios Iosifidis \n" "Language-Team: team@gnome.gr\n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.8.8\n" +"X-Generator: Poedit 2.0.9\n" "X-Project-Style: gnome\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Αδύνατη η μετατροπή χαρακτήρων από %s σε %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Σφάλμα ανάγνωσης από θυγατρική διεργασία: %s." -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "Σφάλμα (%s) μετατροπής δεδομένων από θυγατρική διεργασία, απορρίπτεται." -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "ΠΡΟΕΙΔΟΠΟΙΗΣΗ" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"Δεν είναι ενεργοποιημένο το GNUTLS, τα δεδομένα να γραφούν στον δίσκο " -"μη κρυπτογραφημένα!" +"Δεν είναι ενεργοποιημένο το GNUTLS, τα δεδομένα που θα εγγραφούν στο " +"δίσκο δεν θα είναι κρυπτογραφημένα!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Αδύνατη η μετατροπή χαρακτήρων από %s σε %s." #~ msgid "Copy" #~ msgstr "Αντιγραφή" diff -Nru vte2.91-0.52.2/po/es.po vte2.91-0.54.0/po/es.po --- vte2.91-0.52.2/po/es.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/es.po 2018-09-02 13:20:15.000000000 +0000 @@ -10,17 +10,17 @@ # Francisco Javier F. Serrador , 2004. # Rodrigo Marcos Fombellida , 2007. # Jorge González , 2010. -# Daniel Mustieles , 2014, 2016. +# Daniel Mustieles , 2014, 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: vte.HEAD\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-05-26 14:57+0200\n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-22 13:02+0200\n" "Last-Translator: Daniel Mustieles \n" -"Language-Team: Español; Castellano \n" +"Language-Team: es \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -28,29 +28,30 @@ "X-Generator: Gtranslator 2.91.6\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "No se pueden convertir caracteres de %s a %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Error al leer desde el hijo: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Error (%s) al convertir datos desde el hijo, omitiendo." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "ADVERTENCIA" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8151 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" "GNUTLS no está activado; lo datos se escribirán en el disco sin cifrar." diff -Nru vte2.91-0.52.2/po/fi.po vte2.91-0.54.0/po/fi.po --- vte2.91-0.52.2/po/fi.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/fi.po 2018-09-02 13:20:15.000000000 +0000 @@ -9,10 +9,9 @@ msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2017-02-28 06:44+0000\n" -"PO-Revision-Date: 2018-03-03 18:20+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-17 21:03+0300\n" "Last-Translator: Jiri Grönroos \n" "Language-Team: suomi \n" "Language: fi\n" @@ -20,32 +19,31 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.8.7.1\n" - -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3262 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Merkkien muuntaminen merkistöstä %s merkistöön %s ei onnistu." +"X-Generator: Poedit 2.0.6\n" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4014 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Virhe lapselta lukemisessa: %s." -#: ../src/vte.cc:4153 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Virhe (%s) datan muuntamisessa lapselle, putoaa pois." -#: ../src/vte.cc:7922 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "VAROITUS" -#: ../src/vte.cc:7923 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS ei ole käytössä; tiedot kirjoitetaan levylle salaamattomina!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS ei ole käytössä; tiedot kirjoitetaan levylle ilman salausta!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Merkkien muuntaminen merkistöstä %s merkistöön %s ei onnistu." #~ msgid "Copy" #~ msgstr "Kopioi" @@ -54,8 +52,7 @@ #~ msgstr "Liitä" #~ msgid "Reset (use Ctrl to reset and clear)" -#~ msgstr "" -#~ "Palauta asetukset (käytä Ctrl-näppäintä palauttaaksesi ja tyhjentääksesi)" +#~ msgstr "Palauta asetukset (käytä Ctrl-näppäintä palauttaaksesi ja tyhjentääksesi)" #~ msgid "Reset" #~ msgstr "Palauta asetukset" @@ -76,8 +73,7 @@ #~ msgstr "Konsolin avaaminen ei onnistunut.\n" #~ msgid "Could not parse the geometry spec passed to --geometry" -#~ msgstr "" -#~ "Geometriamäärittelyä parametrissa --geometry ei voitu tulkita oikein" +#~ msgstr "Geometriamäärittelyä parametrissa --geometry ei voitu tulkita oikein" #~ msgid "Unable to send data to child, invalid charset convertor" #~ msgstr "Tietoja ei voitu lähettää lapselle, virheellinen merkistömuunnin" diff -Nru vte2.91-0.52.2/po/fr.po vte2.91-0.54.0/po/fr.po --- vte2.91-0.52.2/po/fr.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/fr.po 2018-09-02 13:20:15.000000000 +0000 @@ -6,44 +6,48 @@ # Christophe Merlet , 2002-2006. # Jonathan Ernst , 2007. # Stéphane Raimbault , 2007. +# Charles Monzat , 2018. # msgid "" msgstr "" "Project-Id-Version: vte 0.14.1\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2016-08-30 08:55+0200\n" -"Last-Translator: Claude Paroz \n" -"Language-Team: GNOME French Team \n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-21 21:39+0200\n" +"Last-Translator: Charles Monzat \n" +"Language-Team: français \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Gtranslator 2.91.7\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Impossible de convertir les caractères %s en %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Erreur lors de la lecture du fils : « %s »." -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Erreur (%s) lors de la conversion de données pour le fils, abandon." -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "AVERTISSEMENT" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8151 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"GNUTLS n'est pas activé ; les données seront écrites sur le disque sans " -"être chiffrées !" +"GnuTLS n’est pas activé ; les données seront écrites sur le disque sans être " +"chiffrées !" diff -Nru vte2.91-0.52.2/po/fur.po vte2.91-0.54.0/po/fur.po --- vte2.91-0.52.2/po/fur.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/fur.po 2018-09-02 13:20:15.000000000 +0000 @@ -6,43 +6,43 @@ msgid "" msgstr "" "Project-Id-Version: vte vte-0-34\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-07-25 12:07+0200\n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-26 11:00+0200\n" "Last-Translator: Fabio Tomat \n" "Language-Team: Friulian \n" "Language: fur\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.8\n" +"X-Generator: Poedit 2.0.7\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Impussibil convertî i caratars di %s a %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Erôr leint dal procès fî: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Erôr (%s) convertint i dâts par il proces fî, a restaran come prime." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "AVERTIMENT" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"GNUTLS no abilitât; i dâts a vegnaran scrits tal disc cence jessi cifrâts!" +"GnuTLS no abilitât; i dâts a vignaran scrits tal disc cence jessi cifrâts!" #~ msgid "Copy" #~ msgstr "Copie" diff -Nru vte2.91-0.52.2/po/gl.po vte2.91-0.54.0/po/gl.po --- vte2.91-0.52.2/po/gl.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/gl.po 2018-09-02 13:20:15.000000000 +0000 @@ -5,15 +5,15 @@ # Ignacio Casal Quinteiro , 2007, 2008. # Mancomún - Centro de Referencia e Servizos de Software Libre , 2009. # Fran Diéguez , 2010, 2011. -# Fran Dieguez , 2014, 2016. +# Fran Dieguez , 2014, 2016, 2018. msgid "" msgstr "" "Project-Id-Version: gl\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-09-09 00:02+0200\n" -"PO-Revision-Date: 2016-09-09 00:03+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-30 00:33+0200\n" "Last-Translator: Fran Dieguez \n" -"Language-Team: Galician\n" +"Language-Team: Proxecto Trasno \n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -21,30 +21,30 @@ "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Virtaal 0.7.1\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3072 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Non foi posíbel converter os caracteres desde %s a %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Produciuse un erro ao ler desde o fillo: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Produciuse un erro (%s) ao converter os datos do fillo; eliminando." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "AVISO" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS non está activado; os datos escribiranse no disco sen cifrar!" +#: ../src/vte.cc:8180 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS non está activado; os datos escribiranse no disco sen cifrar!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Non foi posíbel converter os caracteres desde %s a %s." #~ msgid "Copy" #~ msgstr "Copiar" diff -Nru vte2.91-0.52.2/po/hu.po vte2.91-0.54.0/po/hu.po --- vte2.91-0.52.2/po/hu.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/hu.po 2018-09-02 13:20:15.000000000 +0000 @@ -9,42 +9,40 @@ msgid "" msgstr "" "Project-Id-Version: vte master\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-18 04:51+0000\n" -"PO-Revision-Date: 2016-08-19 23:46+0200\n" -"Last-Translator: Balázs Úr \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-31 12:51+0200\n" +"Last-Translator: Meskó Balázs \n" "Language-Team: Hungarian \n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Nem lehet átalakítani a karaktereket %s és %s között." +"X-Generator: Poedit 2.0.8\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Hiba a gyermekből olvasás közben: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Hiba (%s) történt az adatkonverzió közben a gyermek számára, eldobva." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "FIGYELMEZTETÉS" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"A GNUTLS nincs engedélyezve. Az adatok titkosítatlanul lesznek a lemezre írva!" +"A GnuTLS nincs engedélyezve. Az adatok titkosítatlanul lesznek a lemezre " +"írva!" +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Nem lehet átalakítani a karaktereket %s és %s között." diff -Nru vte2.91-0.52.2/po/id.po vte2.91-0.54.0/po/id.po --- vte2.91-0.52.2/po/id.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/id.po 2018-09-02 13:20:15.000000000 +0000 @@ -7,44 +7,44 @@ msgid "" msgstr "" "Project-Id-Version: vte.master.id\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2016-08-18 11:50+0700\n" -"Last-Translator: Andika Triwidada \n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-26 12:56+0700\n" +"Last-Translator: Kukuh Syafaat \n" "Language-Team: GNOME Indonesian Translation Team \n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" +"X-Generator: Poedit 2.0.6\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Tidak dapat mengkonversi karakter dari %s ke %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Galat sewaktu membaca dari anak: %s." -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Galat (%s) sewaktu mengkonversi data untuk anak, dibuang." -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "PERINGATAN" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS tidak difungsikanl; data akan ditulis ke disk tanpa enkripsi!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GNUTLS tidak difungsikan; data akan ditulis ke disk tanpa enkripsi!" #~ msgid "Copy" #~ msgstr "Salin" diff -Nru vte2.91-0.52.2/po/it.po vte2.91-0.54.0/po/it.po --- vte2.91-0.52.2/po/it.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/it.po 2018-09-02 13:20:15.000000000 +0000 @@ -1,49 +1,47 @@ # Italian translation of vte. -# Copyright (C) 2003-2010, 2015 THE vte'S COPYRIGHT HOLDER +# Copyright (C) 2003-2010, 2015, 2016, 2018 THE vte'S COPYRIGHT HOLDER # This file is distributed under the same license as the vte package. # Francesco Marletta , 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010. -# Milo Casagrande , 2015. +# Milo Casagrande , 2015, 2018. # Gianvito Cavasoli , 2016. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-09-17 18:49+0000\n" -"PO-Revision-Date: 2016-10-06 13:48+0200\n" -"Last-Translator: Gianvito Cavasoli \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-27 10:02+0200\n" +"Last-Translator: Milo Casagrande \n" "Language-Team: Italiano \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Gtranslator 2.91.7\n" +"X-Generator: Poedit 2.0.6\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3072 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Impossibile convertire i caratteri da %s a %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Errore nella lettura dal processo figlio: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "Errore (%s) nel convertire i dati per il processo figlio, rimarranno " "invariati." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "Attenzione" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "GNUTLS non abilitato; i dati saranno scritti sul disco non cifrati." + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Impossibile convertire i caratteri da %s a %s." diff -Nru vte2.91-0.52.2/po/kk.po vte2.91-0.54.0/po/kk.po --- vte2.91-0.52.2/po/kk.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/kk.po 2018-09-02 13:20:15.000000000 +0000 @@ -6,43 +6,40 @@ msgid "" msgstr "" "Project-Id-Version: vte master\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2016-09-04 09:03+0500\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-25 22:37+0500\n" "Last-Translator: Baurzhan Muftakhidinov \n" "Language-Team: Kazakh \n" "Language: kk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.8\n" - -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Таңбаларды %s жинағынан %s жинағына түрлендіру мүмкін емес." +"X-Generator: Poedit 2.1.1\n" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Ұрпақтан оқу қатесі: %s." -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Ұрпақ үшін деректерді түрлендіру қатесі (%s), тасталады." -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "ЕСКЕРТУ" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "" -"GNUTLS іске қосылмаған; деректер дискке шифрленбеген түрде жазылатын болады!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS іске қосылмаған; деректер дискке шифрленбеген түрде жазылатын болады!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Таңбаларды %s жинағынан %s жинағына түрлендіру мүмкін емес." #~ msgid "Copy" #~ msgstr "Көшіріп алу" @@ -78,8 +75,7 @@ #~ msgstr "Қолданбаның --geometry опциясына берілген геометрияны талдау қатесі" #~ msgid "Unable to send data to child, invalid charset convertor" -#~ msgstr "" -#~ "Ұрпаққа деректерді жіберу сәтсіз, кодтау кестесінің түрлендіргіші қате" +#~ msgstr "Ұрпаққа деректерді жіберу сәтсіз, кодтау кестесінің түрлендіргіші қате" #~ msgid "Error reading PTY size, using defaults: %s\n" #~ msgstr "PTY өлшемін оқу қатесі, бастапқысы қолданылады: %s\n" diff -Nru vte2.91-0.52.2/po/ko.po vte2.91-0.54.0/po/ko.po --- vte2.91-0.52.2/po/ko.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/ko.po 2018-09-02 13:20:15.000000000 +0000 @@ -2,15 +2,14 @@ # This file is distributed under the same license as the vte package. # # Nam SungHyun , 2003 -# Changwoo Ryu , 2007, 2009, 2010, 2014, 2016. +# Changwoo Ryu , 2007, 2009, 2010, 2014, 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-26 22:58+0000\n" -"PO-Revision-Date: 2016-09-03 23:11+0900\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-25 16:45+0900\n" "Last-Translator: Changwoo Ryu \n" "Language-Team: GNOME Korea \n" "Language: ko\n" @@ -18,68 +17,27 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "문자를 %s을(를) %s(으)로 변환할 수 없습니다." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "하위 프로세스에서 읽기 오류: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "하위 프로세스를 위한 데이터 변환에 오류가 발생했습니다. (%s) 그만둡니다." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "경고" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS 사용하지 않음: 데이터를 암호화하지 않은 상태로 디스크에 씁니다" - -#~ msgid "Copy" -#~ msgstr "복사" - -#~ msgid "Paste" -#~ msgstr "붙여넣기" - -#~ msgid "Reset (use Ctrl to reset and clear)" -#~ msgstr "초기화(초기화하고 지우려면 Ctrl 사용)" - -#~ msgid "Reset" -#~ msgstr "초기화" - -#~ msgid "Toggle input enabled setting" -#~ msgstr "입력 관련 설정 토글" - -#~ msgid "Input" -#~ msgstr "입력" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS 사용하지 않음. 데이터를 암호화하지 않은 상태로 디스크에 씁니다" -#~ msgid "Attempt to set invalid NRC map '%c'." -#~ msgstr "잘못된 NRC 맵 '%c' 설정을 시도했습니다." - -#~ msgid "Unrecognized identified coding system." -#~ msgstr "올바르지만 알지 못하는 코딩 시스템." - -#~ msgid "Attempt to set invalid wide NRC map '%c'." -#~ msgstr "잘못된 와이드 NRC 맵 '%c' 설정을 시도했습니다." - -#~ msgid "Could not open console.\n" -#~ msgstr "콘솔을 열 수 없습니다.\n" - -#~ msgid "Could not parse the geometry spec passed to --geometry" -#~ msgstr "--geometry 옵션에 넘긴 위치/크기 정보를 파싱할 수 없습니다" - -#~ msgid "Unable to send data to child, invalid charset convertor" -#~ msgstr "" -#~ "데이터를 하위 프로세스로 보낼 수 없습니다. 문자세트 변환이 잘못되었습니다" - -#~ msgid "Error reading PTY size, using defaults: %s\n" -#~ msgstr "PTY 크기 읽기 오류, 기본값 사용: %s\n" +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "문자를 %s을(를) %s(으)로 변환할 수 없습니다." diff -Nru vte2.91-0.52.2/po/lt.po vte2.91-0.54.0/po/lt.po --- vte2.91-0.52.2/po/lt.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/lt.po 2018-09-02 13:20:15.000000000 +0000 @@ -4,15 +4,14 @@ # Tomas Kuliavas , 2003. # Gintautas Miliauskas , 2007. # Rimas Kudelis , 2010, 2014. -# Aurimas Černius , 2016. +# Aurimas Černius , 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: lt\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-13 21:26+0000\n" -"PO-Revision-Date: 2016-08-14 21:33+0300\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-11 18:19+0300\n" "Last-Translator: Aurimas Černius \n" "Language-Team: Lietuvių \n" "Language: lt\n" @@ -23,33 +22,33 @@ "%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Gtranslator 2.91.7\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Nepavyko perversti simbolių iš %s į %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Įvyko klaida skaitant duomenis iš antrinio proceso: %s." -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "Įvyko klaida (%s) keičiant duomenis gautus iš antrinio proceso, nutraukiame " "darbą." -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "ĮSPĖJIMAS" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "GNUTLS nėra įjungta; duomenys bus rašomi į diską nešifruojant!" +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Nepavyko perversti simbolių iš %s į %s." + #~ msgid "Copy" #~ msgstr "Kopijuoti" diff -Nru vte2.91-0.52.2/po/lv.po vte2.91-0.54.0/po/lv.po --- vte2.91-0.52.2/po/lv.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/lv.po 2018-09-02 13:20:15.000000000 +0000 @@ -5,14 +5,13 @@ # Artis Trops , 2002. # Raivis Dejus , 2006. # Peteris Krisjanis , 2009. -# Rudolfs , 2011, 2016. +# Rudolfs , 2011, 2016, 2018. msgid "" msgstr "" "Project-Id-Version: lv\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=vte" -"&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-09-04 12:37+0000\n" -"PO-Revision-Date: 2016-09-08 21:49+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-31 21:06+0200\n" "Last-Translator: Rūdolfs Mazurs \n" "Language-Team: Latvian \n" "Language: lv\n" @@ -23,30 +22,30 @@ " 2);\n" "X-Generator: Lokalize 2.0\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3068 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Neiespējami pārveidot rakstzīmes no %s uz %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Kļūda lasot no bērna: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Kļūda (%s) konvertējot datus bērnam, pamet." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "BRĪDINĀJUMS" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS nav ieslēgti; dati diskā tiks ierakstīti nešifrēti!" +#: ../src/vte.cc:8180 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS nav ieslēgti; dati diskā tiks ierakstīti nešifrēti!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Neiespējami pārveidot rakstzīmes no %s uz %s." #~ msgid "Attempt to set invalid NRC map '%c'." #~ msgstr "Mēģinājums iestatīt nederīgu NRC karti '%c'." diff -Nru vte2.91-0.52.2/po/oc.po vte2.91-0.54.0/po/oc.po --- vte2.91-0.52.2/po/oc.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/oc.po 2018-09-02 13:20:15.000000000 +0000 @@ -3,14 +3,13 @@ # This file is under the same license as the vte package. # Cédric Valmary , 2015. # Cédric Valmary (Tot en òc) , 2015. -# Cédric Valmary (totenoc.eu) , 2016, 2017. +# Cédric Valmary (totenoc.eu) , 2016, 2017, 2018. msgid "" msgstr "" "Project-Id-Version: vte 0.14.1\n" -"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?product=vte&ke" -"ywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2017-03-01 11:47+0000\n" -"PO-Revision-Date: 2017-03-06 18:38+0200\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-06-22 08:58+0200\n" "Last-Translator: Cédric Valmary (totenoc.eu) \n" "Language-Team: Tot En Òc\n" "Language: oc\n" @@ -21,33 +20,33 @@ "X-Generator: Virtaal 0.7.1\n" "X-Project-Style: gnome\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3262 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Impossible de convertir los caractèrs %s en %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4014 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Error al moment de la lectura del filh : « %s »." -#: ../src/vte.cc:4153 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Error (%s) al moment de la conversion de donadas pel filh, abandon." -#: ../src/vte.cc:7922 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "AVERTIMENT" -#: ../src/vte.cc:7923 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"GNUTLS es pas activat ; las donadas seràn escritas sul disc sens èsser " +"GnuTLS es pas activat ; las donadas seràn escritas sul disc sens èsser " "chifradas !" +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Impossible de convertir los caractèrs %s en %s." + #~ msgid "Copy" #~ msgstr "Copiar" diff -Nru vte2.91-0.52.2/po/pl.po vte2.91-0.54.0/po/pl.po --- vte2.91-0.52.2/po/pl.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/pl.po 2018-09-02 13:20:15.000000000 +0000 @@ -1,17 +1,17 @@ # Polish translation for vte. -# Copyright © 2003-2017 the vte authors. +# Copyright © 2003-2018 the vte authors. # This file is distributed under the same license as the vte package. # Zbigniew Chyla , 2003. # Artur Flinta , 2003-2007. -# Piotr Drąg , 2010-2017. -# Aviary.pl , 2010-2017. +# Piotr Drąg , 2010-2018. +# Aviary.pl , 2010-2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-12 02:10+0200\n" -"PO-Revision-Date: 2017-08-12 02:11+0200\n" +"POT-Creation-Date: 2018-05-27 07:48+0200\n" +"PO-Revision-Date: 2018-05-27 07:49+0200\n" "Last-Translator: Piotr Drąg \n" "Language-Team: Polish \n" "Language: pl\n" @@ -21,30 +21,30 @@ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3423 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Nie można przekonwertować znaków z %s na %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4067 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Błąd podczas odczytywania z procesu potomnego: %s." -#: ../src/vte.cc:4206 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "Błąd (%s) podczas konwertowania danych dla procesu potomnego. Porzucanie." -#: ../src/vte.cc:8148 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "OSTRZEŻENIE" -#: ../src/vte.cc:8149 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" "Nie włączono obsługi biblioteki GnuTLS. Dane zapisywane na dysku nie będą " "zaszyfrowane." diff -Nru vte2.91-0.52.2/po/POTFILES.in vte2.91-0.54.0/po/POTFILES.in --- vte2.91-0.52.2/po/POTFILES.in 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/POTFILES.in 2018-09-02 13:20:15.000000000 +0000 @@ -1,4 +1,3 @@ -src/iso2022.cc src/pty.cc src/vte.cc src/vtegtk.cc diff -Nru vte2.91-0.52.2/po/pt_BR.po vte2.91-0.54.0/po/pt_BR.po --- vte2.91-0.52.2/po/pt_BR.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/pt_BR.po 2018-09-02 13:20:15.000000000 +0000 @@ -6,49 +6,48 @@ # Lucas Mazzardo Veloso , 2007. # Enrico Nicoletto , 2014. # Rafael Fontenelle , 2016. +# Ricardo Silva Veloso , 2018. msgid "" msgstr "" "Project-Id-Version: 2.0\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=vte&key" -"words=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-06-13 20:18-0200\n" -"Last-Translator: Rafael Fontenelle \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-06-20 20:20+0000\n" +"PO-Revision-Date: 2018-08-11 23:58-0300\n" +"Last-Translator: Ricardo Silva Veloso \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Generator: Virtaal 0.7.1\n" +"X-Generator: Poedit 2.1\n" "X-Project-Style: gnome\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 -#, c-format -msgid "Unable to convert characters from %s to %s." -msgstr "Não foi possível converter caracteres de %s para %s." - #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3966 #, c-format msgid "Error reading from child: %s." msgstr "Erro ao ler do filho: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4122 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Erro (%s) ao converter dados para filho, descartando." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8179 msgid "WARNING" msgstr "AVISO" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +#: ../src/vte.cc:8180 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" msgstr "" -"GNUTLS não está habilitado; os dados serão escritos em um disco " -"descriptografado!" +"O GnuTLS não está habilitado; os dados serão escritos " +"descriptografados em um disco!" + +#: ../src/vtegtk.cc:3618 +#, c-format +msgid "Unable to convert characters from %s to %s." +msgstr "Não foi possível converter caracteres de %s para %s." #~ msgid "Copy" #~ msgstr "Copiar" diff -Nru vte2.91-0.52.2/po/ro.po vte2.91-0.54.0/po/ro.po --- vte2.91-0.52.2/po/ro.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/ro.po 2018-09-02 13:20:15.000000000 +0000 @@ -7,11 +7,11 @@ msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2017-02-28 06:44+0000\n" -"PO-Revision-Date: 2017-09-02 19:30+0300\n" -"Last-Translator: Daniel Șerbănescu \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-05-31 09:34+0000\n" +"PO-Revision-Date: 2018-06-17 21:39+0300\n" +"Last-Translator: Florentina Mușat \n" "Language-Team: Gnome Romanian Translation Team\n" "Language: ro\n" "MIME-Version: 1.0\n" @@ -19,36 +19,36 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " "20)) ? 1 : 2);;\n" -"X-Generator: Poedit 1.8.12\n" +"X-Generator: Poedit 2.0.8\n" "X-Launchpad-Export-Date: 2009-01-14 02:40+0000\n" "X-Project-Style: gnome\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3262 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Nu se pot converti caracterele din %s în %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4014 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Eroare la citirea datelor de la procesul copil: %s." -#: ../src/vte.cc:4153 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" "Eroare (%s) în timpul convertirii datelor pentru procesul copil, se " "abandonează acțiunea." -#: ../src/vte.cc:7922 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "AVERTIZARE" -#: ../src/vte.cc:7923 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS nu este activat; datele vor fi scrise pe disc necriptate!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS nu este activat; datele vor fi scrise pe disc necriptate!" #~ msgid "Copy" #~ msgstr "Copiază" diff -Nru vte2.91-0.52.2/po/sl.po vte2.91-0.54.0/po/sl.po --- vte2.91-0.52.2/po/sl.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/sl.po 2018-09-02 13:20:15.000000000 +0000 @@ -3,15 +3,15 @@ # This file is distributed under the same license as the program package. # # Andraž Tori 2002. -# Matej Urbančič , 2006-2016. +# Matej Urbančič , + 2006–2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-25 22:47+0200\n" -"PO-Revision-Date: 2016-08-25 22:48+0200\n" +"POT-Creation-Date: 2018-05-28 09:47+0000\n" +"PO-Revision-Date: 2018-05-30 20:49+0200\n" "Last-Translator: Matej Urbančič \n" "Language-Team: Slovenian GNOME Translation Team \n" "Language: sl_SI\n" @@ -21,33 +21,34 @@ "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" "%100==4 ? 3 : 0);\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.8.7.1\n" +"X-Generator: Poedit 2.0.6\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Ni mogoče pretvoriti znakov iz %s v %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4002 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." -msgstr "Napaka med branjem podrejenega programa: %s." +msgstr "Napaka med branjem podrejenega predmeta: %s." -#: ../src/vte.cc:4141 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "" -"Napaka (%s) pretvarjanja podatkov za podrejeni predmet; ukaz je izpuščen." +"Napaka (%s) pretvarjanja podatkov za podrejeni predmet; izvajanjeukaza je " +"preklicano." -#: ../src/vte.cc:7910 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "OPOZORILO" -#: ../src/vte.cc:7911 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "Paket GNUTLS ni omogočen; podatki bodo na disk zapisani nešifrirani!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "Paket GNUTLS ni omogočen; podatki bodo na disk zapisani na nešifriran način!" #~ msgid "Copy" #~ msgstr "Kopiraj" @@ -83,10 +84,7 @@ #~ msgstr "Ni mogoče razčleniti geometrije določene z oznako --geometry" #~ msgid "Unable to send data to child, invalid charset convertor" -#~ msgstr "" -#~ "Ni mogoče poslati podatkov podrejenemu opravilu; neveljaven pretvornik " -#~ "znakovnega nabora" +#~ msgstr "Ni mogoče poslati podatkov podrejenemu opravilu; neveljaven pretvornik znakovnega nabora" #~ msgid "Error reading PTY size, using defaults: %s\n" -#~ msgstr "" -#~ "Napaka med branjem velikosti PTY, uporabljena bo privzeta vrednost: %s\n" +#~ msgstr "Napaka med branjem velikosti PTY, uporabljena bo privzeta vrednost: %s\n" diff -Nru vte2.91-0.52.2/po/sv.po vte2.91-0.54.0/po/sv.po --- vte2.91-0.52.2/po/sv.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/sv.po 2018-09-02 13:20:15.000000000 +0000 @@ -1,48 +1,48 @@ # Swedish messages for vte. -# Copyright © 2002, 2003, 2006, 2007, 2010, 2016 Free Software Foundation, Inc. +# Copyright © 2002, 2003, 2006, 2007, 2010, 2016, 2018 Free Software Foundation, Inc. # Christian Rose , 2002, 2003. # Daniel Nylander , 2006, 2007, 2010. -# Anders Jonsson , 2016. +# Anders Jonsson , 2016, 2018. # msgid "" msgstr "" "Project-Id-Version: vte\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-08-03 15:54+0200\n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-23 22:35+0200\n" "Last-Translator: Anders Jonsson \n" "Language-Team: Swedish \n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.8\n" +"X-Generator: Poedit 2.0.7\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Kan inte konvertera tecken från %s till %s." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Fel vid läsning från barn: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Fel (%s) vid konvertering av data för barn, kastar." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "VARNING" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS inte aktiverat; data kommer skrivas till disk okrypterade!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS inte aktiverat; data kommer skrivas till disk okrypterade!" #~ msgid "Copy" #~ msgstr "Kopiera" diff -Nru vte2.91-0.52.2/po/tr.po vte2.91-0.54.0/po/tr.po --- vte2.91-0.52.2/po/tr.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/tr.po 2018-09-02 13:20:15.000000000 +0000 @@ -9,47 +9,48 @@ # Volkan Yalçın , 2011. # Yaşar Şentürk , 2014. # Muhammet Kara , 2016. +# Emin Tufan Çetin , 2018. # msgid "" msgstr "" "Project-Id-Version: vte.HEAD.tr\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-05-16 08:25+0000\n" -"PO-Revision-Date: 2016-05-26 22:19+0300\n" -"Last-Translator: Muhammet Kara \n" -"Language-Team: Turkish \n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-05-31 09:34+0000\n" +"PO-Revision-Date: 2018-06-14 12:27+0300\n" +"Last-Translator: Emin Tufan Çetin \n" +"Language-Team: Türkçe \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.6\n" +"X-Generator: Gtranslator 2.91.7\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3090 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." -msgstr "Karakterler %s'den %s'e dönüştürülemiyor." +msgstr "Karakterler %sʼden %sʼe dönüştürülemiyor." #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4248 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "Çocuk süreçten okunurken hata: %s." -#: ../src/vte.cc:4387 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Çocuk süreç için veriyi çevirirken hata (%s), bırakılıyor." -#: ../src/vte.cc:8156 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "UYARI" -#: ../src/vte.cc:8157 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS etkin değil; veriler diske şifrelenmemiş olarak yazılacak!" +#: ../src/vte.cc:8151 +#| msgid "GNUTLS not enabled; data will be written to disk unencrypted!" +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS etkin değil; veriler diske şifrelenmemiş olarak yazılacak!" #~ msgid "Copy" #~ msgstr "Kopyala" diff -Nru vte2.91-0.52.2/po/zh_CN.po vte2.91-0.54.0/po/zh_CN.po --- vte2.91-0.52.2/po/zh_CN.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/zh_CN.po 2018-09-02 13:20:15.000000000 +0000 @@ -5,46 +5,47 @@ # Funda Wang , 2003. # Yang Zhang , 2007. # Aron Xu , 2010. +# Mingcong Bai , 2018. # msgid "" msgstr "" "Project-Id-Version: vte master\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2016-10-18 17:18+0800\n" -"Last-Translator: irisgyq \n" +"POT-Creation-Date: 2018-05-21 18:38+0000\n" +"PO-Revision-Date: 2018-05-23 22:25+0800\n" +"Last-Translator: Mingcong Bai \n" "Language-Team: Chinese (simplified) \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.9\n" +"X-Generator: Poedit 2.0.6\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "无法将字符从 %s 转换至 %s。" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "从子程序读取数据时出错:%s" -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "从子程序转换数据时出错 (%s),放弃。" -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "警告" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS 未启用;写入磁盘的数据没有加密!" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS 未启用;写入磁盘的数据没有加密!" #~ msgid "Copy" #~ msgstr "复制" diff -Nru vte2.91-0.52.2/po/zh_TW.po vte2.91-0.54.0/po/zh_TW.po --- vte2.91-0.52.2/po/zh_TW.po 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/po/zh_TW.po 2018-09-02 13:20:15.000000000 +0000 @@ -6,42 +6,41 @@ msgid "" msgstr "" "Project-Id-Version: vte 0.25.90\n" -"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" -"product=vte&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2016-08-15 12:39+0000\n" -"PO-Revision-Date: 2017-02-28 13:31+0800\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/vte/issues\n" +"POT-Creation-Date: 2018-05-31 09:34+0000\n" +"PO-Revision-Date: 2018-06-09 11:43+0800\n" "Last-Translator: Chao-Hsiung Liao \n" "Language-Team: Chinese (Taiwan) \n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.11\n" +"X-Generator: Poedit 2.0.8\n" -#: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 -#: ../src/vtegtk.cc:3069 +#: ../src/iso2022.cc:71 ../src/iso2022.cc:79 ../src/iso2022.cc:109 +#: ../src/vtegtk.cc:3605 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "無法將字元從 %s 轉換至 %s。" #. Translators: %s is replaced with error message returned by strerror(). -#: ../src/vte.cc:4003 +#: ../src/vte.cc:3958 #, c-format msgid "Error reading from child: %s." msgstr "從副進程讀取資料時出現錯誤:%s" -#: ../src/vte.cc:4142 +#: ../src/vte.cc:4098 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "從副進程轉換資料時出現錯誤 (%s),放棄。" -#: ../src/vte.cc:7911 +#: ../src/vte.cc:8150 msgid "WARNING" msgstr "警告" -#: ../src/vte.cc:7912 -msgid "GNUTLS not enabled; data will be written to disk unencrypted!" -msgstr "GNUTLS 未啟用;資料將以未加密的方式寫入到磁碟 !" +#: ../src/vte.cc:8151 +msgid "GnuTLS not enabled; data will be written to disk unencrypted!" +msgstr "GnuTLS 未啟用;資料將以未加密的方式寫入到磁碟 !" #~ msgid "Copy" #~ msgstr "複製" diff -Nru vte2.91-0.52.2/README vte2.91-0.54.0/README --- vte2.91-0.52.2/README 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -* What is VTE? - -VTE is a library (libvte) implementing a terminal emulator widget for GTK+, -and a minimal sample application (vte) using that. Vte is mainly used in -gnome-terminal, but can also be used to embed a console/terminal in games, -editors, IDEs, etc. - -VTE doesn't have a homepage. Report any issues at: - - http://bugzilla.gnome.org/enter_bug.cgi?product=vte diff -Nru vte2.91-0.52.2/src/app/app.cc vte2.91-0.54.0/src/app/app.cc --- vte2.91-0.52.2/src/app/app.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/app/app.cc 2018-09-02 13:20:15.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ public: gboolean allow_window_ops{false}; gboolean audible_bell{false}; + gboolean backdrop{false}; gboolean console{false}; gboolean debug{false}; gboolean icon_title{false}; @@ -327,8 +329,10 @@ "Allow window operations (resize, move, raise/lower, (de)iconify)", nullptr }, { "audible-bell", 'a', 0, G_OPTION_ARG_NONE, &audible_bell, "Use audible terminal bell", nullptr }, + { "backdrop", 0, 0,G_OPTION_ARG_NONE, &backdrop, + "Dim when toplevel unfocused", nullptr }, { "background-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_bg_color, - "Set default background color", nullptr }, + "Set default background color", "COLOR" }, { "background-image", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_background_image, "Set background image from file", "FILE" }, { "background-extend", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_background_extend, @@ -344,9 +348,9 @@ { "cursor-blink", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_cursor_blink, "Cursor blink mode (system|on|off)", "MODE" }, { "cursor-background-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_cursor_bg_color, - "Enable a colored cursor background", nullptr }, + "Enable a colored cursor background", "COLOR" }, { "cursor-foreground-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_cursor_fg_color, - "Enable a colored cursor foreground", nullptr }, + "Enable a colored cursor foreground", "COLOR" }, { "cursor-shape", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_cursor_shape, "Set cursor shape (block|underline|ibeam)", nullptr }, { "dingu", 'D', 0, G_OPTION_ARG_STRING_ARRAY, &dingus, @@ -354,7 +358,7 @@ { "debug", 'd', 0,G_OPTION_ARG_NONE, &debug, "Enable various debugging checks", nullptr }, { "encoding", 0, 0, G_OPTION_ARG_STRING, &encoding, - "Specify the terminal encoding to use", nullptr }, + "Specify the terminal encoding to use", "ENCODING" }, { "env", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &environment, "Add environment variable to the child\'s environment", "VAR=VALUE" }, { "extra-margin", 0, 0, G_OPTION_ARG_INT, &extra_margin, @@ -362,15 +366,15 @@ { "font", 'f', 0, G_OPTION_ARG_STRING, &font_string, "Specify a font to use", nullptr }, { "foreground-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_fg_color, - "Set default foreground color", nullptr }, + "Set default foreground color", "COLOR" }, { "gregex", 0, 0, G_OPTION_ARG_NONE, &use_gregex, "Use GRegex instead of PCRE2", nullptr }, { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, "Set the size (in characters) and position", "GEOMETRY" }, { "highlight-background-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_hl_bg_color, - "Enable distinct highlight background color for selection", nullptr }, + "Enable distinct highlight background color for selection", "COLOR" }, { "highlight-foreground-color", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_hl_fg_color, - "Enable distinct highlight foreground color for selection", nullptr }, + "Enable distinct highlight foreground color for selection", "COLOR" }, { "icon-title", 'i', 0, G_OPTION_ARG_NONE, &icon_title, "Enable the setting of the icon title", nullptr }, { "keep", 'k', 0, G_OPTION_ARG_NONE, &keep, @@ -814,6 +818,8 @@ VteTerminal parent; cairo_pattern_t* background_pattern; + bool has_backdrop; + bool use_backdrop; }; struct _VteappTerminalClass { @@ -824,6 +830,8 @@ G_DEFINE_TYPE(VteappTerminal, vteapp_terminal, VTE_TYPE_TERMINAL) +#define BACKDROP_ALPHA (0.2) + static void vteapp_terminal_realize(GtkWidget* widget) { @@ -866,7 +874,8 @@ cairo_rectangle(cr, 0.0, 0.0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget)); - auto bg = options.get_color_bg(); + GdkRGBA bg; + vte_terminal_get_color_background_for_draw(VTE_TERMINAL(terminal), &bg); cairo_set_source_rgba(cr, bg.red, bg.green, bg.blue, 1.0); cairo_paint(cr); @@ -876,11 +885,34 @@ cairo_paint(cr); cairo_pop_group_to_source(cr); - cairo_paint_with_alpha(cr, options.get_alpha()); + cairo_paint_with_alpha(cr, bg.alpha); + + } + auto rv = GTK_WIDGET_CLASS(vteapp_terminal_parent_class)->draw(widget, cr); + + if (terminal->use_backdrop && terminal->has_backdrop) { + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgba(cr, 0, 0, 0, BACKDROP_ALPHA); + cairo_rectangle(cr, 0.0, 0.0, + gtk_widget_get_allocated_width(widget), + gtk_widget_get_allocated_height(widget)); + cairo_paint(cr); } - return GTK_WIDGET_CLASS(vteapp_terminal_parent_class)->draw(widget, cr); + return rv; +} + +static void +vteapp_terminal_style_updated(GtkWidget* widget) +{ + GTK_WIDGET_CLASS(vteapp_terminal_parent_class)->style_updated(widget); + + auto context = gtk_widget_get_style_context(widget); + auto flags = gtk_style_context_get_state(context); + + VteappTerminal* terminal = VTEAPP_TERMINAL(widget); + terminal->has_backdrop = (flags & GTK_STATE_FLAG_BACKDROP) != 0; } static void @@ -890,12 +922,15 @@ widget_class->realize = vteapp_terminal_realize; widget_class->unrealize = vteapp_terminal_unrealize; widget_class->draw = vteapp_terminal_draw; + widget_class->style_updated = vteapp_terminal_style_updated; } static void vteapp_terminal_init(VteappTerminal *terminal) { terminal->background_pattern = nullptr; + terminal->has_backdrop = false; + terminal->use_backdrop = options.backdrop; if (options.background_pixbuf != nullptr) vte_terminal_set_clear_background(VTE_TERMINAL(terminal), false); @@ -1496,7 +1531,12 @@ int status, VteappWindow* window) { - verbose_printerr("Child exited with status %x\n", status); + if (WIFEXITED(status)) + verbose_printerr("Child exited with status %x\n", WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + verbose_printerr("Child terminated by signal %d\n", WTERMSIG(status)); + else + verbose_printerr("Child terminated\n"); if (options.output_filename != nullptr) { auto file = g_file_new_for_commandline_arg(options.output_filename); @@ -2111,10 +2151,8 @@ gdk_window_set_debug_updates(true); #ifdef VTE_DEBUG if (options.test_mode) { - g_setenv("VTE_TEST", "1", true); + vte_set_test_flags(VTE_TEST_FLAGS_ALL); options.allow_window_ops = true; - } else { - g_unsetenv("VTE_TEST"); } #endif diff -Nru vte2.91-0.52.2/src/app/Makefile.in vte2.91-0.54.0/src/app/Makefile.in --- vte2.91-0.52.2/src/app/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/src/app/Makefile.in 2018-09-02 13:20:47.000000000 +0000 @@ -239,7 +239,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff -Nru vte2.91-0.52.2/src/buffer.h vte2.91-0.54.0/src/buffer.h --- vte2.91-0.52.2/src/buffer.h 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/src/buffer.h 2018-09-02 13:20:15.000000000 +0000 @@ -32,6 +32,7 @@ #define _vte_byte_array_free(B) g_byte_array_free (B, TRUE) #define _vte_byte_array_append(B, data, length) g_byte_array_append (B, (const guint8 *) (data), length) #define _vte_byte_array_length(B) ((B)->len) +#define _vte_byte_array_data(B) ((B)->data) #define _vte_byte_array_consume(B, length) g_byte_array_remove_range (B, 0, length) #define _vte_byte_array_clear(B) g_byte_array_set_size (B, 0) #define _vte_byte_array_set_minimum_size(B, length) g_byte_array_set_size (B, (guint) MAX ((gint) (length), (gint) (B)->len)) diff -Nru vte2.91-0.52.2/src/caps-list.hh vte2.91-0.54.0/src/caps-list.hh --- vte2.91-0.52.2/src/caps-list.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/caps-list.hh 1970-01-01 00:00:00.000000000 +0000 @@ -1,326 +0,0 @@ -/* - * Copyright (C) 2001,2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define ESC _VTE_CAP_ESC -#define CSI _VTE_CAP_CSI -#define ST _VTE_CAP_ST -#define OSC _VTE_CAP_OSC -#define PM _VTE_CAP_PM -#define APC _VTE_CAP_APC - -#define ENQ "\005" -#define BEL "\007" -#define BS "\010" -#define TAB "\011" -#define LF "\012" -#define VT "\013" -#define FF "\014" -#define CR "\015" -#define SO "\016" -#define SI "\017" -#define DEL "\177" - -#define ENTRY(str,handler) { str, &VteTerminalPrivate::seq_ ## handler } - -/* From some really old XTerm docs we had at the office, and an updated - * version at Moy, Gildea, and Dickey. */ -static const vte_matcher_entry_t entries[] = { - ENTRY(ENQ, return_terminal_status), - ENTRY(BEL, bell), - ENTRY(BS, backspace), - ENTRY(TAB, tab), - ENTRY(LF, line_feed), - ENTRY(VT, vertical_tab), - ENTRY(FF, form_feed), - ENTRY(CR, carriage_return), - ENTRY(SO, shift_out), - ENTRY(SI, shift_in), - ENTRY(DEL, nop), - - ENTRY(ESC " F", seven_bit_controls), - ENTRY(ESC " G", eight_bit_controls), - ENTRY(ESC " L", ansi_conformance_level_1), - ENTRY(ESC " M", ansi_conformance_level_2), - ENTRY(ESC " N", ansi_conformance_level_3), - ENTRY(ESC "#3", double_height_top_half), - ENTRY(ESC "#4", double_height_bottom_half), - ENTRY(ESC "#5", single_width), - ENTRY(ESC "#6", double_width), - ENTRY(ESC "#8", screen_alignment_test), - - /* These are actually designate_other_coding_system from ECMA 35, - * but we don't support the full repertoire. Actually, we don't - * know what the full repertoire looks like. - */ - ENTRY(ESC "%%@", default_character_set), - ENTRY(ESC "%%G", utf_8_character_set), - - ENTRY(ESC "(0", designate_g0_line_drawing), - ENTRY(ESC "(A", designate_g0_british), - ENTRY(ESC "(B", designate_g0_plain), - ENTRY(ESC ")0", designate_g1_line_drawing), - ENTRY(ESC ")A", designate_g1_british), - ENTRY(ESC ")B", designate_g1_plain), - - ENTRY(ESC "7", save_cursor), - ENTRY(ESC "8", restore_cursor), - ENTRY(ESC "=", application_keypad), - ENTRY(ESC ">", normal_keypad), - ENTRY(ESC "D", index), - ENTRY(ESC "E", next_line), - ENTRY(ESC "F", cursor_lower_left), - ENTRY(ESC "H", tab_set), - ENTRY(ESC "M", reverse_index), - ENTRY(ESC "N", single_shift_g2), - ENTRY(ESC "O", single_shift_g3), - ENTRY(ESC "P%s" ST, device_control_string), - ENTRY(ESC "V", start_of_guarded_area), - ENTRY(ESC "W", end_of_guarded_area), - ENTRY(ESC "X%s" ST, start_or_end_of_string), - ENTRY(ESC "Z", return_terminal_id), - ENTRY(ESC "c", full_reset), - ENTRY(ESC "l", memory_lock), - ENTRY(ESC "m", memory_unlock), - ENTRY(ESC "n", invoke_g2_character_set), - ENTRY(ESC "o", invoke_g3_character_set), - ENTRY(ESC "|", invoke_g3_character_set_as_gr), - ENTRY(ESC "}", invoke_g2_character_set_as_gr), - ENTRY(ESC "~", invoke_g1_character_set_as_gr), - - /* APC stuff omitted. */ - - /* DCS stuff omitted. */ - - ENTRY(CSI "@", insert_blank_characters), - ENTRY(CSI "%d@", insert_blank_characters), - ENTRY(CSI "A", cursor_up), - ENTRY(CSI "%dA", cursor_up), - ENTRY(CSI "B", cursor_down), - ENTRY(CSI "%dB", cursor_down), - ENTRY(CSI "C", cursor_forward), - ENTRY(CSI "%dC", cursor_forward), - ENTRY(CSI "D", cursor_backward), - ENTRY(CSI "%dD", cursor_backward), - ENTRY(CSI "E", cursor_next_line), - ENTRY(CSI "%dE", cursor_next_line), - ENTRY(CSI "F", cursor_preceding_line), - ENTRY(CSI "%dF", cursor_preceding_line), - ENTRY(CSI "G", cursor_character_absolute), - ENTRY(CSI "%dG", cursor_character_absolute), - ENTRY(CSI "H", cursor_position), - ENTRY(CSI ";H", cursor_position), - ENTRY(CSI "%dH", cursor_position), - ENTRY(CSI "%d;H", cursor_position), - ENTRY(CSI ";%dH", cursor_position_top_row), - ENTRY(CSI "%d;%dH", cursor_position), - ENTRY(CSI "I", cursor_forward_tabulation), - ENTRY(CSI "%dI", cursor_forward_tabulation), - ENTRY(CSI "%mJ", erase_in_display), - ENTRY(CSI "?%mJ", selective_erase_in_display), - ENTRY(CSI "%mK", erase_in_line), - ENTRY(CSI "?%mK", selective_erase_in_line), - ENTRY(CSI "L", insert_lines), - ENTRY(CSI "%dL", insert_lines), - ENTRY(CSI "M", delete_lines), - ENTRY(CSI "%dM", delete_lines), - ENTRY(CSI "P", delete_characters), - ENTRY(CSI "%dP", delete_characters), - ENTRY(CSI "S", scroll_up), - ENTRY(CSI "%dS", scroll_up), - ENTRY(CSI "T", scroll_down), - ENTRY(CSI "%dT", scroll_down), - ENTRY(CSI "%d;%d;%d;%d;%dT", initiate_hilite_mouse_tracking), - ENTRY(CSI "X", erase_characters), - ENTRY(CSI "%dX", erase_characters), - ENTRY(CSI "Z", cursor_back_tab), - ENTRY(CSI "%dZ", cursor_back_tab), - - ENTRY(CSI "`", character_position_absolute), - ENTRY(CSI "%d`", character_position_absolute), - ENTRY(CSI "b", repeat), - ENTRY(CSI "%db", repeat), - ENTRY(CSI "c", send_primary_device_attributes), - ENTRY(CSI "%dc", send_primary_device_attributes), - ENTRY(CSI ">c", send_secondary_device_attributes), - ENTRY(CSI ">%dc", send_secondary_device_attributes), - ENTRY(CSI "=c", send_tertiary_device_attributes), - ENTRY(CSI "=%dc", send_tertiary_device_attributes), - ENTRY(CSI "?%mc", linux_console_cursor_attributes), - ENTRY(CSI "d", line_position_absolute), - ENTRY(CSI "%dd", line_position_absolute), - ENTRY(CSI "f", cursor_position), - ENTRY(CSI ";f", cursor_position), - ENTRY(CSI "%df", cursor_position), - ENTRY(CSI "%d;f", cursor_position), - ENTRY(CSI ";%df", cursor_position_top_row), - ENTRY(CSI "%d;%df", cursor_position), - ENTRY(CSI "g", tab_clear), - ENTRY(CSI "%dg", tab_clear), - - ENTRY(CSI "%mh", set_mode), - ENTRY(CSI "?%mh", decset), - - ENTRY(CSI "%mi", media_copy), - ENTRY(CSI "?%mi", dec_media_copy), - - ENTRY(CSI "%ml", reset_mode), - ENTRY(CSI "?%ml", decreset), - - ENTRY(CSI "%mm", character_attributes), - - ENTRY(CSI "%dn", device_status_report), - ENTRY(CSI "?%dn", dec_device_status_report), - ENTRY(CSI "!p", soft_reset), - ENTRY(CSI "%d;%d\"p", set_conformance_level), - ENTRY(CSI " q", set_cursor_style), - ENTRY(CSI "%d q", set_cursor_style), - ENTRY(CSI "%d\"q", select_character_protection), - - ENTRY(CSI "r", set_scrolling_region), - ENTRY(CSI ";r", set_scrolling_region), - ENTRY(CSI ";%dr", set_scrolling_region_from_start), - ENTRY(CSI "%dr", set_scrolling_region_to_end), - ENTRY(CSI "%d;r", set_scrolling_region_to_end), - ENTRY(CSI "%d;%dr", set_scrolling_region), - - ENTRY(CSI "?%mr", restore_mode), - ENTRY(CSI "s", save_cursor), - ENTRY(CSI "?%ms", save_mode), - ENTRY(CSI "u", restore_cursor), - - ENTRY(CSI "%mt", window_manipulation), - - ENTRY(CSI "%d;%d;%d;%dw", enable_filter_rectangle), - ENTRY(CSI "%dx", request_terminal_parameters), - ENTRY(CSI "%d;%d'z", enable_locator_reporting), - ENTRY(CSI "%m'{", select_locator_events), - ENTRY(CSI "%d'|", request_locator_position), - - /* Set text parameters, BEL_terminated versions. */ - ENTRY(OSC ";%s" BEL, set_icon_and_window_title), /* undocumented default */ - ENTRY(OSC "0;%s" BEL, set_icon_and_window_title), - ENTRY(OSC "1;%s" BEL, set_icon_title), - ENTRY(OSC "2;%s" BEL, set_window_title), - ENTRY(OSC "3;%s" BEL, set_xproperty), - ENTRY(OSC "4;%s" BEL, change_color_bel), - ENTRY(OSC "5;0;%s" BEL, change_bold_color_bel), - ENTRY(OSC "6;%s" BEL, set_current_file_uri), - ENTRY(OSC "7;%s" BEL, set_current_directory_uri), - ENTRY(OSC "8;%s;%s" BEL, set_current_hyperlink), - ENTRY(OSC "10;%s" BEL, change_foreground_color_bel), - ENTRY(OSC "11;%s" BEL, change_background_color_bel), - ENTRY(OSC "12;%s" BEL, change_cursor_background_color_bel), - ENTRY(OSC "13;%s" BEL, change_mouse_cursor_foreground_color_bel), - ENTRY(OSC "14;%s" BEL, change_mouse_cursor_background_color_bel), - ENTRY(OSC "15;%s" BEL, change_tek_foreground_color_bel), - ENTRY(OSC "16;%s" BEL, change_tek_background_color_bel), - ENTRY(OSC "17;%s" BEL, change_highlight_background_color_bel), - ENTRY(OSC "18;%s" BEL, change_tek_cursor_color_bel), - ENTRY(OSC "19;%s" BEL, change_highlight_foreground_color_bel), - ENTRY(OSC "46;%s" BEL, change_logfile), - ENTRY(OSC "50;#%d" BEL, change_font_number), - ENTRY(OSC "50;%s" BEL, change_font_name), - ENTRY(OSC "104" BEL, reset_color), - ENTRY(OSC "104;%m" BEL, reset_color), - ENTRY(OSC "105" BEL, reset_bold_color), - ENTRY(OSC "105;0" BEL, reset_bold_color), - ENTRY(OSC "110" BEL, reset_foreground_color), - ENTRY(OSC "111" BEL, reset_background_color), - ENTRY(OSC "112" BEL, reset_cursor_background_color), - ENTRY(OSC "113" BEL, reset_mouse_cursor_foreground_color), - ENTRY(OSC "114" BEL, reset_mouse_cursor_background_color), - ENTRY(OSC "115" BEL, reset_tek_foreground_color), - ENTRY(OSC "116" BEL, reset_tek_background_color), - ENTRY(OSC "117" BEL, reset_highlight_background_color), - ENTRY(OSC "118" BEL, reset_tek_cursor_color), - ENTRY(OSC "119" BEL, reset_highlight_foreground_color), - ENTRY(OSC "133;%s" BEL, iterm2_133), - ENTRY(OSC "777;%s" BEL, urxvt_777), - ENTRY(OSC "1337;%s" BEL, iterm2_1337), - - /* Set text parameters, ST_terminated versions. */ - ENTRY(OSC ";%s" ST, set_icon_and_window_title), /* undocumented default */ - ENTRY(OSC "0;%s" ST, set_icon_and_window_title), - ENTRY(OSC "1;%s" ST, set_icon_title), - ENTRY(OSC "2;%s" ST, set_window_title), - ENTRY(OSC "3;%s" ST, set_xproperty), - ENTRY(OSC "4;%s" ST, change_color_st), - ENTRY(OSC "5;0;%s" ST, change_bold_color_st), - ENTRY(OSC "6;%s" ST, set_current_file_uri), - ENTRY(OSC "7;%s" ST, set_current_directory_uri), - ENTRY(OSC "8;%s;%s" ST, set_current_hyperlink), - ENTRY(OSC "10;%s" ST, change_foreground_color_st), - ENTRY(OSC "11;%s" ST, change_background_color_st), - ENTRY(OSC "12;%s" ST, change_cursor_background_color_st), - ENTRY(OSC "13;%s" ST, change_mouse_cursor_foreground_color_st), - ENTRY(OSC "14;%s" ST, change_mouse_cursor_background_color_st), - ENTRY(OSC "15;%s" ST, change_tek_foreground_color_st), - ENTRY(OSC "16;%s" ST, change_tek_background_color_st), - ENTRY(OSC "17;%s" ST, change_highlight_background_color_st), - ENTRY(OSC "18;%s" ST, change_tek_cursor_color_st), - ENTRY(OSC "19;%s" ST, change_highlight_foreground_color_st), - ENTRY(OSC "46;%s" ST, change_logfile), - ENTRY(OSC "50;#%d" ST, change_font_number), - ENTRY(OSC "50;%s" ST, change_font_name), - ENTRY(OSC "104" ST, reset_color), - ENTRY(OSC "104;%m" ST, reset_color), - ENTRY(OSC "105" ST, reset_bold_color), - ENTRY(OSC "105;0" ST, reset_bold_color), - ENTRY(OSC "110" ST, reset_foreground_color), - ENTRY(OSC "111" ST, reset_background_color), - ENTRY(OSC "112" ST, reset_cursor_background_color), - ENTRY(OSC "113" ST, reset_mouse_cursor_foreground_color), - ENTRY(OSC "114" ST, reset_mouse_cursor_background_color), - ENTRY(OSC "115" ST, reset_tek_foreground_color), - ENTRY(OSC "116" ST, reset_tek_background_color), - ENTRY(OSC "117" ST, reset_highlight_background_color), - ENTRY(OSC "118" ST, reset_tek_cursor_color), - ENTRY(OSC "119" ST, reset_highlight_foreground_color), - ENTRY(OSC "133;%s" ST, iterm2_133), - ENTRY(OSC "777;%s" ST, urxvt_777), - ENTRY(OSC "1337;%s" ST, iterm2_1337), - - /* These may be bogus, I can't find docs for them anywhere (#104154). */ - ENTRY(OSC "21;%s" BEL, set_text_property_21), - ENTRY(OSC "2L;%s" BEL, set_text_property_2L), - ENTRY(OSC "21;%s" ST, set_text_property_21), - ENTRY(OSC "2L;%s" ST, set_text_property_2L), - - ENTRY(CSI "%m*y", checksum_rectangular_area), -}; - -#undef ENTRY - -#undef ESC -#undef CSI -#undef ST -#undef OSC -#undef PM -#undef APC - -#undef ENQ -#undef BEL -#undef BS -#undef TAB -#undef LF -#undef VT -#undef FF -#undef CR -#undef SO -#undef SI -#undef DEL diff -Nru vte2.91-0.52.2/src/cell.hh vte2.91-0.54.0/src/cell.hh --- vte2.91-0.52.2/src/cell.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/cell.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2002 Red Hat, Inc. + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* The interfaces in this file are subject to change at any time. */ + +#pragma once + +#include + +#include "vteunistr.h" +#include "vtemacros.h" +#include "vtedefines.hh" + +#include "attr.hh" +#include "color-triple.hh" + +#define VTE_TAB_WIDTH_MAX ((1 << VTE_ATTR_COLUMNS_BITS) - 1) + +#define VTE_CELL_ATTR_COMMON_BYTES 12 /* The number of common bytes in VteCellAttr and VteStreamCellAttr */ + +/* + * VteCellAttr: A single cell style attributes + * + * When adding new attributes, keep in sync with VteStreamCellAttr and + * update VTE_CELL_ATTR_COMMON_BYTES accordingly. + * Also don't forget to update basic_cell below! + */ + +#define CELL_ATTR_BOOL(lname,uname) \ + inline void set_##lname(bool value) \ + { \ + vte_attr_set_bool(&attr, VTE_ATTR_##uname##_MASK, value); \ + } \ + \ + inline constexpr bool lname() const \ + { \ + return vte_attr_get_bool(attr, VTE_ATTR_##uname##_SHIFT); \ + } + +#define CELL_ATTR_UINT(lname,uname) \ + inline void set_##lname(unsigned int value) \ + { \ + vte_attr_set_value(&attr, VTE_ATTR_##uname##_MASK, VTE_ATTR_##uname##_SHIFT, value); \ + } \ + \ + inline constexpr uint32_t lname() const \ + { \ + return vte_attr_get_value(attr, VTE_ATTR_##uname##_VALUE_MASK, VTE_ATTR_##uname##_SHIFT); \ + } + +typedef struct _VTE_GNUC_PACKED VteCellAttr { + uint32_t attr; + + /* 4-byte boundary (8-byte boundary in VteCell) */ + uint64_t m_colors; /* fore, back and deco (underline) colour */ + + /* 12-byte boundary (16-byte boundary in VteCell) */ + uint32_t hyperlink_idx; /* a unique hyperlink index at a time for the ring's cells, + 0 means not a hyperlink, VTE_HYPERLINK_IDX_TARGET_IN_STREAM + means the target is irrelevant/unknown at the moment. + If bitpacking, choose a size big enough to hold a different idx + for every cell in the ring but not yet in the stream + (currently the height rounded up to the next power of two, times width) + for supported VTE sizes, and update VTE_HYPERLINK_IDX_TARGET_IN_STREAM. */ + + /* Methods */ + + inline constexpr uint64_t colors() const { return m_colors; } + + inline void copy_colors(VteCellAttr const& other) + { + m_colors = vte_color_triple_copy(other.colors()); + } + +#define CELL_ATTR_COLOR(name) \ + inline void set_##name(uint32_t value) \ + { \ + vte_color_triple_set_##name(&m_colors, value); \ + } \ + \ + inline constexpr uint32_t name() const \ + { \ + return vte_color_triple_get_##name(m_colors); \ + } + + CELL_ATTR_COLOR(fore) + CELL_ATTR_COLOR(back) + CELL_ATTR_COLOR(deco) +#undef CELL_ATTR_COLOR + + inline constexpr bool has_any(uint32_t mask) const + { + return !!(attr & mask); + } + + inline constexpr bool has_all(uint32_t mask) const + { + return (attr & mask) == mask; + } + + inline constexpr bool has_none(uint32_t mask) const + { + return !(attr & mask); + } + + inline void unset(uint32_t mask) + { + attr &= ~mask; + } + + CELL_ATTR_UINT(columns, COLUMNS) + CELL_ATTR_BOOL(fragment, FRAGMENT) + CELL_ATTR_BOOL(bold, BOLD) + CELL_ATTR_BOOL(italic, ITALIC) + CELL_ATTR_UINT(underline, UNDERLINE) + CELL_ATTR_BOOL(strikethrough, STRIKETHROUGH) + CELL_ATTR_BOOL(overline, OVERLINE) + CELL_ATTR_BOOL(reverse, REVERSE) + CELL_ATTR_BOOL(blink, BLINK) + CELL_ATTR_BOOL(dim, DIM) + CELL_ATTR_BOOL(invisible, INVISIBLE) + /* ATTR_BOOL(boxed, BOXED) */ +} VteCellAttr; +static_assert(sizeof (VteCellAttr) == 16, "VteCellAttr has wrong size"); +static_assert(offsetof (VteCellAttr, hyperlink_idx) == VTE_CELL_ATTR_COMMON_BYTES, "VteCellAttr layout is wrong"); + +/* + * VteStreamCellAttr: Variant of VteCellAttr to be stored in attr_stream. + * + * When adding new attributes, keep in sync with VteCellAttr and + * update VTE_CELL_ATTR_COMMON_BYTES accordingly. + */ + +typedef struct _VTE_GNUC_PACKED _VteStreamCellAttr { + uint32_t attr; /* Same as VteCellAttr. We only access columns + * and fragment, however. + */ + /* 4-byte boundary */ + uint64_t colors; + /* 12-byte boundary */ + guint16 hyperlink_length; /* make sure it fits VTE_HYPERLINK_TOTAL_LENGTH_MAX */ + + /* Methods */ + CELL_ATTR_UINT(columns, COLUMNS) + CELL_ATTR_BOOL(fragment, FRAGMENT) +} VteStreamCellAttr; +static_assert(sizeof (VteStreamCellAttr) == 14, "VteStreamCellAttr has wrong size"); +static_assert(offsetof (VteStreamCellAttr, hyperlink_length) == VTE_CELL_ATTR_COMMON_BYTES, "VteStreamCellAttr layout is wrong"); + +#undef CELL_ATTR_BOOL +#undef CELL_ATTR_UINT + +/* + * VteCell: A single cell's data + */ + +typedef struct _VTE_GNUC_PACKED _VteCell { + vteunistr c; + VteCellAttr attr; +} VteCell; + +static_assert(sizeof (VteCell) == 20, "VteCell has wrong size"); + +static const VteCell basic_cell = { + 0, + { + VTE_ATTR_DEFAULT, /* attr */ + VTE_COLOR_TRIPLE_INIT_DEFAULT, /* colors */ + 0, /* hyperlink_idx */ + } +}; diff -Nru vte2.91-0.52.2/src/chunk.cc vte2.91-0.54.0/src/chunk.cc --- vte2.91-0.52.2/src/chunk.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/chunk.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "chunk.hh" + +#include // offsetof +#include + +namespace vte { + +namespace base { + +static_assert(sizeof(Chunk) <= Chunk::k_chunk_size - 2 *sizeof(void*), "Chunk too large"); +static_assert(offsetof(Chunk, data) == offsetof(Chunk, dataminusone) + 1, "Chunk layout wrong"); + +void +Chunk::recycle() noexcept +{ + g_free_chunks.push(std::move(std::unique_ptr(this))); + /* FIXME: bzero out the chunk for security? */ +} + +std::stack, std::list>> Chunk::g_free_chunks; + +Chunk::unique_type +Chunk::get(void) noexcept +{ + Chunk* chunk; + if (!g_free_chunks.empty()) { + chunk = g_free_chunks.top().release(); + g_free_chunks.pop(); + + chunk->reset(); + } else { + chunk = new Chunk(); + } + + return Chunk::unique_type(chunk); +} +void +Chunk::prune(unsigned int max_size) noexcept +{ + while (g_free_chunks.size() > max_size) + g_free_chunks.pop(); +} + +} // namespace base + +} // namespace vte diff -Nru vte2.91-0.52.2/src/chunk.hh vte2.91-0.54.0/src/chunk.hh --- vte2.91-0.52.2/src/chunk.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/chunk.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include +#include + +namespace vte { + +namespace base { + +class Chunk { +private: + class Recycler { + public: + void operator()(Chunk* chunk) { + if (chunk == nullptr) + return; + chunk->recycle(); + } + }; + + void recycle() noexcept; + + static unsigned int const k_max_free_chunks = 16; + +public: + using unique_type = std::unique_ptr; + + static unsigned int const k_chunk_size = 0x2000; + + unsigned int len{0}; + uint8_t dataminusone; /* Hack: Keep it right before data, so that data[-1] is valid and usable */ + uint8_t data[k_chunk_size - 2 * sizeof(void*) - 1 - sizeof(unsigned int)]; + + Chunk() = default; + Chunk(Chunk const&) = delete; + Chunk(Chunk&&) = delete; + ~Chunk() = default; + + Chunk& operator= (Chunk const&) = delete; + Chunk& operator= (Chunk&&) = delete; + + void reset() noexcept + { + len = 0; + } + + inline constexpr size_t capacity() const noexcept { return sizeof(data); } + inline constexpr size_t remaining_capacity() const noexcept { return capacity() - len; } + + static unique_type get() noexcept; + static void prune(unsigned int max_size = k_max_free_chunks) noexcept; + +private: + + /* Note that this is using the standard deleter, not Recycler */ + static std::stack, std::list>> g_free_chunks; +}; + +} // namespace base + +} // namespace vte diff -Nru vte2.91-0.52.2/src/debug.cc vte2.91-0.54.0/src/debug.cc --- vte2.91-0.52.2/src/debug.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/debug.cc 2018-09-02 13:20:15.000000000 +0000 @@ -35,7 +35,7 @@ { "adj", VTE_DEBUG_ADJ }, { "updates", VTE_DEBUG_UPDATES }, { "events", VTE_DEBUG_EVENTS }, - { "parse", VTE_DEBUG_PARSE }, + { "parser", VTE_DEBUG_PARSER }, { "signals", VTE_DEBUG_SIGNALS }, { "selection", VTE_DEBUG_SELECTION }, { "substitution", VTE_DEBUG_SUBSTITUTION }, @@ -44,7 +44,6 @@ { "cursor", VTE_DEBUG_CURSOR }, { "keyboard", VTE_DEBUG_KEYBOARD }, { "lifecycle", VTE_DEBUG_LIFECYCLE }, - { "matcher", VTE_DEBUG_MATCHER }, { "work", VTE_DEBUG_WORK }, { "cells", VTE_DEBUG_CELLS }, { "timeout", VTE_DEBUG_TIMEOUT }, @@ -56,6 +55,8 @@ { "resize", VTE_DEBUG_RESIZE }, { "regex", VTE_DEBUG_REGEX }, { "hyperlink", VTE_DEBUG_HYPERLINK }, + { "modes", VTE_DEBUG_MODES }, + { "emulation", VTE_DEBUG_EMULATION }, }; _vte_debug_flags = g_parse_debug_string (g_getenv("VTE_DEBUG"), @@ -120,3 +121,47 @@ return NULL; #endif /* VTE_DEBUG */ } + +#ifdef VTE_DEBUG +static bool +hexdump_line(GString* str, + size_t ofs, + uint8_t const* buf, + size_t len) +{ + g_string_append_printf(str, "%08x ", (unsigned int)ofs); + for (unsigned int i = 0; i < 16; ++i) { + if (i < len) + g_string_append_printf(str, "%02x ", buf[i]); + else + g_string_append(str, " "); + if (i == 7) + g_string_append_c(str, ' '); + } + + g_string_append(str, " |"); + for (unsigned int i = 0; i < 16; ++i) { + g_string_append_c(str, i < len ? (g_ascii_isprint(buf[i]) ? buf[i] : '.') : ' '); + } + g_string_append(str, "|\n"); + return len >= 16; +} +#endif /* VTE_DEBUG */ + +void +_vte_debug_hexdump(char const* str, + uint8_t const* buf, + size_t len) +{ +#ifdef VTE_DEBUG + GString* s = g_string_new(str); + g_string_append_printf(s, " len = 0x%x = %u\n", (unsigned int)len, (unsigned int)len); + + size_t ofs = 0; + while (hexdump_line(s, ofs, buf + ofs, len - ofs)) + ofs += 16; + + g_printerr("%s", s->str); + g_string_free(s, true); +#endif /* VTE_DEBUG */ +} diff -Nru vte2.91-0.52.2/src/debug.h vte2.91-0.54.0/src/debug.h --- vte2.91-0.52.2/src/debug.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/debug.h 2018-09-02 13:20:15.000000000 +0000 @@ -22,7 +22,7 @@ #define vte_debug_h_included #include - +#include #include #ifndef VTE_COMPILATION @@ -38,7 +38,7 @@ typedef enum { VTE_DEBUG_MISC = 1 << 0, - VTE_DEBUG_PARSE = 1 << 1, + VTE_DEBUG_PARSER = 1 << 1, VTE_DEBUG_IO = 1 << 2, VTE_DEBUG_UPDATES = 1 << 3, VTE_DEBUG_EVENTS = 1 << 4, @@ -50,25 +50,30 @@ VTE_DEBUG_CURSOR = 1 << 10, VTE_DEBUG_KEYBOARD = 1 << 11, VTE_DEBUG_LIFECYCLE = 1 << 12, - VTE_DEBUG_MATCHER = 1 << 13, - VTE_DEBUG_WORK = 1 << 14, - VTE_DEBUG_CELLS = 1 << 15, - VTE_DEBUG_TIMEOUT = 1 << 16, - VTE_DEBUG_DRAW = 1 << 17, - VTE_DEBUG_ALLY = 1 << 18, - VTE_DEBUG_ADJ = 1 << 19, - VTE_DEBUG_PANGOCAIRO = 1 << 20, - VTE_DEBUG_WIDGET_SIZE = 1 << 21, - VTE_DEBUG_STYLE = 1 << 22, - VTE_DEBUG_RESIZE = 1 << 23, - VTE_DEBUG_REGEX = 1 << 24, - VTE_DEBUG_HYPERLINK = 1 << 25, + VTE_DEBUG_WORK = 1 << 13, + VTE_DEBUG_CELLS = 1 << 14, + VTE_DEBUG_TIMEOUT = 1 << 15, + VTE_DEBUG_DRAW = 1 << 16, + VTE_DEBUG_ALLY = 1 << 17, + VTE_DEBUG_ADJ = 1 << 18, + VTE_DEBUG_PANGOCAIRO = 1 << 19, + VTE_DEBUG_WIDGET_SIZE = 1 << 20, + VTE_DEBUG_STYLE = 1 << 21, + VTE_DEBUG_RESIZE = 1 << 22, + VTE_DEBUG_REGEX = 1 << 23, + VTE_DEBUG_HYPERLINK = 1 << 24, + VTE_DEBUG_MODES = 1 << 25, + VTE_DEBUG_EMULATION = 1 << 26, } VteDebugFlags; void _vte_debug_init(void); const char *_vte_debug_sequence_to_string(const char *str, gssize length); +void _vte_debug_hexdump(char const* str, + uint8_t const* buf, + size_t len); + extern guint _vte_debug_flags; static inline gboolean _vte_debug_on(guint flags) G_GNUC_CONST G_GNUC_UNUSED; diff -Nru vte2.91-0.52.2/src/interpret.cc vte2.91-0.54.0/src/interpret.cc --- vte2.91-0.52.2/src/interpret.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/interpret.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2001,2002,2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "caps.hh" -#include "debug.h" -#include "iso2022.h" -#include "matcher.hh" - -static bool quiet = false; - -static void -print_array(GValueArray* array) -{ - GValue *value; - if (array != NULL) { - g_print("("); - for (unsigned int i = 0; i < array->n_values; i++) { - value = g_value_array_get_nth(array, i); - if (i > 0) { - g_print(", "); - } - if (G_VALUE_HOLDS_LONG(value)) { - g_print("%ld", g_value_get_long(value)); - } else - if (G_VALUE_HOLDS_STRING(value)) { - g_print("\"%s\"", g_value_get_string(value)); - } else - if (G_VALUE_HOLDS_POINTER(value)) { - g_print("\"%ls\"", - (wchar_t*) g_value_get_pointer(value)); - } else - if (G_VALUE_HOLDS_BOXED(value)) { - print_array((GValueArray *)g_value_get_boxed(value)); - } - } - g_print(")"); - } -} - -namespace vte { namespace parser { struct Params { GValueArray *m_values; }; } } - -class VteTerminalPrivate { -public: -#define SEQUENCE_HANDLER(name) \ - inline void seq_ ## name (vte::parser::Params const& params) { \ - if (!quiet) { \ - g_print (G_STRINGIFY(name)); \ - print_array(params.m_values); \ - g_print("\n"); \ - } \ - } -#include "vteseq-list.hh" -#undef SEQUENCE_HANDLER -}; - -vte_matcher_entry_t const* -_vte_get_matcher_entries(unsigned int* n_entries) -{ -#include "caps-list.hh" - *n_entries = G_N_ELEMENTS (entries); - return entries; -} - -int -main(int argc, char **argv) -{ - struct _vte_matcher *matcher = NULL; - GArray *array; - unsigned char buf[4096]; - int infile; - struct _vte_iso2022_state *subst; - - setlocale(LC_ALL, ""); - - _vte_debug_init(); - - if (argc < 1) { - g_print("usage: %s [file] [--quiet]\n", argv[0]); - return 1; - } - - if ((argc > 1) && (strcmp(argv[1], "-") != 0)) { - infile = open (argv[1], O_RDONLY); - if (infile == -1) { - g_print("error opening %s: %s\n", argv[1], - strerror(errno)); - exit(1); - } - } else { - infile = 1; - } - - if (argc > 2) - quiet = g_str_equal(argv[2], "--quiet") || g_str_equal(argv[2], "-q"); - - g_type_init(); - - array = g_array_new(FALSE, FALSE, sizeof(gunichar)); - - matcher = _vte_matcher_new(); - - subst = _vte_iso2022_state_new(NULL); - - VteTerminalPrivate terminal{}; - gsize n_seq = 0; - gsize n_chars = 0; - gsize n_discarded = 0; - - gsize start = 0; - - for (;;) { - auto l = read (infile, buf, sizeof (buf)); - if (!l) - break; - if (l == -1) { - if (errno == EAGAIN) - continue; - break; - } - _vte_iso2022_process(subst, buf, (unsigned int) l, array); - - gunichar* wbuf = &g_array_index(array, gunichar, 0); - gsize wcount = array->len; - - bool leftovers = false; - - while (start < wcount && !leftovers) { - const gunichar *next; - vte::parser::Params params{nullptr}; - sequence_handler_t handler = nullptr; - auto match_result = _vte_matcher_match(matcher, - &wbuf[start], - wcount - start, - &handler, - &next, - ¶ms.m_values); - switch (match_result) { - case VTE_MATCHER_RESULT_MATCH: { - (terminal.*handler)(params); - if (params.m_values != nullptr) - _vte_matcher_free_params_array(matcher, params.m_values); - - /* Skip over the proper number of unicode chars. */ - start = (next - wbuf); - n_seq++; - break; - } - case VTE_MATCHER_RESULT_NO_MATCH: { - auto c = wbuf[start]; - /* If it's a control character, permute the order, per - * vttest. */ - if ((c != *next) && - ((*next & 0x1f) == *next) && - //FIXMEchpe what about C1 controls - (gssize(start + 1) < next - wbuf)) { - const gunichar *tnext = nullptr; - gunichar ctrl; - /* We don't want to permute it if it's another - * control sequence, so check if it is. */ - sequence_handler_t thandler; - _vte_matcher_match(matcher, - next, - wcount - (next - wbuf), - &thandler, - &tnext, - nullptr); - /* We only do this for non-control-sequence - * characters and random garbage. */ - if (tnext == next + 1) { - /* Save the control character. */ - ctrl = *next; - /* Move everything before it up a - * slot. */ - // FIXMEchpe memmove! - gsize i; - for (i = next - wbuf; i > start; i--) { - wbuf[i] = wbuf[i - 1]; - } - /* Move the control character to the - * front. */ - wbuf[i] = ctrl; - goto next_match; - } - } - n_chars++; - if (!quiet) { - if (c < 32) { - g_print("`^%c'\n", c + 64); - } else - if (c < 127) { - g_print("`%c'\n", c); - } else { - g_print("`0x%x'\n", c); - } - } - start++; - break; - } - case VTE_MATCHER_RESULT_PARTIAL: { - if (wbuf + wcount > next) { - if (!quiet) - g_print("Invalid control " - "sequence, discarding %ld " - "characters.\n", - (long)(next - (wbuf + start))); - /* Discard. */ - start = next - wbuf + 1; - n_discarded += next - &wbuf[start]; - } else { - /* Pause processing here and wait for more - * data before continuing. */ - leftovers = true; - } - break; - } - } - - } - - next_match: - if (start < wcount) { - g_array_remove_range(array, 0, start); - start = wcount - start; - } else { - g_array_set_size(array, 0); - start = 0; - } - } - if (!quiet) - g_print("End of data.\n"); - - g_printerr ("Characters inserted: %" G_GSIZE_FORMAT "\n" - "Sequences recognised: %" G_GSIZE_FORMAT "\n" - "Bytes discarded: %" G_GSIZE_FORMAT "\n", - n_chars, n_seq, n_discarded); - - close (infile); - - _vte_iso2022_state_free(subst); - g_array_free(array, TRUE); - _vte_matcher_free(matcher); - return 0; -} diff -Nru vte2.91-0.52.2/src/iso2022.cc vte2.91-0.54.0/src/iso2022.cc --- vte2.91-0.52.2/src/iso2022.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/iso2022.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2002,2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * This file used to contain a full iso2022 decoder which was removed for - * version 0.40. Now it only performs input conversion from the given - * character encoding. TODO: probably this layer could be removed completely. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" -#include "buffer.h" -#include "iso2022.h" -#include "vteconv.h" - -#ifdef HAVE_LOCALE_H -#include -#endif -#include - -#include - -/* An invalid codepoint. */ -#define INVALID_CODEPOINT 0xFFFD - -struct _vte_iso2022_state { - const gchar *codeset, *native_codeset, *utf8_codeset, *target_codeset; - VteConv conv; - VteByteArray *buffer; -}; - -struct _vte_iso2022_state * -_vte_iso2022_state_new(const char *native_codeset) -{ - struct _vte_iso2022_state *state; - - state = g_slice_new0(struct _vte_iso2022_state); - state->native_codeset = state->codeset = g_intern_string(native_codeset); - if (native_codeset == NULL) { - const char *codeset; - g_get_charset(&codeset); - state->native_codeset = state->codeset = g_intern_string(codeset); - } - state->utf8_codeset = g_intern_string("UTF-8"); - state->target_codeset = VTE_CONV_GUNICHAR_TYPE; - _vte_debug_print(VTE_DEBUG_SUBSTITUTION, - "Native codeset \"%s\", currently %s\n", - state->native_codeset, state->codeset); - state->conv = _vte_conv_open(state->target_codeset, state->codeset); - state->buffer = _vte_byte_array_new(); - if (state->conv == VTE_INVALID_CONV) { - g_warning(_("Unable to convert characters from %s to %s."), - state->codeset, state->target_codeset); - _vte_debug_print(VTE_DEBUG_SUBSTITUTION, - "Using UTF-8 instead.\n"); - state->codeset = state->utf8_codeset; - state->conv = _vte_conv_open(state->target_codeset, - state->codeset); - if (state->conv == VTE_INVALID_CONV) { - g_error(_("Unable to convert characters from %s to %s."), - state->codeset, state->target_codeset); - } - } - return state; -} - -void -_vte_iso2022_state_free(struct _vte_iso2022_state *state) -{ - _vte_byte_array_free(state->buffer); - if (state->conv != VTE_INVALID_CONV) { - _vte_conv_close(state->conv); - } - g_slice_free(struct _vte_iso2022_state, state); -} - -void -_vte_iso2022_state_set_codeset(struct _vte_iso2022_state *state, - const char *codeset) -{ - VteConv conv; - - g_return_if_fail(state != NULL); - g_return_if_fail(codeset != NULL); - g_return_if_fail(strlen(codeset) > 0); - - _vte_debug_print(VTE_DEBUG_SUBSTITUTION, "%s\n", codeset); - conv = _vte_conv_open(state->target_codeset, codeset); - if (conv == VTE_INVALID_CONV) { - g_warning(_("Unable to convert characters from %s to %s."), - codeset, state->target_codeset); - return; - } - if (state->conv != VTE_INVALID_CONV) { - _vte_conv_close(state->conv); - } - state->codeset = g_intern_string (codeset); - state->conv = conv; -} - -const char * -_vte_iso2022_state_get_codeset(struct _vte_iso2022_state *state) -{ - return state->codeset; -} - -gsize -_vte_iso2022_process(struct _vte_iso2022_state *state, - const guchar *cdata, gsize length, - GArray *gunichars) -{ - glong processed = 0; - gsize converted; - const guchar *inbuf; - gunichar *outbuf, *buf; - gsize inbytes, outbytes; - guint i, j; - gunichar c; - gboolean stop; - - inbuf = cdata; - inbytes = length; - _vte_byte_array_set_minimum_size(state->buffer, - sizeof(gunichar) * length * 2); - buf = (gunichar *)state->buffer->data; - outbuf = buf; - outbytes = sizeof(gunichar) * length * 2; - do { - converted = _vte_conv_cu(state->conv, - &inbuf, &inbytes, - &outbuf, &outbytes); - stop = FALSE; - switch (converted) { - case ((gsize)-1): - switch (errno) { - case EILSEQ: - /* Munge the input. */ - inbuf++; - inbytes--; - *outbuf++ = INVALID_CODEPOINT; - outbytes -= sizeof(gunichar); - break; - case EINVAL: - /* Incomplete. Save for later. */ - stop = TRUE; - break; - case E2BIG: - /* Should never happen. */ - g_assert_not_reached(); - break; - default: - /* Should never happen. */ - g_assert_not_reached(); - break; - } - default: - break; - } - } while ((inbytes > 0) && !stop); - - /* skip blanks -- TODOegmont: why here? */ - j = gunichars->len; - g_array_set_size(gunichars, gunichars->len + outbuf-buf); - for (i = 0; buf + i < outbuf; i++) { - c = buf[i]; - if (G_UNLIKELY (c == '\0')) { - /* Skip the padding character. */ - continue; - } - g_array_index(gunichars, gunichar, j++) = c; - } - gunichars->len = j; - - /* Done. */ - processed = length - inbytes; - - _vte_debug_print(VTE_DEBUG_SUBSTITUTION, - "Consuming %ld bytes.\n", (long) processed); - return processed; -} diff -Nru vte2.91-0.52.2/src/iso2022.h vte2.91-0.54.0/src/iso2022.h --- vte2.91-0.52.2/src/iso2022.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/iso2022.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#ifndef vte_iso2022_h_included -#define vte_iso2022_h_included - - -#include -#include -#include "buffer.h" -#include "matcher.hh" - -G_BEGIN_DECLS - -struct _vte_iso2022_state; -struct _vte_iso2022_state *_vte_iso2022_state_new(const char *native_codeset); -void _vte_iso2022_state_set_codeset(struct _vte_iso2022_state *state, - const char *codeset); -const char *_vte_iso2022_state_get_codeset(struct _vte_iso2022_state *state); -gsize _vte_iso2022_process(struct _vte_iso2022_state *state, - const guchar *input, gsize length, - GArray *gunichars); -void _vte_iso2022_state_free(struct _vte_iso2022_state *); - -G_END_DECLS - -#endif diff -Nru vte2.91-0.52.2/src/iso2022.txt vte2.91-0.54.0/src/iso2022.txt --- vte2.91-0.52.2/src/iso2022.txt 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/iso2022.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# -# Sample text using terminal national character set suppport. -# -General format: [ISO-2022] - [UTF-8] - -# -# Sample text based on XTerm's specs and random other docs. -# -US-ASCII: [(B#$@[\]^_{|}~(B] - [#$@[\]^_{|}~] -Graphics: [(0abcdefghijklmnopqrstuvwxyz_{|}~(B] - [▒␉␌␍␊°±␤␋┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥_π≠£·] -British: [(A#$@[\]^_{|}~(B] - [£$@[\]^_{|}~] diff -Nru vte2.91-0.52.2/src/Makefile.am vte2.91-0.54.0/src/Makefile.am --- vte2.91-0.52.2/src/Makefile.am 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/Makefile.am 2018-09-02 13:20:15.000000000 +0000 @@ -48,28 +48,42 @@ attr.hh \ buffer.h \ caps.hh \ - caps-list.hh \ + cell.hh \ + chunk.cc \ + chunk.hh \ color-triple.hh \ debug.cc \ debug.h \ - iso2022.cc \ - iso2022.h \ keymap.cc \ keymap.h \ - matcher.cc \ - matcher.hh \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ pty.cc \ reaper.cc \ reaper.hh \ + refptr.hh \ ring.cc \ - ring.h \ - table.cc \ - table.hh \ + ring.hh \ + utf8.cc \ + utf8.hh \ vte.cc \ vteaccess.cc \ vteaccess.h \ - vteconv.cc \ - vteconv.h \ vtedefines.hh \ vtedraw.cc \ vtedraw.hh \ @@ -81,11 +95,10 @@ vteregex.cc \ vteregexinternal.hh \ vterowdata.cc \ - vterowdata.h \ + vterowdata.hh \ vtespawn.cc \ vtespawn.hh \ vteseq.cc \ - vteseq-list.hh \ vtestream.cc \ vtestream.h \ vtestream-base.h \ @@ -96,6 +109,8 @@ vteunistr.h \ vteutils.cc \ vteutils.h \ + widget.cc \ + widget.hh \ $(NULL) nodist_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \ @@ -116,6 +131,7 @@ -DLOCALEDIR='"$(localedir)"' \ -DGLIB_DISABLE_DEPRECATION_WARNINGS \ -DVTE_COMPILATION \ + -UPARSER_INCLUDE_NOP \ -I$(builddir)/vte \ -I$(srcdir)/vte \ $(AM_CPPFLAGS) @@ -142,7 +158,7 @@ vte/vtetypebuiltins.h \ vteresources.cc \ $(NULL) -EXTRA_DIST += box_drawing.txt box_drawing_generate.sh iso2022.txt +EXTRA_DIST += box_drawing.txt box_drawing_generate.sh CLEANFILES += $(BUILT_SOURCES) stamp-vtetypebuiltins.h box_drawing.h: box_drawing.txt box_drawing_generate.sh @@ -173,7 +189,7 @@ # Misc unit tests and utilities -noinst_PROGRAMS += interpret slowcat +noinst_PROGRAMS += parser-cat slowcat test-modes test-tabstops test-parser test-refptr test-utf8 noinst_SCRIPTS = decset osc window EXTRA_DIST += $(noinst_SCRIPTS) @@ -183,7 +199,6 @@ reflect-text-view \ reflect-vte mev \ xticker \ - vteconv \ vtestream-file \ test-vtetypes \ $(NULL) @@ -194,9 +209,13 @@ $(NULL) TESTS = \ + test-modes \ + test-parser \ + test-refptr \ + test-tabstops \ + test-utf8 \ reaper \ test-vtetypes \ - vteconv \ vtestream-file \ $(dist_check_SCRIPTS) \ $(NULL) @@ -227,40 +246,42 @@ reflect_vte_SOURCES = reflect.c reflect_vte_LDADD = libvte-$(VTE_API_VERSION).la $(VTE_LIBS) -interpret_SOURCES = \ +parser_cat_SOURCES = \ buffer.h \ caps.hh \ - caps-list.hh \ debug.cc \ debug.h \ - iso2022.cc \ - iso2022.h \ - matcher.cc \ - matcher.hh \ - table.cc \ - table.hh \ - vteconv.cc \ - vteconv.h \ - interpret.cc -interpret_CPPFLAGS = \ - -DINTERPRET_MAIN \ - -DVTE_API_VERSION=\"$(VTE_API_VERSION)\" \ + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + parser-cat.cc \ + utf8.cc \ + utf8.hh \ + $(NULL) +parser_cat_CPPFLAGS = \ -I$(builddir) \ -I$(srcdir) \ + -DPARSER_INCLUDE_NOP \ $(AM_CPPFLAGS) -interpret_CFLAGS = \ +parser_cat_CFLAGS = \ $(GLIB_CFLAGS) \ - $(GOBJECT_CFLAGS) \ - $(GTK_CFLAGS) \ $(AM_CFLAGS) -interpret_CXXFLAGS = \ +parser_cat_CXXFLAGS = \ $(GLIB_CFLAGS) \ - $(GOBJECT_CFLAGS) \ - $(GTK_CFLAGS) \ $(AM_CXXFLAGS) -interpret_LDADD = \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) +parser_cat_LDADD = \ + $(GLIB_LIBS) slowcat_SOURCES = \ slowcat.c \ @@ -269,6 +290,98 @@ slowcat_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) slowcat_LDADD = $(GLIB_LIBS) +test_parser_SOURCES = \ + parser-test.cc \ + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + $(NULL) +test_parser_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + -DPARSER_INCLUDE_NOP \ + $(AM_CPPFLAGS) +test_parser_CXXFLAGS = \ + $(VTE_CFLAGS) \ + $(AM_CXXFLAGS) +test_parser_LDADD = \ + $(VTE_LIBS) \ + $(NULL) + +test_modes_SOURCES = \ + modes-test.cc \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + $(NULL) +test_modes_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) +test_modes_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) +test_modes_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + +test_tabstops_SOURCES = \ + tabstops-test.cc \ + tabstops.hh \ + $(NULL) +test_tabstops_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) +test_tabstops_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) +test_tabstops_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + +test_refptr_SOURCES = \ + refptr.hh \ + refptr-test.cc \ + $(NULL) +test_refptr_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) +test_refptr_CXXFLAGS = \ + $(GOBJECT_CFLAGS) \ + $(AM_CXXFLAGS) +test_refptr_LDADD = \ + $(GOBJECT_LIBS) \ + $(NULL) + +test_utf8_SOURCES = \ + utf8-test.cc \ + utf8.cc \ + utf8.hh \ + $(NULL) +test_utf8_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) +test_utf8_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) +test_utf8_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + test_vtetypes_SOURCES = \ vtetypes.cc \ vtetypes.hh \ @@ -304,11 +417,6 @@ vtestream_file_LDADD = \ $(VTE_LIBS) -vteconv_SOURCES = buffer.h debug.cc debug.h vteconv.cc vteconv.h -vteconv_CPPFLAGS = -DVTECONV_MAIN -I$(builddir) -I$(srcdir) $(AM_CPPFLAGS) -vteconv_CXXFLAGS = $(VTE_CFLAGS) $(AM_CXXFLAGS) -vteconv_LDADD = $(VTE_LIBS) - dumpkeys_SOURCES = dumpkeys.c dumpkeys_CPPFLAGS = -I$(builddir) -I$(srcdir) $(AM_CPPFLAGS) dumpkeys_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) diff -Nru vte2.91-0.52.2/src/Makefile.in vte2.91-0.54.0/src/Makefile.in --- vte2.91-0.52.2/src/Makefile.in 2018-05-21 19:32:17.000000000 +0000 +++ vte2.91-0.54.0/src/Makefile.in 2018-09-02 13:20:47.000000000 +0000 @@ -93,13 +93,16 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = -noinst_PROGRAMS = interpret$(EXEEXT) slowcat$(EXEEXT) +noinst_PROGRAMS = parser-cat$(EXEEXT) slowcat$(EXEEXT) \ + test-modes$(EXEEXT) test-tabstops$(EXEEXT) \ + test-parser$(EXEEXT) test-refptr$(EXEEXT) test-utf8$(EXEEXT) check_PROGRAMS = dumpkeys$(EXEEXT) reaper$(EXEEXT) \ reflect-text-view$(EXEEXT) reflect-vte$(EXEEXT) mev$(EXEEXT) \ - xticker$(EXEEXT) vteconv$(EXEEXT) vtestream-file$(EXEEXT) \ + xticker$(EXEEXT) vtestream-file$(EXEEXT) \ test-vtetypes$(EXEEXT) -TESTS = reaper$(EXEEXT) test-vtetypes$(EXEEXT) vteconv$(EXEEXT) \ - vtestream-file$(EXEEXT) $(am__EXEEXT_1) +TESTS = test-modes$(EXEEXT) test-parser$(EXEEXT) test-refptr$(EXEEXT) \ + test-tabstops$(EXEEXT) test-utf8$(EXEEXT) reaper$(EXEEXT) \ + test-vtetypes$(EXEEXT) vtestream-file$(EXEEXT) $(am__EXEEXT_1) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ @@ -150,17 +153,16 @@ am__DEPENDENCIES_1 = libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_DEPENDENCIES = \ $(am__DEPENDENCIES_1) -am_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_OBJECTS = libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo \ - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo \ +am_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_OBJECTS = libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo \ + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.lo \ - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo \ + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-reaper.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-ring.lo \ - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo \ + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteaccess.lo \ - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtegtk.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteregex.lo \ @@ -170,7 +172,8 @@ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtestream.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtetypes.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteunistr.lo \ - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteutils.lo + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteutils.lo \ + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo nodist_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_OBJECTS = libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteresources.lo \ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtetypebuiltins.lo @@ -194,21 +197,20 @@ dumpkeys_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dumpkeys_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_interpret_OBJECTS = interpret-debug.$(OBJEXT) \ - interpret-iso2022.$(OBJEXT) interpret-matcher.$(OBJEXT) \ - interpret-table.$(OBJEXT) interpret-vteconv.$(OBJEXT) \ - interpret-interpret.$(OBJEXT) -interpret_OBJECTS = $(am_interpret_OBJECTS) -interpret_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -interpret_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(interpret_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_mev_OBJECTS = mev-mev.$(OBJEXT) mev_OBJECTS = $(am_mev_OBJECTS) mev_DEPENDENCIES = $(am__DEPENDENCIES_1) mev_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(mev_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_parser_cat_OBJECTS = parser_cat-debug.$(OBJEXT) \ + parser_cat-parser.$(OBJEXT) parser_cat-parser-cat.$(OBJEXT) \ + parser_cat-utf8.$(OBJEXT) +parser_cat_OBJECTS = $(am_parser_cat_OBJECTS) +parser_cat_DEPENDENCIES = $(am__DEPENDENCIES_1) +parser_cat_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(parser_cat_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_reaper_OBJECTS = reaper-debug.$(OBJEXT) reaper-reaper.$(OBJEXT) reaper_OBJECTS = $(am_reaper_OBJECTS) reaper_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -235,6 +237,39 @@ slowcat_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(slowcat_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_modes_OBJECTS = test_modes-modes-test.$(OBJEXT) +test_modes_OBJECTS = $(am_test_modes_OBJECTS) +test_modes_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_modes_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(test_modes_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_parser_OBJECTS = test_parser-parser-test.$(OBJEXT) \ + test_parser-parser.$(OBJEXT) +test_parser_OBJECTS = $(am_test_parser_OBJECTS) +test_parser_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_parser_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(test_parser_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_refptr_OBJECTS = test_refptr-refptr-test.$(OBJEXT) +test_refptr_OBJECTS = $(am_test_refptr_OBJECTS) +test_refptr_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_refptr_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(test_refptr_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_tabstops_OBJECTS = test_tabstops-tabstops-test.$(OBJEXT) +test_tabstops_OBJECTS = $(am_test_tabstops_OBJECTS) +test_tabstops_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_tabstops_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(test_tabstops_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_utf8_OBJECTS = test_utf8-utf8-test.$(OBJEXT) \ + test_utf8-utf8.$(OBJEXT) +test_utf8_OBJECTS = $(am_test_utf8_OBJECTS) +test_utf8_DEPENDENCIES = $(am__DEPENDENCIES_1) +test_utf8_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(test_utf8_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_test_vtetypes_OBJECTS = test_vtetypes-vtetypes.$(OBJEXT) test_vtetypes_OBJECTS = $(am_test_vtetypes_OBJECTS) test_vtetypes_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -242,12 +277,6 @@ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(test_vtetypes_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ -am_vteconv_OBJECTS = vteconv-debug.$(OBJEXT) vteconv-vteconv.$(OBJEXT) -vteconv_OBJECTS = $(am_vteconv_OBJECTS) -vteconv_DEPENDENCIES = $(am__DEPENDENCIES_1) -vteconv_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(vteconv_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_vtestream_file_OBJECTS = vtestream_file-vtestream.$(OBJEXT) \ vtestream_file-vteutils.$(OBJEXT) vtestream_file_OBJECTS = $(am_vtestream_file_OBJECTS) @@ -318,17 +347,21 @@ SOURCES = $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES) \ $(EXTRA_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES) \ $(nodist_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES) \ - $(dumpkeys_SOURCES) $(interpret_SOURCES) $(mev_SOURCES) \ + $(dumpkeys_SOURCES) $(mev_SOURCES) $(parser_cat_SOURCES) \ $(reaper_SOURCES) $(reflect_text_view_SOURCES) \ $(reflect_vte_SOURCES) $(slowcat_SOURCES) \ - $(test_vtetypes_SOURCES) $(vteconv_SOURCES) \ + $(test_modes_SOURCES) $(test_parser_SOURCES) \ + $(test_refptr_SOURCES) $(test_tabstops_SOURCES) \ + $(test_utf8_SOURCES) $(test_vtetypes_SOURCES) \ $(vtestream_file_SOURCES) $(xticker_SOURCES) DIST_SOURCES = $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES) \ $(EXTRA_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES) \ - $(dumpkeys_SOURCES) $(interpret_SOURCES) $(mev_SOURCES) \ + $(dumpkeys_SOURCES) $(mev_SOURCES) $(parser_cat_SOURCES) \ $(reaper_SOURCES) $(reflect_text_view_SOURCES) \ $(reflect_vte_SOURCES) $(slowcat_SOURCES) \ - $(test_vtetypes_SOURCES) $(vteconv_SOURCES) \ + $(test_modes_SOURCES) $(test_parser_SOURCES) \ + $(test_refptr_SOURCES) $(test_tabstops_SOURCES) \ + $(test_utf8_SOURCES) $(test_vtetypes_SOURCES) \ $(vtestream_file_SOURCES) $(xticker_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ @@ -646,7 +679,7 @@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ GTK_PREFIX = @GTK_PREFIX@ -HAVE_CXX11 = @HAVE_CXX11@ +HAVE_CXX14 = @HAVE_CXX14@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -796,8 +829,7 @@ CLEANFILES = $(BUILT_SOURCES) stamp-vtetypebuiltins.h DISTCLEANFILES = MAINTAINERCLEANFILES = -EXTRA_DIST = box_drawing.txt box_drawing_generate.sh iso2022.txt \ - $(noinst_SCRIPTS) +EXTRA_DIST = box_drawing.txt box_drawing_generate.sh $(noinst_SCRIPTS) # The library headerdir = $(includedir)/vte-$(VTE_API_VERSION)/vte @@ -837,28 +869,42 @@ attr.hh \ buffer.h \ caps.hh \ - caps-list.hh \ + cell.hh \ + chunk.cc \ + chunk.hh \ color-triple.hh \ debug.cc \ debug.h \ - iso2022.cc \ - iso2022.h \ keymap.cc \ keymap.h \ - matcher.cc \ - matcher.hh \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ pty.cc \ reaper.cc \ reaper.hh \ + refptr.hh \ ring.cc \ - ring.h \ - table.cc \ - table.hh \ + ring.hh \ + utf8.cc \ + utf8.hh \ vte.cc \ vteaccess.cc \ vteaccess.h \ - vteconv.cc \ - vteconv.h \ vtedefines.hh \ vtedraw.cc \ vtedraw.hh \ @@ -870,11 +916,10 @@ vteregex.cc \ vteregexinternal.hh \ vterowdata.cc \ - vterowdata.h \ + vterowdata.hh \ vtespawn.cc \ vtespawn.hh \ vteseq.cc \ - vteseq-list.hh \ vtestream.cc \ vtestream.h \ vtestream-base.h \ @@ -885,6 +930,8 @@ vteunistr.h \ vteutils.cc \ vteutils.h \ + widget.cc \ + widget.hh \ $(NULL) nodist_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \ @@ -905,6 +952,7 @@ -DLOCALEDIR='"$(localedir)"' \ -DGLIB_DISABLE_DEPRECATION_WARNINGS \ -DVTE_COMPILATION \ + -UPARSER_INCLUDE_NOP \ -I$(builddir)/vte \ -I$(srcdir)/vte \ $(AM_CPPFLAGS) @@ -962,44 +1010,46 @@ reflect_vte_CFLAGS = $(VTE_CFLAGS) $(AM_CFLAGS) reflect_vte_SOURCES = reflect.c reflect_vte_LDADD = libvte-$(VTE_API_VERSION).la $(VTE_LIBS) -interpret_SOURCES = \ +parser_cat_SOURCES = \ buffer.h \ caps.hh \ - caps-list.hh \ debug.cc \ debug.h \ - iso2022.cc \ - iso2022.h \ - matcher.cc \ - matcher.hh \ - table.cc \ - table.hh \ - vteconv.cc \ - vteconv.h \ - interpret.cc + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + parser-cat.cc \ + utf8.cc \ + utf8.hh \ + $(NULL) -interpret_CPPFLAGS = \ - -DINTERPRET_MAIN \ - -DVTE_API_VERSION=\"$(VTE_API_VERSION)\" \ +parser_cat_CPPFLAGS = \ -I$(builddir) \ -I$(srcdir) \ + -DPARSER_INCLUDE_NOP \ $(AM_CPPFLAGS) -interpret_CFLAGS = \ +parser_cat_CFLAGS = \ $(GLIB_CFLAGS) \ - $(GOBJECT_CFLAGS) \ - $(GTK_CFLAGS) \ $(AM_CFLAGS) -interpret_CXXFLAGS = \ +parser_cat_CXXFLAGS = \ $(GLIB_CFLAGS) \ - $(GOBJECT_CFLAGS) \ - $(GTK_CFLAGS) \ $(AM_CXXFLAGS) -interpret_LDADD = \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) +parser_cat_LDADD = \ + $(GLIB_LIBS) slowcat_SOURCES = \ slowcat.c \ @@ -1008,6 +1058,113 @@ slowcat_CPPFLAGS = -I$(builddir) -I$(srcdir) $(AM_CPPFLAGS) slowcat_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) slowcat_LDADD = $(GLIB_LIBS) +test_parser_SOURCES = \ + parser-test.cc \ + parser.cc \ + parser.hh \ + parser-arg.hh \ + parser-charset.hh \ + parser-charset-tables.hh \ + parser-cmd.hh \ + parser-c01.hh \ + parser-csi.hh \ + parser-dcs.hh \ + parser-esc.hh \ + parser-glue.hh \ + parser-osc.hh \ + parser-reply.hh \ + parser-string.hh \ + $(NULL) + +test_parser_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + -DPARSER_INCLUDE_NOP \ + $(AM_CPPFLAGS) + +test_parser_CXXFLAGS = \ + $(VTE_CFLAGS) \ + $(AM_CXXFLAGS) + +test_parser_LDADD = \ + $(VTE_LIBS) \ + $(NULL) + +test_modes_SOURCES = \ + modes-test.cc \ + modes.hh \ + modes-ecma.hh \ + modes-private.hh \ + $(NULL) + +test_modes_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) + +test_modes_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) + +test_modes_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + +test_tabstops_SOURCES = \ + tabstops-test.cc \ + tabstops.hh \ + $(NULL) + +test_tabstops_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) + +test_tabstops_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) + +test_tabstops_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + +test_refptr_SOURCES = \ + refptr.hh \ + refptr-test.cc \ + $(NULL) + +test_refptr_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) + +test_refptr_CXXFLAGS = \ + $(GOBJECT_CFLAGS) \ + $(AM_CXXFLAGS) + +test_refptr_LDADD = \ + $(GOBJECT_LIBS) \ + $(NULL) + +test_utf8_SOURCES = \ + utf8-test.cc \ + utf8.cc \ + utf8.hh \ + $(NULL) + +test_utf8_CPPFLAGS = \ + -I$(builddir) \ + -I$(srcdir) \ + $(AM_CPPFLAGS) + +test_utf8_CXXFLAGS = \ + $(GLIB_CFLAGS) \ + $(AM_CXXFLAGS) + +test_utf8_LDADD = \ + $(GLIB_LIBS) \ + $(NULL) + test_vtetypes_SOURCES = \ vtetypes.cc \ vtetypes.hh \ @@ -1049,10 +1206,6 @@ vtestream_file_LDADD = \ $(VTE_LIBS) -vteconv_SOURCES = buffer.h debug.cc debug.h vteconv.cc vteconv.h -vteconv_CPPFLAGS = -DVTECONV_MAIN -I$(builddir) -I$(srcdir) $(AM_CPPFLAGS) -vteconv_CXXFLAGS = $(VTE_CFLAGS) $(AM_CXXFLAGS) -vteconv_LDADD = $(VTE_LIBS) dumpkeys_SOURCES = dumpkeys.c dumpkeys_CPPFLAGS = -I$(builddir) -I$(srcdir) $(AM_CPPFLAGS) dumpkeys_CFLAGS = $(GLIB_CFLAGS) $(AM_CFLAGS) @@ -1215,14 +1368,14 @@ @rm -f dumpkeys$(EXEEXT) $(AM_V_CCLD)$(dumpkeys_LINK) $(dumpkeys_OBJECTS) $(dumpkeys_LDADD) $(LIBS) -interpret$(EXEEXT): $(interpret_OBJECTS) $(interpret_DEPENDENCIES) $(EXTRA_interpret_DEPENDENCIES) - @rm -f interpret$(EXEEXT) - $(AM_V_CXXLD)$(interpret_LINK) $(interpret_OBJECTS) $(interpret_LDADD) $(LIBS) - mev$(EXEEXT): $(mev_OBJECTS) $(mev_DEPENDENCIES) $(EXTRA_mev_DEPENDENCIES) @rm -f mev$(EXEEXT) $(AM_V_CCLD)$(mev_LINK) $(mev_OBJECTS) $(mev_LDADD) $(LIBS) +parser-cat$(EXEEXT): $(parser_cat_OBJECTS) $(parser_cat_DEPENDENCIES) $(EXTRA_parser_cat_DEPENDENCIES) + @rm -f parser-cat$(EXEEXT) + $(AM_V_CXXLD)$(parser_cat_LINK) $(parser_cat_OBJECTS) $(parser_cat_LDADD) $(LIBS) + reaper$(EXEEXT): $(reaper_OBJECTS) $(reaper_DEPENDENCIES) $(EXTRA_reaper_DEPENDENCIES) @rm -f reaper$(EXEEXT) $(AM_V_CXXLD)$(reaper_LINK) $(reaper_OBJECTS) $(reaper_LDADD) $(LIBS) @@ -1239,14 +1392,30 @@ @rm -f slowcat$(EXEEXT) $(AM_V_CCLD)$(slowcat_LINK) $(slowcat_OBJECTS) $(slowcat_LDADD) $(LIBS) +test-modes$(EXEEXT): $(test_modes_OBJECTS) $(test_modes_DEPENDENCIES) $(EXTRA_test_modes_DEPENDENCIES) + @rm -f test-modes$(EXEEXT) + $(AM_V_CXXLD)$(test_modes_LINK) $(test_modes_OBJECTS) $(test_modes_LDADD) $(LIBS) + +test-parser$(EXEEXT): $(test_parser_OBJECTS) $(test_parser_DEPENDENCIES) $(EXTRA_test_parser_DEPENDENCIES) + @rm -f test-parser$(EXEEXT) + $(AM_V_CXXLD)$(test_parser_LINK) $(test_parser_OBJECTS) $(test_parser_LDADD) $(LIBS) + +test-refptr$(EXEEXT): $(test_refptr_OBJECTS) $(test_refptr_DEPENDENCIES) $(EXTRA_test_refptr_DEPENDENCIES) + @rm -f test-refptr$(EXEEXT) + $(AM_V_CXXLD)$(test_refptr_LINK) $(test_refptr_OBJECTS) $(test_refptr_LDADD) $(LIBS) + +test-tabstops$(EXEEXT): $(test_tabstops_OBJECTS) $(test_tabstops_DEPENDENCIES) $(EXTRA_test_tabstops_DEPENDENCIES) + @rm -f test-tabstops$(EXEEXT) + $(AM_V_CXXLD)$(test_tabstops_LINK) $(test_tabstops_OBJECTS) $(test_tabstops_LDADD) $(LIBS) + +test-utf8$(EXEEXT): $(test_utf8_OBJECTS) $(test_utf8_DEPENDENCIES) $(EXTRA_test_utf8_DEPENDENCIES) + @rm -f test-utf8$(EXEEXT) + $(AM_V_CXXLD)$(test_utf8_LINK) $(test_utf8_OBJECTS) $(test_utf8_LDADD) $(LIBS) + test-vtetypes$(EXEEXT): $(test_vtetypes_OBJECTS) $(test_vtetypes_DEPENDENCIES) $(EXTRA_test_vtetypes_DEPENDENCIES) @rm -f test-vtetypes$(EXEEXT) $(AM_V_CXXLD)$(test_vtetypes_LINK) $(test_vtetypes_OBJECTS) $(test_vtetypes_LDADD) $(LIBS) -vteconv$(EXEEXT): $(vteconv_OBJECTS) $(vteconv_DEPENDENCIES) $(EXTRA_vteconv_DEPENDENCIES) - @rm -f vteconv$(EXEEXT) - $(AM_V_CXXLD)$(vteconv_LINK) $(vteconv_OBJECTS) $(vteconv_LDADD) $(LIBS) - vtestream-file$(EXEEXT): $(vtestream_file_OBJECTS) $(vtestream_file_DEPENDENCIES) $(EXTRA_vtestream_file_DEPENDENCIES) @rm -f vtestream-file$(EXEEXT) $(AM_V_CXXLD)$(vtestream_file_LINK) $(vtestream_file_OBJECTS) $(vtestream_file_LDADD) $(LIBS) @@ -1262,24 +1431,17 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpkeys-dumpkeys.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-debug.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-interpret.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-iso2022.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-matcher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-table.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret-vteconv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-reaper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-ring.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteaccess.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtegtk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteregex.Plo@am__quote@ @@ -1292,15 +1454,25 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtetypes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteunistr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteutils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mev-mev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser_cat-debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser_cat-parser-cat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser_cat-parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser_cat-utf8.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reaper-debug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reaper-reaper.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect_text_view-reflect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect_vte-reflect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slowcat-slowcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_modes-modes-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_parser-parser-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_parser-parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_refptr-refptr-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tabstops-tabstops-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utf8-utf8-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utf8-utf8.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_vtetypes-vtetypes.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vteconv-debug.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vteconv-vteconv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtestream_file-vtestream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vtestream_file-vteutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xticker-xticker.Po@am__quote@ @@ -1431,6 +1603,13 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< +libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo: chunk.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo `test -f 'chunk.cc' || echo '$(srcdir)/'`chunk.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chunk.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-chunk.lo `test -f 'chunk.cc' || echo '$(srcdir)/'`chunk.cc + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo: debug.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.Plo @@ -1438,13 +1617,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-debug.lo `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc -libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo: iso2022.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo `test -f 'iso2022.cc' || echo '$(srcdir)/'`iso2022.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='iso2022.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-iso2022.lo `test -f 'iso2022.cc' || echo '$(srcdir)/'`iso2022.cc - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.lo: keymap.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.lo `test -f 'keymap.cc' || echo '$(srcdir)/'`keymap.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.Plo @@ -1452,12 +1624,12 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-keymap.lo `test -f 'keymap.cc' || echo '$(srcdir)/'`keymap.cc -libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo: matcher.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo `test -f 'matcher.cc' || echo '$(srcdir)/'`matcher.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='matcher.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo' libtool=yes @AMDEPBACKSLASH@ +libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo: parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-matcher.lo `test -f 'matcher.cc' || echo '$(srcdir)/'`matcher.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-parser.lo `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.lo: pty.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-pty.lo `test -f 'pty.cc' || echo '$(srcdir)/'`pty.cc @@ -1480,12 +1652,12 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-ring.lo `test -f 'ring.cc' || echo '$(srcdir)/'`ring.cc -libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo: table.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo `test -f 'table.cc' || echo '$(srcdir)/'`table.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='table.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo' libtool=yes @AMDEPBACKSLASH@ +libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo: utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-table.lo `test -f 'table.cc' || echo '$(srcdir)/'`table.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-utf8.lo `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.lo: vte.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vte.lo `test -f 'vte.cc' || echo '$(srcdir)/'`vte.cc @@ -1501,13 +1673,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteaccess.lo `test -f 'vteaccess.cc' || echo '$(srcdir)/'`vteaccess.cc -libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo: vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='vteconv.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteconv.lo `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc - libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.lo: vtedraw.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.lo `test -f 'vtedraw.cc' || echo '$(srcdir)/'`vtedraw.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtedraw.Plo @@ -1578,6 +1743,13 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vteutils.lo `test -f 'vteutils.cc' || echo '$(srcdir)/'`vteutils.cc +libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo: widget.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo `test -f 'widget.cc' || echo '$(srcdir)/'`widget.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='widget.cc' object='libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-widget.lo `test -f 'widget.cc' || echo '$(srcdir)/'`widget.cc + libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.lo: marshal.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -MT libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.lo -MD -MP -MF $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.Tpo -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.lo `test -f 'marshal.cc' || echo '$(srcdir)/'`marshal.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.Tpo $(DEPDIR)/libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-marshal.Plo @@ -1599,89 +1771,61 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS) $(CPPFLAGS) $(libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CXXFLAGS) $(CXXFLAGS) -c -o libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la-vtetypebuiltins.lo `test -f 'vtetypebuiltins.cc' || echo '$(srcdir)/'`vtetypebuiltins.cc -interpret-debug.o: debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-debug.o -MD -MP -MF $(DEPDIR)/interpret-debug.Tpo -c -o interpret-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-debug.Tpo $(DEPDIR)/interpret-debug.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='interpret-debug.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc - -interpret-debug.obj: debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-debug.obj -MD -MP -MF $(DEPDIR)/interpret-debug.Tpo -c -o interpret-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-debug.Tpo $(DEPDIR)/interpret-debug.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='interpret-debug.obj' libtool=no @AMDEPBACKSLASH@ +parser_cat-debug.o: debug.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-debug.o -MD -MP -MF $(DEPDIR)/parser_cat-debug.Tpo -c -o parser_cat-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-debug.Tpo $(DEPDIR)/parser_cat-debug.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='parser_cat-debug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc -interpret-iso2022.o: iso2022.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-iso2022.o -MD -MP -MF $(DEPDIR)/interpret-iso2022.Tpo -c -o interpret-iso2022.o `test -f 'iso2022.cc' || echo '$(srcdir)/'`iso2022.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-iso2022.Tpo $(DEPDIR)/interpret-iso2022.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='iso2022.cc' object='interpret-iso2022.o' libtool=no @AMDEPBACKSLASH@ +parser_cat-debug.obj: debug.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-debug.obj -MD -MP -MF $(DEPDIR)/parser_cat-debug.Tpo -c -o parser_cat-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-debug.Tpo $(DEPDIR)/parser_cat-debug.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='parser_cat-debug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-iso2022.o `test -f 'iso2022.cc' || echo '$(srcdir)/'`iso2022.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` -interpret-iso2022.obj: iso2022.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-iso2022.obj -MD -MP -MF $(DEPDIR)/interpret-iso2022.Tpo -c -o interpret-iso2022.obj `if test -f 'iso2022.cc'; then $(CYGPATH_W) 'iso2022.cc'; else $(CYGPATH_W) '$(srcdir)/iso2022.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-iso2022.Tpo $(DEPDIR)/interpret-iso2022.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='iso2022.cc' object='interpret-iso2022.obj' libtool=no @AMDEPBACKSLASH@ +parser_cat-parser.o: parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-parser.o -MD -MP -MF $(DEPDIR)/parser_cat-parser.Tpo -c -o parser_cat-parser.o `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-parser.Tpo $(DEPDIR)/parser_cat-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.cc' object='parser_cat-parser.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-iso2022.obj `if test -f 'iso2022.cc'; then $(CYGPATH_W) 'iso2022.cc'; else $(CYGPATH_W) '$(srcdir)/iso2022.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-parser.o `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc -interpret-matcher.o: matcher.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-matcher.o -MD -MP -MF $(DEPDIR)/interpret-matcher.Tpo -c -o interpret-matcher.o `test -f 'matcher.cc' || echo '$(srcdir)/'`matcher.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-matcher.Tpo $(DEPDIR)/interpret-matcher.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='matcher.cc' object='interpret-matcher.o' libtool=no @AMDEPBACKSLASH@ +parser_cat-parser.obj: parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-parser.obj -MD -MP -MF $(DEPDIR)/parser_cat-parser.Tpo -c -o parser_cat-parser.obj `if test -f 'parser.cc'; then $(CYGPATH_W) 'parser.cc'; else $(CYGPATH_W) '$(srcdir)/parser.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-parser.Tpo $(DEPDIR)/parser_cat-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.cc' object='parser_cat-parser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-matcher.o `test -f 'matcher.cc' || echo '$(srcdir)/'`matcher.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-parser.obj `if test -f 'parser.cc'; then $(CYGPATH_W) 'parser.cc'; else $(CYGPATH_W) '$(srcdir)/parser.cc'; fi` -interpret-matcher.obj: matcher.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-matcher.obj -MD -MP -MF $(DEPDIR)/interpret-matcher.Tpo -c -o interpret-matcher.obj `if test -f 'matcher.cc'; then $(CYGPATH_W) 'matcher.cc'; else $(CYGPATH_W) '$(srcdir)/matcher.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-matcher.Tpo $(DEPDIR)/interpret-matcher.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='matcher.cc' object='interpret-matcher.obj' libtool=no @AMDEPBACKSLASH@ +parser_cat-parser-cat.o: parser-cat.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-parser-cat.o -MD -MP -MF $(DEPDIR)/parser_cat-parser-cat.Tpo -c -o parser_cat-parser-cat.o `test -f 'parser-cat.cc' || echo '$(srcdir)/'`parser-cat.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-parser-cat.Tpo $(DEPDIR)/parser_cat-parser-cat.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser-cat.cc' object='parser_cat-parser-cat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-matcher.obj `if test -f 'matcher.cc'; then $(CYGPATH_W) 'matcher.cc'; else $(CYGPATH_W) '$(srcdir)/matcher.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-parser-cat.o `test -f 'parser-cat.cc' || echo '$(srcdir)/'`parser-cat.cc -interpret-table.o: table.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-table.o -MD -MP -MF $(DEPDIR)/interpret-table.Tpo -c -o interpret-table.o `test -f 'table.cc' || echo '$(srcdir)/'`table.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-table.Tpo $(DEPDIR)/interpret-table.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='table.cc' object='interpret-table.o' libtool=no @AMDEPBACKSLASH@ +parser_cat-parser-cat.obj: parser-cat.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-parser-cat.obj -MD -MP -MF $(DEPDIR)/parser_cat-parser-cat.Tpo -c -o parser_cat-parser-cat.obj `if test -f 'parser-cat.cc'; then $(CYGPATH_W) 'parser-cat.cc'; else $(CYGPATH_W) '$(srcdir)/parser-cat.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-parser-cat.Tpo $(DEPDIR)/parser_cat-parser-cat.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser-cat.cc' object='parser_cat-parser-cat.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-table.o `test -f 'table.cc' || echo '$(srcdir)/'`table.cc +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-parser-cat.obj `if test -f 'parser-cat.cc'; then $(CYGPATH_W) 'parser-cat.cc'; else $(CYGPATH_W) '$(srcdir)/parser-cat.cc'; fi` -interpret-table.obj: table.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-table.obj -MD -MP -MF $(DEPDIR)/interpret-table.Tpo -c -o interpret-table.obj `if test -f 'table.cc'; then $(CYGPATH_W) 'table.cc'; else $(CYGPATH_W) '$(srcdir)/table.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-table.Tpo $(DEPDIR)/interpret-table.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='table.cc' object='interpret-table.obj' libtool=no @AMDEPBACKSLASH@ +parser_cat-utf8.o: utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-utf8.o -MD -MP -MF $(DEPDIR)/parser_cat-utf8.Tpo -c -o parser_cat-utf8.o `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-utf8.Tpo $(DEPDIR)/parser_cat-utf8.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8.cc' object='parser_cat-utf8.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-table.obj `if test -f 'table.cc'; then $(CYGPATH_W) 'table.cc'; else $(CYGPATH_W) '$(srcdir)/table.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-utf8.o `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc -interpret-vteconv.o: vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-vteconv.o -MD -MP -MF $(DEPDIR)/interpret-vteconv.Tpo -c -o interpret-vteconv.o `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-vteconv.Tpo $(DEPDIR)/interpret-vteconv.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='vteconv.cc' object='interpret-vteconv.o' libtool=no @AMDEPBACKSLASH@ +parser_cat-utf8.obj: utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -MT parser_cat-utf8.obj -MD -MP -MF $(DEPDIR)/parser_cat-utf8.Tpo -c -o parser_cat-utf8.obj `if test -f 'utf8.cc'; then $(CYGPATH_W) 'utf8.cc'; else $(CYGPATH_W) '$(srcdir)/utf8.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parser_cat-utf8.Tpo $(DEPDIR)/parser_cat-utf8.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8.cc' object='parser_cat-utf8.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-vteconv.o `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc - -interpret-vteconv.obj: vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-vteconv.obj -MD -MP -MF $(DEPDIR)/interpret-vteconv.Tpo -c -o interpret-vteconv.obj `if test -f 'vteconv.cc'; then $(CYGPATH_W) 'vteconv.cc'; else $(CYGPATH_W) '$(srcdir)/vteconv.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-vteconv.Tpo $(DEPDIR)/interpret-vteconv.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='vteconv.cc' object='interpret-vteconv.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-vteconv.obj `if test -f 'vteconv.cc'; then $(CYGPATH_W) 'vteconv.cc'; else $(CYGPATH_W) '$(srcdir)/vteconv.cc'; fi` - -interpret-interpret.o: interpret.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-interpret.o -MD -MP -MF $(DEPDIR)/interpret-interpret.Tpo -c -o interpret-interpret.o `test -f 'interpret.cc' || echo '$(srcdir)/'`interpret.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-interpret.Tpo $(DEPDIR)/interpret-interpret.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='interpret.cc' object='interpret-interpret.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-interpret.o `test -f 'interpret.cc' || echo '$(srcdir)/'`interpret.cc - -interpret-interpret.obj: interpret.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -MT interpret-interpret.obj -MD -MP -MF $(DEPDIR)/interpret-interpret.Tpo -c -o interpret-interpret.obj `if test -f 'interpret.cc'; then $(CYGPATH_W) 'interpret.cc'; else $(CYGPATH_W) '$(srcdir)/interpret.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/interpret-interpret.Tpo $(DEPDIR)/interpret-interpret.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='interpret.cc' object='interpret-interpret.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(interpret_CPPFLAGS) $(CPPFLAGS) $(interpret_CXXFLAGS) $(CXXFLAGS) -c -o interpret-interpret.obj `if test -f 'interpret.cc'; then $(CYGPATH_W) 'interpret.cc'; else $(CYGPATH_W) '$(srcdir)/interpret.cc'; fi` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parser_cat_CPPFLAGS) $(CPPFLAGS) $(parser_cat_CXXFLAGS) $(CXXFLAGS) -c -o parser_cat-utf8.obj `if test -f 'utf8.cc'; then $(CYGPATH_W) 'utf8.cc'; else $(CYGPATH_W) '$(srcdir)/utf8.cc'; fi` reaper-debug.o: debug.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(reaper_CPPFLAGS) $(CPPFLAGS) $(reaper_CXXFLAGS) $(CXXFLAGS) -MT reaper-debug.o -MD -MP -MF $(DEPDIR)/reaper-debug.Tpo -c -o reaper-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc @@ -1711,6 +1855,104 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(reaper_CPPFLAGS) $(CPPFLAGS) $(reaper_CXXFLAGS) $(CXXFLAGS) -c -o reaper-reaper.obj `if test -f 'reaper.cc'; then $(CYGPATH_W) 'reaper.cc'; else $(CYGPATH_W) '$(srcdir)/reaper.cc'; fi` +test_modes-modes-test.o: modes-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_modes_CPPFLAGS) $(CPPFLAGS) $(test_modes_CXXFLAGS) $(CXXFLAGS) -MT test_modes-modes-test.o -MD -MP -MF $(DEPDIR)/test_modes-modes-test.Tpo -c -o test_modes-modes-test.o `test -f 'modes-test.cc' || echo '$(srcdir)/'`modes-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_modes-modes-test.Tpo $(DEPDIR)/test_modes-modes-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='modes-test.cc' object='test_modes-modes-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_modes_CPPFLAGS) $(CPPFLAGS) $(test_modes_CXXFLAGS) $(CXXFLAGS) -c -o test_modes-modes-test.o `test -f 'modes-test.cc' || echo '$(srcdir)/'`modes-test.cc + +test_modes-modes-test.obj: modes-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_modes_CPPFLAGS) $(CPPFLAGS) $(test_modes_CXXFLAGS) $(CXXFLAGS) -MT test_modes-modes-test.obj -MD -MP -MF $(DEPDIR)/test_modes-modes-test.Tpo -c -o test_modes-modes-test.obj `if test -f 'modes-test.cc'; then $(CYGPATH_W) 'modes-test.cc'; else $(CYGPATH_W) '$(srcdir)/modes-test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_modes-modes-test.Tpo $(DEPDIR)/test_modes-modes-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='modes-test.cc' object='test_modes-modes-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_modes_CPPFLAGS) $(CPPFLAGS) $(test_modes_CXXFLAGS) $(CXXFLAGS) -c -o test_modes-modes-test.obj `if test -f 'modes-test.cc'; then $(CYGPATH_W) 'modes-test.cc'; else $(CYGPATH_W) '$(srcdir)/modes-test.cc'; fi` + +test_parser-parser-test.o: parser-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -MT test_parser-parser-test.o -MD -MP -MF $(DEPDIR)/test_parser-parser-test.Tpo -c -o test_parser-parser-test.o `test -f 'parser-test.cc' || echo '$(srcdir)/'`parser-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_parser-parser-test.Tpo $(DEPDIR)/test_parser-parser-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser-test.cc' object='test_parser-parser-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -c -o test_parser-parser-test.o `test -f 'parser-test.cc' || echo '$(srcdir)/'`parser-test.cc + +test_parser-parser-test.obj: parser-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -MT test_parser-parser-test.obj -MD -MP -MF $(DEPDIR)/test_parser-parser-test.Tpo -c -o test_parser-parser-test.obj `if test -f 'parser-test.cc'; then $(CYGPATH_W) 'parser-test.cc'; else $(CYGPATH_W) '$(srcdir)/parser-test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_parser-parser-test.Tpo $(DEPDIR)/test_parser-parser-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser-test.cc' object='test_parser-parser-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -c -o test_parser-parser-test.obj `if test -f 'parser-test.cc'; then $(CYGPATH_W) 'parser-test.cc'; else $(CYGPATH_W) '$(srcdir)/parser-test.cc'; fi` + +test_parser-parser.o: parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -MT test_parser-parser.o -MD -MP -MF $(DEPDIR)/test_parser-parser.Tpo -c -o test_parser-parser.o `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_parser-parser.Tpo $(DEPDIR)/test_parser-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.cc' object='test_parser-parser.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -c -o test_parser-parser.o `test -f 'parser.cc' || echo '$(srcdir)/'`parser.cc + +test_parser-parser.obj: parser.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -MT test_parser-parser.obj -MD -MP -MF $(DEPDIR)/test_parser-parser.Tpo -c -o test_parser-parser.obj `if test -f 'parser.cc'; then $(CYGPATH_W) 'parser.cc'; else $(CYGPATH_W) '$(srcdir)/parser.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_parser-parser.Tpo $(DEPDIR)/test_parser-parser.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.cc' object='test_parser-parser.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_parser_CPPFLAGS) $(CPPFLAGS) $(test_parser_CXXFLAGS) $(CXXFLAGS) -c -o test_parser-parser.obj `if test -f 'parser.cc'; then $(CYGPATH_W) 'parser.cc'; else $(CYGPATH_W) '$(srcdir)/parser.cc'; fi` + +test_refptr-refptr-test.o: refptr-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refptr_CPPFLAGS) $(CPPFLAGS) $(test_refptr_CXXFLAGS) $(CXXFLAGS) -MT test_refptr-refptr-test.o -MD -MP -MF $(DEPDIR)/test_refptr-refptr-test.Tpo -c -o test_refptr-refptr-test.o `test -f 'refptr-test.cc' || echo '$(srcdir)/'`refptr-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refptr-refptr-test.Tpo $(DEPDIR)/test_refptr-refptr-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='refptr-test.cc' object='test_refptr-refptr-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refptr_CPPFLAGS) $(CPPFLAGS) $(test_refptr_CXXFLAGS) $(CXXFLAGS) -c -o test_refptr-refptr-test.o `test -f 'refptr-test.cc' || echo '$(srcdir)/'`refptr-test.cc + +test_refptr-refptr-test.obj: refptr-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refptr_CPPFLAGS) $(CPPFLAGS) $(test_refptr_CXXFLAGS) $(CXXFLAGS) -MT test_refptr-refptr-test.obj -MD -MP -MF $(DEPDIR)/test_refptr-refptr-test.Tpo -c -o test_refptr-refptr-test.obj `if test -f 'refptr-test.cc'; then $(CYGPATH_W) 'refptr-test.cc'; else $(CYGPATH_W) '$(srcdir)/refptr-test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_refptr-refptr-test.Tpo $(DEPDIR)/test_refptr-refptr-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='refptr-test.cc' object='test_refptr-refptr-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_refptr_CPPFLAGS) $(CPPFLAGS) $(test_refptr_CXXFLAGS) $(CXXFLAGS) -c -o test_refptr-refptr-test.obj `if test -f 'refptr-test.cc'; then $(CYGPATH_W) 'refptr-test.cc'; else $(CYGPATH_W) '$(srcdir)/refptr-test.cc'; fi` + +test_tabstops-tabstops-test.o: tabstops-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tabstops_CPPFLAGS) $(CPPFLAGS) $(test_tabstops_CXXFLAGS) $(CXXFLAGS) -MT test_tabstops-tabstops-test.o -MD -MP -MF $(DEPDIR)/test_tabstops-tabstops-test.Tpo -c -o test_tabstops-tabstops-test.o `test -f 'tabstops-test.cc' || echo '$(srcdir)/'`tabstops-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_tabstops-tabstops-test.Tpo $(DEPDIR)/test_tabstops-tabstops-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tabstops-test.cc' object='test_tabstops-tabstops-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tabstops_CPPFLAGS) $(CPPFLAGS) $(test_tabstops_CXXFLAGS) $(CXXFLAGS) -c -o test_tabstops-tabstops-test.o `test -f 'tabstops-test.cc' || echo '$(srcdir)/'`tabstops-test.cc + +test_tabstops-tabstops-test.obj: tabstops-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tabstops_CPPFLAGS) $(CPPFLAGS) $(test_tabstops_CXXFLAGS) $(CXXFLAGS) -MT test_tabstops-tabstops-test.obj -MD -MP -MF $(DEPDIR)/test_tabstops-tabstops-test.Tpo -c -o test_tabstops-tabstops-test.obj `if test -f 'tabstops-test.cc'; then $(CYGPATH_W) 'tabstops-test.cc'; else $(CYGPATH_W) '$(srcdir)/tabstops-test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_tabstops-tabstops-test.Tpo $(DEPDIR)/test_tabstops-tabstops-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tabstops-test.cc' object='test_tabstops-tabstops-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tabstops_CPPFLAGS) $(CPPFLAGS) $(test_tabstops_CXXFLAGS) $(CXXFLAGS) -c -o test_tabstops-tabstops-test.obj `if test -f 'tabstops-test.cc'; then $(CYGPATH_W) 'tabstops-test.cc'; else $(CYGPATH_W) '$(srcdir)/tabstops-test.cc'; fi` + +test_utf8-utf8-test.o: utf8-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -MT test_utf8-utf8-test.o -MD -MP -MF $(DEPDIR)/test_utf8-utf8-test.Tpo -c -o test_utf8-utf8-test.o `test -f 'utf8-test.cc' || echo '$(srcdir)/'`utf8-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utf8-utf8-test.Tpo $(DEPDIR)/test_utf8-utf8-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8-test.cc' object='test_utf8-utf8-test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -c -o test_utf8-utf8-test.o `test -f 'utf8-test.cc' || echo '$(srcdir)/'`utf8-test.cc + +test_utf8-utf8-test.obj: utf8-test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -MT test_utf8-utf8-test.obj -MD -MP -MF $(DEPDIR)/test_utf8-utf8-test.Tpo -c -o test_utf8-utf8-test.obj `if test -f 'utf8-test.cc'; then $(CYGPATH_W) 'utf8-test.cc'; else $(CYGPATH_W) '$(srcdir)/utf8-test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utf8-utf8-test.Tpo $(DEPDIR)/test_utf8-utf8-test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8-test.cc' object='test_utf8-utf8-test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -c -o test_utf8-utf8-test.obj `if test -f 'utf8-test.cc'; then $(CYGPATH_W) 'utf8-test.cc'; else $(CYGPATH_W) '$(srcdir)/utf8-test.cc'; fi` + +test_utf8-utf8.o: utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -MT test_utf8-utf8.o -MD -MP -MF $(DEPDIR)/test_utf8-utf8.Tpo -c -o test_utf8-utf8.o `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utf8-utf8.Tpo $(DEPDIR)/test_utf8-utf8.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8.cc' object='test_utf8-utf8.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -c -o test_utf8-utf8.o `test -f 'utf8.cc' || echo '$(srcdir)/'`utf8.cc + +test_utf8-utf8.obj: utf8.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -MT test_utf8-utf8.obj -MD -MP -MF $(DEPDIR)/test_utf8-utf8.Tpo -c -o test_utf8-utf8.obj `if test -f 'utf8.cc'; then $(CYGPATH_W) 'utf8.cc'; else $(CYGPATH_W) '$(srcdir)/utf8.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utf8-utf8.Tpo $(DEPDIR)/test_utf8-utf8.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='utf8.cc' object='test_utf8-utf8.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_utf8_CPPFLAGS) $(CPPFLAGS) $(test_utf8_CXXFLAGS) $(CXXFLAGS) -c -o test_utf8-utf8.obj `if test -f 'utf8.cc'; then $(CYGPATH_W) 'utf8.cc'; else $(CYGPATH_W) '$(srcdir)/utf8.cc'; fi` + test_vtetypes-vtetypes.o: vtetypes.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vtetypes_CPPFLAGS) $(CPPFLAGS) $(test_vtetypes_CXXFLAGS) $(CXXFLAGS) -MT test_vtetypes-vtetypes.o -MD -MP -MF $(DEPDIR)/test_vtetypes-vtetypes.Tpo -c -o test_vtetypes-vtetypes.o `test -f 'vtetypes.cc' || echo '$(srcdir)/'`vtetypes.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_vtetypes-vtetypes.Tpo $(DEPDIR)/test_vtetypes-vtetypes.Po @@ -1725,34 +1967,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vtetypes_CPPFLAGS) $(CPPFLAGS) $(test_vtetypes_CXXFLAGS) $(CXXFLAGS) -c -o test_vtetypes-vtetypes.obj `if test -f 'vtetypes.cc'; then $(CYGPATH_W) 'vtetypes.cc'; else $(CYGPATH_W) '$(srcdir)/vtetypes.cc'; fi` -vteconv-debug.o: debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -MT vteconv-debug.o -MD -MP -MF $(DEPDIR)/vteconv-debug.Tpo -c -o vteconv-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vteconv-debug.Tpo $(DEPDIR)/vteconv-debug.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='vteconv-debug.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -c -o vteconv-debug.o `test -f 'debug.cc' || echo '$(srcdir)/'`debug.cc - -vteconv-debug.obj: debug.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -MT vteconv-debug.obj -MD -MP -MF $(DEPDIR)/vteconv-debug.Tpo -c -o vteconv-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vteconv-debug.Tpo $(DEPDIR)/vteconv-debug.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='debug.cc' object='vteconv-debug.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -c -o vteconv-debug.obj `if test -f 'debug.cc'; then $(CYGPATH_W) 'debug.cc'; else $(CYGPATH_W) '$(srcdir)/debug.cc'; fi` - -vteconv-vteconv.o: vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -MT vteconv-vteconv.o -MD -MP -MF $(DEPDIR)/vteconv-vteconv.Tpo -c -o vteconv-vteconv.o `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vteconv-vteconv.Tpo $(DEPDIR)/vteconv-vteconv.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='vteconv.cc' object='vteconv-vteconv.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -c -o vteconv-vteconv.o `test -f 'vteconv.cc' || echo '$(srcdir)/'`vteconv.cc - -vteconv-vteconv.obj: vteconv.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -MT vteconv-vteconv.obj -MD -MP -MF $(DEPDIR)/vteconv-vteconv.Tpo -c -o vteconv-vteconv.obj `if test -f 'vteconv.cc'; then $(CYGPATH_W) 'vteconv.cc'; else $(CYGPATH_W) '$(srcdir)/vteconv.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vteconv-vteconv.Tpo $(DEPDIR)/vteconv-vteconv.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='vteconv.cc' object='vteconv-vteconv.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vteconv_CPPFLAGS) $(CPPFLAGS) $(vteconv_CXXFLAGS) $(CXXFLAGS) -c -o vteconv-vteconv.obj `if test -f 'vteconv.cc'; then $(CYGPATH_W) 'vteconv.cc'; else $(CYGPATH_W) '$(srcdir)/vteconv.cc'; fi` - vtestream_file-vtestream.o: vtestream.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vtestream_file_CPPFLAGS) $(CPPFLAGS) $(vtestream_file_CXXFLAGS) $(CXXFLAGS) -MT vtestream_file-vtestream.o -MD -MP -MF $(DEPDIR)/vtestream_file-vtestream.Tpo -c -o vtestream_file-vtestream.o `test -f 'vtestream.cc' || echo '$(srcdir)/'`vtestream.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vtestream_file-vtestream.Tpo $(DEPDIR)/vtestream_file-vtestream.Po @@ -2090,6 +2304,41 @@ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? +test-modes.log: test-modes$(EXEEXT) + @p='test-modes$(EXEEXT)'; \ + b='test-modes'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-parser.log: test-parser$(EXEEXT) + @p='test-parser$(EXEEXT)'; \ + b='test-parser'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-refptr.log: test-refptr$(EXEEXT) + @p='test-refptr$(EXEEXT)'; \ + b='test-refptr'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-tabstops.log: test-tabstops$(EXEEXT) + @p='test-tabstops$(EXEEXT)'; \ + b='test-tabstops'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-utf8.log: test-utf8$(EXEEXT) + @p='test-utf8$(EXEEXT)'; \ + b='test-utf8'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) reaper.log: reaper$(EXEEXT) @p='reaper$(EXEEXT)'; \ b='reaper'; \ @@ -2103,13 +2352,6 @@ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -vteconv.log: vteconv$(EXEEXT) - @p='vteconv$(EXEEXT)'; \ - b='vteconv'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) vtestream-file.log: vtestream-file$(EXEEXT) @p='vtestream-file$(EXEEXT)'; \ diff -Nru vte2.91-0.52.2/src/matcher.cc vte2.91-0.54.0/src/matcher.cc --- vte2.91-0.52.2/src/matcher.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/matcher.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include -#include -#include -#include -#include "debug.h" -#include "caps.hh" -#include "matcher.hh" -#include "table.hh" - -struct _vte_matcher { - _vte_matcher_match_func match; /* shortcut to the most common op */ - struct _vte_matcher_impl *impl; - GValueArray *free_params; -}; - -static GMutex _vte_matcher_mutex; -static struct _vte_matcher *_vte_matcher_singleton = NULL; -static int _vte_matcher_ref_count = 0; - -static struct _vte_matcher_impl dummy_vte_matcher_table = { - &_vte_matcher_table -}; - -/* Add a string to the matcher. */ -static void -_vte_matcher_add(const struct _vte_matcher *matcher, - const char *pattern, - gssize length, - sequence_handler_t handler) -{ - matcher->impl->klass->add(matcher->impl, pattern, length, handler); -} - -/* Loads all sequences into matcher */ -static void -_vte_matcher_init(struct _vte_matcher *matcher) -{ - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_init()\n"); - - unsigned int n_entries; - auto entries = _vte_get_matcher_entries(&n_entries); - - for (unsigned int e = 0; e < n_entries; e++) { - char const* code = entries[e].seq; - - /* Escape sequences from \e@ to \e_ have a C1 counterpart - * with the eighth bit set instead of a preceding '\x1b'. - * This is encoded in the current encoding, e.g. in UTF-8 - * the C1 CSI (U+009B) becomes \xC2\x9B. - * - * When matching, the bytestream is already decoded to - * Unicode codepoints. In the "code" string, each byte - * is interpreted as a Unicode codepoint (in other words, - * Latin-1 is assumed). So '\x80' .. '\x9F' bytes - * (e.g. the byte '\x9B' for CSI) are the right choice here. - * - * For each sequence containing N occurrences of \e@ to \e_, - * we create 2^N variants, by replacing every subset of them - * with their C1 counterpart. - */ - int variants = 1; - for (int i = 0; code[i] != '\0'; i++) { - if (code[i] == '\x1B' && code[i + 1] >= '@' && code[i + 1] <= '_') { - variants <<= 1; - } - } - for (int n = 0; n < variants; n++) { - char* c1 = g_strdup(code); - int k = 0; - for (int i = 0; c1[i] != '\0'; i++) { - if (c1[i] == '\x1B' && c1[i + 1] >= '@' && c1[i + 1] <= '_') { - if (n & (1 << k)) { - memmove(c1 + i, c1 + i + 1, strlen(c1 + i + 1) + 1); - c1[i] += 0x40; - } - k++; - } - } - _vte_matcher_add(matcher, c1, strlen(c1), entries[e].handler); - g_free(c1); - } - } - - _VTE_DEBUG_IF(VTE_DEBUG_MATCHER) { - g_printerr("Matcher contents:\n"); - _vte_matcher_print(matcher); - g_printerr("\n"); - } -} - -/* Allocates new matcher structure. */ -static struct _vte_matcher * -_vte_matcher_create(void) -{ - struct _vte_matcher *ret = NULL; - - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_create()\n"); - ret = g_slice_new(struct _vte_matcher); - ret->impl = &dummy_vte_matcher_table; - ret->match = NULL; - ret->free_params = NULL; - - return ret; -} - -/* Noone uses this matcher, free it. */ -static void -_vte_matcher_destroy(struct _vte_matcher *matcher) -{ - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_destroy()\n"); - if (matcher->free_params != NULL) { - g_value_array_free (matcher->free_params); - } - if (matcher->match != NULL) /* do not call destroy on dummy values */ - matcher->impl->klass->destroy(matcher->impl); - g_slice_free(struct _vte_matcher, matcher); -} - -/* Create and init matcher. */ -struct _vte_matcher * -_vte_matcher_new(void) -{ - struct _vte_matcher *ret = NULL; - - g_mutex_lock(&_vte_matcher_mutex); - - if (_vte_matcher_ref_count++ == 0) { - g_assert(_vte_matcher_singleton == NULL); - ret = _vte_matcher_create(); - - if (ret->match == NULL) { - ret->impl = ret->impl->klass->create(); - ret->match = ret->impl->klass->match; - _vte_matcher_init(ret); - } - _vte_matcher_singleton = ret; - } - - g_mutex_unlock(&_vte_matcher_mutex); - return _vte_matcher_singleton; -} - -/* Free a matcher. */ -void -_vte_matcher_free(struct _vte_matcher *matcher) -{ - g_assert(_vte_matcher_singleton != NULL); - g_mutex_lock(&_vte_matcher_mutex); - if (--_vte_matcher_ref_count == 0) { - _vte_matcher_destroy(matcher); - _vte_matcher_singleton = NULL; - } - g_mutex_unlock(&_vte_matcher_mutex); -} - -/* Check if a string matches a sequence the matcher knows about. */ -vte_matcher_result_t -_vte_matcher_match(struct _vte_matcher *matcher, - const gunichar *pattern, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - GValueArray **array) -{ - if (G_UNLIKELY (array != NULL && matcher->free_params != NULL)) { - *array = matcher->free_params; - matcher->free_params = NULL; - } - return matcher->match(matcher->impl, pattern, length, - handler, consumed, array); -} - -/* Dump out the contents of a matcher, mainly for debugging. */ -void -_vte_matcher_print(struct _vte_matcher *matcher) -{ - matcher->impl->klass->print(matcher->impl); -} - -/* Free a parameter array. Most of the GValue elements can clean up after - * themselves, but we're using gpointers to hold unicode character strings, and - * we need to free those ourselves. */ -void -_vte_matcher_free_params_array(struct _vte_matcher *matcher, - GValueArray *params) -{ - guint i; - for (i = 0; i < params->n_values; i++) { - auto value = g_value_array_get_nth(params, i); - if (G_UNLIKELY (G_VALUE_HOLDS_POINTER(value))) { - g_free(g_value_get_pointer(value)); - } else if (G_UNLIKELY (G_VALUE_HOLDS_BOXED(value))) { - g_value_array_free((GValueArray*)g_value_get_boxed(value)); - } - } - if (G_UNLIKELY (matcher == NULL || matcher->free_params != NULL)) { - g_value_array_free (params); - } else { - matcher->free_params = params; - params->n_values = 0; - } -} diff -Nru vte2.91-0.52.2/src/matcher.hh vte2.91-0.54.0/src/matcher.hh --- vte2.91-0.52.2/src/matcher.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/matcher.hh 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#pragma once - -#include - -class VteTerminalPrivate; -namespace vte { namespace parser { struct Params; } } - -typedef void (VteTerminalPrivate::* sequence_handler_t)(vte::parser::Params const&); - -struct _vte_matcher; - -struct _vte_matcher_impl { - const struct _vte_matcher_class *klass; - /* private */ -}; - -typedef enum { - VTE_MATCHER_RESULT_NO_MATCH, - VTE_MATCHER_RESULT_MATCH, - VTE_MATCHER_RESULT_PARTIAL -} vte_matcher_result_t; - -struct vte_matcher_entry_t { - char seq[20]; - sequence_handler_t handler; -}; - -vte_matcher_entry_t const* _vte_get_matcher_entries(unsigned int* n_entries); - -typedef struct _vte_matcher_impl *(*_vte_matcher_create_func)(void); -typedef vte_matcher_result_t (*_vte_matcher_match_func)(struct _vte_matcher_impl *impl, - const gunichar *pattern, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - GValueArray **array); -typedef void (*_vte_matcher_add_func)(struct _vte_matcher_impl *impl, - const char *pattern, gssize length, - sequence_handler_t handler); -typedef void (*_vte_matcher_print_func)(struct _vte_matcher_impl *impl); -typedef void (*_vte_matcher_destroy_func)(struct _vte_matcher_impl *impl); -struct _vte_matcher_class{ - _vte_matcher_create_func create; - _vte_matcher_add_func add; - _vte_matcher_print_func print; - _vte_matcher_match_func match; - _vte_matcher_destroy_func destroy; -}; - -/* Create and init matcher. */ -struct _vte_matcher *_vte_matcher_new(void); - -/* Free a matcher. */ -void _vte_matcher_free(struct _vte_matcher *matcher); - -/* Check if a string matches a sequence the matcher knows about. */ -vte_matcher_result_t _vte_matcher_match(struct _vte_matcher *matcher, - const gunichar *pattern, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - GValueArray **array); - -/* Dump out the contents of a matcher, mainly for debugging. */ -void _vte_matcher_print(struct _vte_matcher *matcher); - -/* Free a parameter array. */ -void _vte_matcher_free_params_array(struct _vte_matcher *matcher, GValueArray *params); diff -Nru vte2.91-0.52.2/src/modes-ecma.hh vte2.91-0.54.0/src/modes-ecma.hh --- vte2.91-0.52.2/src/modes-ecma.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/modes-ecma.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,201 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(MODE) || !defined(MODE_FIXED) +#error "Must define MODE and MODE_FIXED before including this file" +#endif + +/* + * Modes for SM_ECMA/RM_ECMA. + * + * Most of these are not implemented in VTE. + * + * References: ECMA-48 § 7 + * WY370 + */ + +/* + * IRM - insertion replacement mode + * + * Default: reset + * + * References: ECMA-48 § 7.2.10 + * VT525 + */ +MODE(IRM, 4) + +/* + * SRM - local echo send/receive mode + * If reset, characters entered by the keyboard are shown on the + * screen as well as being sent to the host; if set, the + * keyboard input is only sent to the host. + * + * Default: set + * + * References: ECMA-48 § 7.2.15 + * VT525 + */ +MODE(SRM, 12) + +/* Unsupported */ + +MODE_FIXED(GATM, 1, ALWAYS_RESET) +MODE_FIXED(KAM, 2, ALWAYS_RESET) +MODE_FIXED(CRM, 3, ALWAYS_RESET) +MODE_FIXED(SRTM, 5, ALWAYS_RESET) +MODE_FIXED(ERM, 6, ALWAYS_RESET) +MODE_FIXED(VEM, 7, ALWAYS_RESET) +MODE_FIXED(BDSM, 8, ALWAYS_RESET) +MODE_FIXED(DCSM, 9, ALWAYS_RESET) +MODE_FIXED(HEM, 10, ALWAYS_RESET) +MODE_FIXED(PUM, 11, ALWAYS_RESET) /* ECMA-48 § F.4.1 Deprecated */ +MODE_FIXED(FEAM, 13, ALWAYS_RESET) +MODE_FIXED(FETM, 14, ALWAYS_RESET) +MODE_FIXED(MATM, 15, ALWAYS_RESET) +MODE_FIXED(TTM, 16, ALWAYS_RESET) +MODE_FIXED(SATM, 17, ALWAYS_RESET) +MODE_FIXED(TSM, 18, ALWAYS_RESET) +MODE_FIXED(EBM, 19, ALWAYS_RESET) /* ECMA-48 § F.5.1 Removed */ + +/* + * LNM - line feed/newline mode + * If set, the cursor moves to the first column on LF, FF, VT, + * and a Return key press sends CRLF. + * If reset, the cursor column is unchanged by LF, FF, VT, + * and a Return key press sends CR only. + * + * Default: reset + * + * References: ECMA-48 § F.5.2 Removed! + * VT525 + */ +MODE_FIXED(LNM, 20, ALWAYS_RESET) + +MODE_FIXED(GRCM, 21, ALWAYS_SET) +MODE_FIXED(ZDM, 22, ALWAYS_RESET) /* ECMA-48 § F.4.2 Deprecated */ + +/* + * WYDSCM - display disable mode + * If set, blanks the screen; if reset, shows the data. + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WYDSCM, 30, ALWAYS_RESET) + +/* + * WHYSTLINM - status line display mode + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYSTLINM, 31, ALWAYS_RESET) + +/* + * WYCRTSAVM - screen saver mode + * Like DECCRTSM. + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYCRTSAVM, 32, ALWAYS_RESET) + +/* + * WYSTCURM - steady cursor mode + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYSTCURM, 33, ALWAYS_RESET) + +/* + * WYULCURM - underline cursor mode + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYULCURM, 34, ALWAYS_RESET) + +/* + * WYCLRM - width change clear disable mode + * If set, the screen is not cleared when the column mode changes + * by DECCOLM or WY161. + * Note that this does not affect DECSCPP. + * This is the same as DECNCSM mode. + * + * Default: set (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYCLRM, 35, ALWAYS_SET) + +/* + * WYDELKM - delete key definition + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYDELKM, 36, ALWAYS_RESET) /* Same as DECBKM */ + +/* + * WYGATM - send characters mode + * If set, sends all characters; if reset, only erasable characters. + * Like GATM above. + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYGATM, 37, ALWAYS_RESET) + +/* + * WYTEXM - send full screen/scrolling region to printer + * Like DECPEX mode. + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYTEXM, 38, ALWAYS_RESET) + +/* + * WYEXTDM - extra data line + * If set, the last line of the screen is used as data line and not + * a status line; if reset, the last line of the screen is used + * as a status line. + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WYEXTDM, 40, ALWAYS_SET) + +/* + * WYASCII - WY350 personality mode + * If set, switches to WY350 personality. + * + * Default: reset (set-up) + * + * References: WY370 + */ +MODE_FIXED(WYASCII, 42, ALWAYS_SET) diff -Nru vte2.91-0.52.2/src/modes.hh vte2.91-0.54.0/src/modes.hh --- vte2.91-0.52.2/src/modes.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/modes.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,250 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +namespace vte { +namespace terminal { +namespace modes { + +#define VTE_MODES_MASK(shift) (1U << (shift)) + +#define MODE_ACCESSOR(name) \ + inline void set_##name(bool value) noexcept \ + { \ + set(e##name, value); \ + } \ + \ + inline constexpr bool name() const noexcept \ + { \ + return get(e##name); \ + } + +template +static inline void vte_modes_set_bool(T* modes, + unsigned int shift, + bool value) +{ + if (value) + *modes |= T(1U) << shift; + else + *modes &= ~(T(1U) << shift); +} + +template +static constexpr inline bool vte_modes_get_bool(T modes, + unsigned int shift) +{ + return (modes >> shift) & 1U; +} + +template +static constexpr inline bool vte_modes_unset_bool(T* modes, + unsigned int shift) +{ + bool set = vte_modes_get_bool(*modes, shift); + vte_modes_set_bool(modes, shift, false); + return set; +} + +template +class Base +{ +public: + using Self = Base; + using Storage = T; + + constexpr Base(std::initializer_list modes) + { + for (auto i : modes) + m_default_modes |= VTE_MODES_MASK(i); + m_modes = m_default_modes; + } + + ~Base() = default; + Base(Self const&) = default; + Base(Self&&) = default; + Self& operator= (Self const&) = default; + Self& operator= (Self&&) = default; + + inline void set(int bit, + bool value) noexcept + { + vte_modes_set_bool(&m_modes, bit, value); + } + + constexpr inline bool get(int bit) const noexcept + { + return vte_modes_get_bool(m_modes, bit); + } + + inline void set_modes(Storage value) noexcept + { + m_modes = value; + } + + constexpr inline Storage get_modes() const noexcept + { + return m_modes; + } + + void reset() noexcept + { + set_modes(m_default_modes); + } + +private: + T m_modes{0}; + T m_default_modes{0}; +}; + +class ECMA : public Base +{ +public: + enum Modes { + eUNKNOWN = -3, + eALWAYS_SET = -2, + eALWAYS_RESET = -1, + +#define MODE(name,param) e##name, +#define MODE_FIXED(name,param,value) e##name, +#include "modes-ecma.hh" +#undef MODE +#undef MODE_FIXED + }; + + int mode_from_param(int param) const noexcept + { + switch (param) { +#define MODE(name,param) case param: return e##name; +#define MODE_FIXED(name,param,value) case param: return e##value; +#include "modes-ecma.hh" +#undef MODE +#undef MODE_FIXED + default: + return eUNKNOWN; + } + } + + char const* mode_to_cstring(int param) const noexcept + { + switch (param) { + case eUNKNOWN: return "UNKNOWN"; + case eALWAYS_SET: return "ALWAYS_SET"; + case eALWAYS_RESET: return "ALWAYS_RESET"; +#define MODE(name,param) case e##name: return #name; +#define MODE_FIXED(name,param,value) +#include "modes-ecma.hh" +#undef MODE +#undef MODE_FIXED + default: + return "INVALID"; + } + } + +#define MODE(name,param) MODE_ACCESSOR(name) +#define MODE_FIXED(name,param,value) +#include "modes-ecma.hh" +#undef MODE +#undef MODE_FIXED + + constexpr ECMA() : Self{eSRM} { } + +}; // class ECMA + +class Private : public Base +{ +public: + enum Modes { + eUNKNOWN = -3, + eALWAYS_SET = -2, + eALWAYS_RESET = -1, + +#define MODE(name,param) e##name, +#define MODE_FIXED(name,param,value) e##name, +#include "modes-private.hh" +#undef MODE +#undef MODE_FIXED + }; + + int mode_from_param(int param) const noexcept + { + switch (param) { +#define MODE(name,param) case param: return e##name; +#define MODE_FIXED(name,param,value) case param: return e##value; +#include "modes-private.hh" +#undef MODE +#undef MODE_FIXED + default: + return eUNKNOWN; + } + } + + char const* mode_to_cstring(int param) const noexcept + { + switch (param) { + case eUNKNOWN: return "UNKNOWN"; + case eALWAYS_SET: return "ALWAYS_SET"; + case eALWAYS_RESET: return "ALWAYS_RESET"; +#define MODE(name,param) case e##name: return #name; +#define MODE_FIXED(name,param,value) +#include "modes-private.hh" +#undef MODE +#undef MODE_FIXED + default: + return "INVALID"; + } + } + +#define MODE(name,param) MODE_ACCESSOR(name) +#define MODE_FIXED(name,param,value) +#include "modes-private.hh" +#undef MODE +#undef MODE_FIXED + + constexpr Private() : Self{eDEC_AUTOWRAP, + eDEC_TEXT_CURSOR, + eXTERM_ALTBUF_SCROLL, + eXTERM_META_SENDS_ESCAPE} { } + + inline void push_saved(int mode) + { + vte_modes_set_bool(&m_saved_modes, mode, get(mode)); + } + + constexpr inline bool pop_saved(int mode) + { + return vte_modes_unset_bool(&m_saved_modes, mode); + } + + inline void clear_saved() + { + m_saved_modes = 0; + } + +private: + Storage m_saved_modes{0}; + +}; // class Private + +#undef MODE_ACCESSOR + +} // namespace modes +} // namespace terminal +} // namespace vte diff -Nru vte2.91-0.52.2/src/modes-private.hh vte2.91-0.54.0/src/modes-private.hh --- vte2.91-0.52.2/src/modes-private.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/modes-private.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,845 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(MODE) || !defined(MODE_FIXED) +#error "Must define MODE and MODE_FIXED before including this file" +#endif + +/* + * Modes for SM_DEC/RM_DEC. + * + * Most of these are not implemented in VTE. + * + * References: VT525 + * XTERM + * KITTY + * MINTTY + * MLTERM + * RLogin + * URXVT + * WY370 + */ + +/* Supported modes: */ + +/* DEC */ + +/* + * DECCKM - cursor keys mode + * + * Controls whether the cursor keys send cursor sequences, or application + * sequences. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_APPLICATION_CURSOR_KEYS, 1) + +/* + * DECCOLM: 132 column mode + * + * Sets page width to 132 (set) or 80 (reset) columns. + * + * Changing this mode resets the top, bottom, left, right margins; + * clears the screen (unless DECNCSM is set); resets DECLRMM; and clears + * the status line if host-writable. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_132_COLUMN, 3) + +/* + * DECSCNM - screen mode + * If set, displays reverse; if reset, normal. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_REVERSE_IMAGE, 5) + +/* + * DECOM - origin mode + * If set, the cursor is restricted to within the page margins. + * + * On terminal reset, DECOM is reset. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_ORIGIN, 6) + +/* + * DECAWM - auto wrap mode + * + * Controls whether text wraps to the next line when the + * cursor reaches the right margin. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_AUTOWRAP, 7) + +/* + * DECTCEM - text cursor enable + * If set, the text cursor is visible; if reset, invisible. + * + * Default: set + * + * References: VT525 + */ +MODE(DEC_TEXT_CURSOR, 25) + +/* + * DECNKM - numeric/application keypad mode + * Controls whether the numeric keypad sends application (set) + * or keypad (reset) sequences. + * + * Default: reset + * + * References: VT525 + */ +MODE(DEC_APPLICATION_KEYPAD, 66) + +/* XTERM */ + +MODE(XTERM_MOUSE_X10, 9) +MODE(XTERM_DECCOLM, 40) +MODE(XTERM_ALTBUF, 47) +MODE(XTERM_MOUSE_VT220, 1000) +MODE(XTERM_MOUSE_VT220_HIGHLIGHT, 1001) +MODE(XTERM_MOUSE_BUTTON_EVENT, 1002) +MODE(XTERM_MOUSE_ANY_EVENT, 1003) +MODE(XTERM_FOCUS, 1004) +MODE(XTERM_MOUSE_EXT_SGR, 1006) +MODE(XTERM_ALTBUF_SCROLL, 1007) +MODE(XTERM_META_SENDS_ESCAPE, 1036) +MODE(XTERM_OPT_ALTBUF, 1047) +MODE(XTERM_SAVE_CURSOR, 1048) +MODE(XTERM_OPT_ALTBUF_SAVE_CURSOR, 1049) +MODE(XTERM_READLINE_BRACKETED_PASTE, 2004) + +/* URXVT */ + +MODE(URXVT_MOUSE_EXT, 1015) + +/* Not supported modes: */ + +/* DEC */ + +/* + * DECANM - ansi-mode + * Resetting this puts the terminal into VT52 compatibility mode. + * Control sequences overlap with regular sequences so we have to + * detect them early before dispatching them. + * To return to ECMA-48 mode, use ESC < [1/11 3/12]. + * + * Default: set + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECANM, 2, ALWAYS_SET) + +/* + * DECSCLM - scrolling mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECSCLM, 4, ALWAYS_RESET) + +/* + * DECARM - autorepeat mode + * Controls whether keys auytomatically repeat while held pressed + * for more than 0.5s. + * Note that /some/ keys do not repeat regardless of this setting. + * + * Default: set + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECARM, 8, ALWAYS_SET) + +MODE_FIXED(DECLTM, 11, ALWAYS_RESET) +MODE_FIXED(DECEKEM, 16, ALWAYS_RESET) + +/* + * DECPFF - print FF mode + * Controls whether the terminal terminates a print command by + * sending a FF to the printer. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECCPFF, 18, ALWAYS_RESET) + +/* + * DECPEX - print extent mode + * If set, print page prints only the scrolling region; + * if reset, the complete page. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECPEX, 19, ALWAYS_RESET) + +/* + * DECLRM - RTL mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECRLM, 34, ALWAYS_RESET) + +/* + * DECHEBM - hebrew/north-american keyboard mapping mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECHEBM, 35, ALWAYS_RESET) + +/* + * DECHEM - hebrew encoding mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECHEM, 36, ALWAYS_RESET) + +/* + * DECNRCM - NRCS mode + * Operates in 7-bit (set) or 8-bit (reset) mode. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECNRCM, 42, ALWAYS_RESET) + +MODE_FIXED(DECGEPM, 43, ALWAYS_RESET) /* from VT330 */ +/* MODE_FIXED(DECGPCM, 44, ALWAYS_RESET) * from VT330, conflicts with XTERM_MARGIN_BELL */ +/* MODE_FIXED(DECGPCS, 45, ALWAYS_RESET) * from VT330, conflicts with XTERM_REVERSE_WRAP */ +/* MODE_FIXED(DECGPBM, 46, ALWAYS_RESET) * from VT330, conflicts with XTERM_LOGGING */ +/* MODE_FIXED(DECGRPM, 47, ALWAYS_RESET) * from VT330, conflicts with XTERM_ALTBUF */ +MODE_FIXED(DEC131TM, 53, ALWAYS_RESET) + +/* + * DECNAKB - greek/north-american keyboard mapping mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECNAKB, 57, ALWAYS_RESET) + +/* + * DECIPEM - enter/return to/from pro-printer emulation mode + * Switches the terminal to (set)/from (reset) the ibm pro + * printer protocol. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECIPEM, 58, ALWAYS_RESET) + +/* MODE_FIXED(DECKKDM, 59, ALWAYS_SET) * Kanji/Katakana Display Mode, from VT382-Kanji */ + +/* + * DECHCCM - horizontal cursor coupling mode + * Controls what happens when the cursor moves out of the left or + * right margins of the window. + * If set, the window pans to keep the cursor in view; if reset, + * the cursor disappears. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECHCCM, 60, ALWAYS_RESET) + +/* + * DECVCCM - vertical cursor coupling mode + * Controls what happens when the cursor moves out of the top or + * bottom of the window, When the height of the window is smaller + * than the page. + * If set, the window pans to keep the cursor in view; if reset, + * the cursor disappears. + * + * Default: set + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECVCCM, 61, ALWAYS_SET) + +/* + * DECPCCM - page cursor coupling mode + * + * Default: set + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECPCCM, 64, ALWAYS_SET) + +/* + * DECBKM - backarrow key mode + * WYDELKM + * + * If set, the Backspace key works as a backspace key + * sending the BS control; if reset, it works as a Delete + * key sending the DEL control. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECBKM, 67, ALWAYS_RESET) + +/* + * DECKBUM - typewriter/data rpocessing keys mode + * + * If set, the keyboard keys act as data processing keys; + * if reset, as typewriter keys. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECKBUM, 68, ALWAYS_RESET) + +/* + * DECLRMM - vertical split-screen mode + * Controls whether a DECSLRM is executed. + * On set, resets line attributes to single width and single height, + * and while set, the terminal ignores any changes to line attributes. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECLRMM, 69, ALWAYS_RESET) /* aka DECVSSM */ + +/* + * DECXRLM - transmit rate limit + * If set, limits the transmit rate; if reset, the rate is + * unlimited. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECXRLM, 73, ALWAYS_RESET) + +/* + * DECSDM - sixel display mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +/* MODE_FIXED(DECSDM, 80, ALWAYS_RESET) ! Conflicts with WY161 */ + +/* + * DECKPM - key position mode + * If set, the keyboard sends extended reports (DECEKBD) that include + * the key position and modifier state; if reset, it sends character codes. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECKPM, 81, ALWAYS_RESET) + +MODE_FIXED(DECTHAISCM, 90, ALWAYS_RESET) /* Thai Space Compensating Mode, from VT382-Thai */ + +/* + * DECNCSM - no clear screen on DECOLM + * If set, the screen is not cleared when the column mode changes + * by DECCOLM. + * Note that this does not affect DECSCPP. + * + * Default: set + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECNCSM, 95, ALWAYS_RESET) + +/* + * DECRLCM - RTL copy mode + * If set, copy/paste from RTL; if reset, from LTR. + * Only enabled when the keyboard language is set to hebrew. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECRLCM, 96, ALWAYS_RESET) + +/* + * DECCRTSM - CRT save mode + * When set, blanks the terminal after the inactivity timeout + * (set with DECCRTST). + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECRCRTSM, 97, ALWAYS_RESET) + +/* + * DECARSM - auto resize mode + * Sets whether changing page arrangements automatically + * changes the lines per screen. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECARSM, 98, ALWAYS_RESET) + +/* + * DECMCM - modem control mode + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECMCM, 99, ALWAYS_RESET) + +/* + * DECAAM - auto answerback mode + * + * Default: reset + * + * References: VT525 + */ +MODE_FIXED(DECAAM, 100, ALWAYS_RESET) + +/* + * DECCANSM - conceal answerback message mode + * + * Default: reset + * + * References: VT525 + * + * Unimplemented, since we don't support answerback at all. + */ +MODE_FIXED(DECANSM, 101, ALWAYS_RESET) + +/* + * DECNULM - null mode + * If set, pass NUL to the printer; if reset, discard NUL. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECNULM, 102, ALWAYS_RESET) + +/* + * DECHDPXM - half-duplex mode + * Whether to use half-duplex (set) or full-duplex (reset) mode. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECHDPXM, 103, ALWAYS_RESET) + +/* + * DECESKM - enable secondary keyboard language mode + * If set, use the secondary keyboard mapping (group 2); if reset, + * use the primary (group 1). + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECESKM, 104, ALWAYS_RESET) + +/* + * DECOSCNM - overscan mode + * (monochrome terminal only) + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECOSCNM, 106, ALWAYS_RESET) + +/* + * DECNUMLK - num lock mode + * + * Set the num lock state as if by acting the NumLock key. + * Set means NumLock on; reset means off. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECNUMLK, 108, ALWAYS_RESET) + +/* + * DECCAPSLK - caps lock mode + * + * Set the caps lock state as if by acting the CapsLock key. + * Set means CapsLock on; reset means off. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECCAPSLK, 109, ALWAYS_RESET) + +/* + * DECKLHIM - keyboard LED host indicator mode + * If set, the keyboard LEDs show the state from the host + * (see DECLL); if reset, the local state. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECKLHIM, 110, ALWAYS_RESET) + +/* + * DECFWM - framed window mode + * If set, session window frames are drawn with frame border and icon. + * + * Default: reset + * + * References: VT525 + * + * VTE does not support sessions. + */ +MODE_FIXED(DECFWM, 111, ALWAYS_RESET) + +/* + * DECRPL - review previous lines mode + * If set, allows to view the scrollback. + * + * Default: set (VTE) + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECRPL, 112, ALWAYS_SET) + +/* + * DECHWUM - host wake-up mode + * If set, the terminal exits CRT save and energy save mode + * when a character is received from the host. + * + * Default: ? + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECHWUM, 113, ALWAYS_RESET) + +/* + * DECTCUM - alternate text color underline mode + * + * If set, text with the undeerline attribute is underlined as + * well as being displayed in the alternate coolor (if + * specified); if reset, it is only displayed in the + * alternate color. + * + * Default: ? + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECATCUM, 114, ALWAYS_RESET) + +/* + * DECTCBM - alternate text color blink mode + * + * If set, text with the blink attribute blinks as well + * as being displayed in the alternate color (if + * specified); if reset, it is only displayed in the + * alternate color. + * + * Default: ? + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECATCBM, 115, ALWAYS_RESET) + +/* + * DECBBSM - bold and blink style mode + * + * If set, the bold or blink attributes affect both foreground + * and background color; if reset, those affect only the foreground + * color. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECBBSM, 116, ALWAYS_RESET) + +/* + * DECECM - erase color mode + * + * If set, erased text or new cells appearing on the screen by scrolling + * are assigned the screen background color; if reset, they are assigned + * the text background color. + * + * Default: reset + * + * References: VT525 + * + * Probably not worth implementing. + */ +MODE_FIXED(DECECM, 117, ALWAYS_RESET) + +/* DRCSTerm */ +/* Modes 8800…8804 */ + +/* KITTY */ + +MODE_FIXED(KITTY_STYLED_UNDERLINES, 2016, ALWAYS_SET) +MODE_FIXED(KITTY_EXTENDED_KEYBOARD, 2017, ALWAYS_RESET) + +/* MinTTY */ + +MODE_FIXED(MINTTY_REPORT_CJK_AMBIGUOUS_WIDTH, 7700, ALWAYS_RESET) +MODE_FIXED(MINTTY_REPORT_SCROLL_MARKER_IN_CURRENT_LINE, 7711, ALWAYS_RESET) +MODE_FIXED(MINTTY_APPLICATION_ESCAPE, 7727, ALWAYS_RESET) +MODE_FIXED(MINTTY_ESCAPE_SENDS_FS, 7728, ALWAYS_RESET) +MODE_FIXED(MINTTY_SIXEL_SCROLLING_END_POSITION, 7730, ALWAYS_RESET) +MODE_FIXED(MINTTY_SCROLLBAR, 7766, ALWAYS_RESET) +MODE_FIXED(MINTTY_REPORT_FONT_CHANGES, 7767, ALWAYS_RESET) +MODE_FIXED(MINTTY_SHORTCUT_OVERRIDE, 7783, ALWAYS_RESET) +MODE_FIXED(MINTTY_ALBUF_MOUSEWHEEL_TO_CURSORKEYS, 7786, ALWAYS_RESET) +MODE_FIXED(MINTTY_MOUSEWHEEL_APPLICATION_KEYS, 7787, ALWAYS_RESET) +MODE_FIXED(MINTTY_BIDI_DISABLE_IN_CURRENT_LINE, 7796, ALWAYS_RESET) +MODE_FIXED(MINTTY_SIXEL_SCROLL_CURSOR_RIGHT, 8452, ALWAYS_RESET) +/* MinTTY also knows mode 77096 'BIDI disable", and 77000..77031 + * "Application control key" which are outside of the supported range + * for CSI parameters. + */ + +/* RLogin */ + +/* RLogin appears to use many modes + * [https://github.com/kmiya-culti/RLogin/blob/master/RLogin/TextRam.h#L131]: + * 1406..1415, 1420..1425, 1430..1434, 1436, 1452..1481, + * 8400..8406, 8416..8417, 8428..8429, 8435, 8437..8443, + * 8446..8458, + * and modes 7727, 7786, 8200 (home cursor on [ED 2]), + * 8800 (some weird Unicode plane 17 mapping?), 8840 (same as 8428). + * + * We're not going to implement them, but avoid these ranges + * when assigning new mode numbers. + * + * The following are the ones from RLogin that MLTerm knows about: + */ + +/* MODE_FIXED(RLOGIN_APPLICATION_ESCAPE, 7727, ALWAYS_RESET) */ +/* MODE_FIXED(RLOGIN_MOUSEWHEEL_TO_CURSORKEYS, 7786, ALWAYS_RESET) */ + +/* Ambiguous-width characters are wide (reset) or narrow (set) */ +MODE_FIXED(RLOGIN_AMBIGUOUS_WIDTH_CHARACTERS_NARROW, 8428, ALWAYS_RESET) + +/* MODE_FIXED(RLOGIN_CURSOR_TO_RIGHT_OF_SIXEL, 8452, ALWAYS_RESET) */ + +/* XTERM also knows this one */ +/* MODE_FIXED(RLOGIN_SIXEL_SCROLL_CURSOR_RIGHT, 8452, ALWAYS_RESET) */ + +/* RXVT */ + +MODE_FIXED(RXVT_TOOLBAR, 10, ALWAYS_RESET) +MODE_FIXED(RXVT_SCROLLBAR, 30, ALWAYS_RESET) +/* MODE_FIXED(RXVT_SHIFT_KEYS, 35, ALWAYS_RESET) ! Conflicts with DECHEBM */ +MODE_FIXED(RXVT_SCROLL_OUTPUT, 1010, ALWAYS_RESET) +MODE_FIXED(RXVT_SCROLL_KEYPRES, 1011, ALWAYS_RESET) +/* Bold/blink uses normal (reset) or high intensity (set) colour */ +MODE_FIXED(RXVT_INTENSITY_STYLES, 1021, ALWAYS_SET) + +/* Wyse */ + +/* + * WYTEK - TEK 4010/4014 personality + * If set, switches to TEK 4010/4014 personality. + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WYTEK, 38, ALWAYS_RESET) + +/* + * WY161 - 161 column mode + * If set, switches the terminal to 161 columns; if reset, + * to 80 columns. + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WY161, 80, ALWAYS_RESET) + +/* + * WY52 - 52 lines mode + * If set, switches the terminal to 52 lines; if reset, + * to 24 lines. + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WY52, 83, ALWAYS_RESET) + +/* + * WYENAT - enable separate attributes + * If set, SGR attributes may be set separately for eraseable + * and noneraseable characters. If reset, the same SGR attributes + * apply to both eraseable and noneraseable characters. + * + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WYENAT, 84, ALWAYS_RESET) + +/* + * WYREPL - replacement character color + * + * Default: reset + * + * References: WY370 + */ +MODE_FIXED(WYREPL, 85, ALWAYS_RESET) + +/* XTERM */ + +MODE_FIXED(XTERM_ATT610_BLINK, 12, ALWAYS_RESET) +MODE_FIXED(XTERM_CURSOR_BLINK, 13, ALWAYS_RESET) +MODE_FIXED(XTERM_CURSOR_BLINK_XOR, 14, ALWAYS_RESET) +MODE_FIXED(XTERM_CURSES_HACK, 41, ALWAYS_RESET) +MODE_FIXED(XTERM_MARGIN_BELL, 44, ALWAYS_RESET) +MODE_FIXED(XTERM_REVERSE_WRAP, 45, ALWAYS_RESET) +MODE_FIXED(XTERM_LOGGING, 46, ALWAYS_RESET) +MODE_FIXED(XTERM_MOUSE_EXT, 1005, ALWAYS_RESET) +MODE_FIXED(XTERM_8BIT_META, 1034, ALWAYS_RESET) +MODE_FIXED(XTERM_NUMLOCK, 1035, ALWAYS_RESET) +MODE_FIXED(XTERM_DELETE_IS_DEL, 1037, ALWAYS_RESET) +MODE_FIXED(XTERM_ALT_SENDS_ESCAPE, 1039, ALWAYS_RESET) +MODE_FIXED(XTERM_KEEP_SELECTION, 1040, ALWAYS_RESET) +MODE_FIXED(XTERM_KEEP_CLIPBOARD, 1044, ALWAYS_RESET) +MODE_FIXED(XTERM_SELECT_TO_CLIPBOARD, 1041, ALWAYS_RESET) +MODE_FIXED(XTERM_BELL_URGENT, 1042, ALWAYS_RESET) +MODE_FIXED(XTERM_PRESENT_ON_BELL, 1043, ALWAYS_RESET) +MODE_FIXED(XTERM_ALLOW_ALTBUF, 1046, ALWAYS_SET) +MODE_FIXED(XTERM_FKEYS_TERMCAP, 1050, ALWAYS_RESET) +MODE_FIXED(XTERM_FKEYS_SUN, 1051, ALWAYS_RESET) +MODE_FIXED(XTERM_FKEYS_HP, 1052, ALWAYS_RESET) +MODE_FIXED(XTERM_FKEYS_SCO, 1053, ALWAYS_RESET) +MODE_FIXED(XTERM_FKEYS_LEGACY, 1060, ALWAYS_RESET) +MODE_FIXED(XTERM_FKEYS_VT220, 1061, ALWAYS_RESET) +MODE_FIXED(XTERM_SIXEL_PRIVATE_COLOR_REGISTERS, 1070, ALWAYS_SET) +MODE_FIXED(XTERM_READLINE_BUTTON1_MOVE_POINT, 2001, ALWAYS_RESET) +MODE_FIXED(XTERM_READLINE_BUTTON2_MOVE_POINT, 2002, ALWAYS_RESET) +MODE_FIXED(XTERM_READLINE_DBLBUTTON3_DELETE, 2003, ALWAYS_RESET) +MODE_FIXED(XTERM_READLINE_PASTE_QUOTE, 2005, ALWAYS_RESET) +MODE_FIXED(XTERM_READLINE_PASTE_LITERAL_NL, 2006, ALWAYS_RESET) diff -Nru vte2.91-0.52.2/src/modes-test.cc vte2.91-0.54.0/src/modes-test.cc --- vte2.91-0.52.2/src/modes-test.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/modes-test.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#include "modes.hh" + +static void +test_modes_ecma(void) +{ + vte::terminal::modes::ECMA modes{}; + + g_assert_false(modes.IRM()); + g_assert_true(modes.SRM()); + modes.set_IRM(true); + g_assert_true(modes.IRM()); + g_assert_true(modes.SRM()); + modes.set_SRM(false); + g_assert_true(modes.IRM()); + g_assert_false(modes.SRM()); + + vte::terminal::modes::ECMA copy{modes}; + g_assert_cmpuint(copy.get_modes(), ==, modes.get_modes()); + g_assert_cmpint(copy.IRM(), ==, modes.IRM()); + g_assert_cmpint(copy.SRM(), ==, modes.SRM()); + + modes.reset(); + g_assert_false(modes.IRM()); + g_assert_true(modes.SRM()); +} + +static void +test_modes_private(void) +{ + vte::terminal::modes::Private modes{}; + + g_assert_true(modes.DEC_AUTOWRAP()); + g_assert_true(modes.XTERM_META_SENDS_ESCAPE()); + + g_assert_false(modes.XTERM_FOCUS()); + modes.set_XTERM_FOCUS(true); + g_assert_true(modes.XTERM_FOCUS()); + modes.push_saved(vte::terminal::modes::Private::eXTERM_FOCUS); + modes.set_XTERM_FOCUS(false); + g_assert_false(modes.XTERM_FOCUS()); + bool set = modes.pop_saved(vte::terminal::modes::Private::eXTERM_FOCUS); + g_assert_true(set); + modes.set_XTERM_FOCUS(set); + g_assert_true(modes.XTERM_FOCUS()); + modes.push_saved(vte::terminal::modes::Private::eXTERM_FOCUS); + modes.clear_saved(); + set = modes.pop_saved(vte::terminal::modes::Private::eXTERM_FOCUS); + g_assert_false(set); +} + +int +main(int argc, + char* argv[]) +{ + g_test_init(&argc, &argv, nullptr); + + g_test_add_func("/vte/modes/ecma", test_modes_ecma); + g_test_add_func("/vte/modes/private", test_modes_private); + + return g_test_run(); +} diff -Nru vte2.91-0.52.2/src/parser-arg.hh vte2.91-0.54.0/src/parser-arg.hh --- vte2.91-0.52.2/src/parser-arg.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-arg.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,186 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +/* + * vte_seq_arg_t: + * + * A type to hold a CSI, OSC or DCS parameter. + * + * Parameters can be final or nonfinal. + * + * Final parameters are those that occur at the end of the + * parameter list, or the end of a subparameter list. + * + * Nonfinal parameters are those that have subparameters + * after them. + * + * Parameters have default value or have a nondefault value. + */ +typedef int vte_seq_arg_t; + +#define VTE_SEQ_ARG_FLAG_VALUE (1 << 16) +#define VTE_SEQ_ARG_FLAG_NONFINAL (1 << 17) +#define VTE_SEQ_ARG_FLAG_MASK (VTE_SEQ_ARG_FLAG_VALUE | VTE_SEQ_ARG_FLAG_NONFINAL) +#define VTE_SEQ_ARG_VALUE_MASK (0xffff) + +/* + * VTE_SEQ_ARG_INIT_DEFAULT: + * + * Returns: a parameter with default value + */ +#define VTE_SEQ_ARG_INIT_DEFAULT (0) + +/* + * VTE_SEQ_ARG_INIT: + * @value: + * + * Returns: a parameter with value @value + */ +#define VTE_SEQ_ARG_INIT(value) ((value & VTE_SEQ_ARG_VALUE_MASK) | VTE_SEQ_ARG_FLAG_VALUE) + +/* + * vte_seq_arg_init: + * @value: + * + * Returns: a #vte_seq_arg_t for @value, or with default value if @value is -1 + */ +static constexpr inline vte_seq_arg_t vte_seq_arg_init(int value) +{ + if (value == -1) + return VTE_SEQ_ARG_INIT_DEFAULT; + else + return VTE_SEQ_ARG_INIT(value); +} + +/* + * vte_seq_arg_push: + * @arg: + * @c: a value between 3/0 and 3/9 ['0' .. '9'] + * + * Multiplies @arg by 10 and adds the numeric value of @c. + * + * After this, @arg has a value. + */ +static inline void vte_seq_arg_push(vte_seq_arg_t* arg, + uint32_t c) +{ + auto value = *arg & VTE_SEQ_ARG_VALUE_MASK; + value = value * 10 + (c - '0'); + + /* + * VT510 tells us to clamp all values to [0, 9999], however, it + * also allows commands with values up to 2^15-1. We simply use + * 2^16 as maximum here to be compatible to all commands, but + * avoid overflows in any calculations. + */ + if (value > 0xffff) + value = 0xffff; + + *arg = value | VTE_SEQ_ARG_FLAG_VALUE; +} + +/* + * vte_seq_arg_finish: + * @arg: + * @finalise: + * + * Finishes @arg; after this no more vte_seq_arg_push() calls + * are allowed. + * + * If @nonfinal is %true, marks @arg as a nonfinal parameter, is, + * there are more subparameters after it. + */ +static inline void vte_seq_arg_finish(vte_seq_arg_t* arg, + bool nonfinal = false) +{ + if (nonfinal) + *arg |= VTE_SEQ_ARG_FLAG_NONFINAL; +} + +static inline void vte_seq_arg_refinish(vte_seq_arg_t* arg, + bool nonfinal = false) +{ + if (nonfinal) + *arg |= VTE_SEQ_ARG_FLAG_NONFINAL; + else + *arg &= ~VTE_SEQ_ARG_FLAG_NONFINAL; +} + +/* + * vte_seq_arg_started: + * @arg: + * + * Returns: whether @arg has nondefault value + */ +static constexpr inline bool vte_seq_arg_started(vte_seq_arg_t arg) +{ + return arg & VTE_SEQ_ARG_FLAG_VALUE; +} + +/* + * vte_seq_arg_default: + * @arg: + * + * Returns: whether @arg has default value + */ +static constexpr inline bool vte_seq_arg_default(vte_seq_arg_t arg) +{ + return !(arg & VTE_SEQ_ARG_FLAG_VALUE); +} + +/* + * vte_seq_arg_nonfinal: + * @arg: + * + * Returns: whether @arg is a nonfinal parameter, i.e. there + * are more subparameters after it + */ +static constexpr inline int vte_seq_arg_nonfinal(vte_seq_arg_t arg) +{ + return (arg & VTE_SEQ_ARG_FLAG_NONFINAL); +} + +/* + * vte_seq_arg_value: + * @arg: + * @default_value: (defaults to -1) + * + * Returns: the value of @arg, or @default_value if @arg has default value + */ +static constexpr inline int vte_seq_arg_value(vte_seq_arg_t arg, + int default_value = -1) +{ + return (arg & VTE_SEQ_ARG_FLAG_VALUE) ? (arg & VTE_SEQ_ARG_VALUE_MASK) : default_value; +} + +/* + * vte_seq_arg_value_final: + * @arg: + * @default_value: (defaults to -1) + * + * Returns: the value of @arg, or @default_value if @arg has default value or is not final + */ +static constexpr inline int vte_seq_arg_value_final(vte_seq_arg_t arg, + int default_value = -1) +{ + return ((arg & VTE_SEQ_ARG_FLAG_MASK) == VTE_SEQ_ARG_FLAG_VALUE) ? (arg & VTE_SEQ_ARG_VALUE_MASK) : default_value; +} diff -Nru vte2.91-0.52.2/src/parser-c01.hh vte2.91-0.54.0/src/parser-c01.hh --- vte2.91-0.52.2/src/parser-c01.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-c01.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,73 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_SEQ) || !defined(_VTE_NOQ) +#error "Must define _VTE_SEQ and _VTE_NOQ before including this file" +#endif + +_VTE_NOQ(NUL, CONTROL, 0x00, NONE, 0, NONE) +_VTE_NOQ(SOH, CONTROL, 0x01, NONE, 0, NONE) +_VTE_NOQ(STX, CONTROL, 0x02, NONE, 0, NONE) +_VTE_NOQ(ETX, CONTROL, 0x03, NONE, 0, NONE) +_VTE_NOQ(EOT, CONTROL, 0x04, NONE, 0, NONE) +_VTE_NOQ(ENQ, CONTROL, 0x05, NONE, 0, NONE) +_VTE_NOQ(ACK, CONTROL, 0x06, NONE, 0, NONE) +_VTE_SEQ(BEL, CONTROL, 0x07, NONE, 0, NONE) +_VTE_SEQ(BS, CONTROL, 0x08, NONE, 0, NONE) +_VTE_SEQ(HT, CONTROL, 0x09, NONE, 0, NONE) +_VTE_SEQ(LF, CONTROL, 0x0a, NONE, 0, NONE) +_VTE_SEQ(VT, CONTROL, 0x0b, NONE, 0, NONE) +_VTE_SEQ(FF, CONTROL, 0x0c, NONE, 0, NONE) +_VTE_SEQ(CR, CONTROL, 0x0d, NONE, 0, NONE) +_VTE_SEQ(LS1, CONTROL, 0x0e, NONE, 0, NONE) +_VTE_SEQ(LS0, CONTROL, 0x0f, NONE, 0, NONE) +_VTE_NOQ(DLE, CONTROL, 0x10, NONE, 0, NONE) +_VTE_NOQ(DC1, CONTROL, 0x11, NONE, 0, NONE) +_VTE_NOQ(DC2, CONTROL, 0x12, NONE, 0, NONE) +_VTE_NOQ(DC3, CONTROL, 0x13, NONE, 0, NONE) +_VTE_NOQ(DC4, CONTROL, 0x14, NONE, 0, NONE) +_VTE_NOQ(SYN, CONTROL, 0x16, NONE, 0, NONE) +_VTE_NOQ(ETB, CONTROL, 0x17, NONE, 0, NONE) +_VTE_NOQ(EM, CONTROL, 0x19, NONE, 0, NONE) +_VTE_SEQ(SUB, CONTROL, 0x1a, NONE, 0, NONE) +_VTE_NOQ(IS4, CONTROL, 0x1c, NONE, 0, NONE) +_VTE_NOQ(IS3, CONTROL, 0x1d, NONE, 0, NONE) +_VTE_NOQ(IS2, CONTROL, 0x1e, NONE, 0, NONE) +_VTE_NOQ(IS1, CONTROL, 0x1f, NONE, 0, NONE) +_VTE_NOQ(BPH, CONTROL, 0x82, NONE, 0, NONE) +_VTE_NOQ(NBH, CONTROL, 0x83, NONE, 0, NONE) +_VTE_SEQ(IND, CONTROL, 0x84, NONE, 0, NONE) +_VTE_SEQ(NEL, CONTROL, 0x85, NONE, 0, NONE) +_VTE_NOQ(SSA, CONTROL, 0x86, NONE, 0, NONE) +_VTE_NOQ(ESA, CONTROL, 0x87, NONE, 0, NONE) +_VTE_SEQ(HTS, CONTROL, 0x88, NONE, 0, NONE) +_VTE_SEQ(HTJ, CONTROL, 0x89, NONE, 0, NONE) +_VTE_NOQ(VTS, CONTROL, 0x8a, NONE, 0, NONE) +_VTE_NOQ(PLD, CONTROL, 0x8b, NONE, 0, NONE) +_VTE_NOQ(PLU, CONTROL, 0x8c, NONE, 0, NONE) +_VTE_SEQ(RI, CONTROL, 0x8d, NONE, 0, NONE) +_VTE_SEQ(SS2, CONTROL, 0x8e, NONE, 0, NONE) +_VTE_SEQ(SS3, CONTROL, 0x8f, NONE, 0, NONE) +_VTE_NOQ(PU1, CONTROL, 0x91, NONE, 0, NONE) +_VTE_NOQ(PU2, CONTROL, 0x92, NONE, 0, NONE) +_VTE_NOQ(STS, CONTROL, 0x93, NONE, 0, NONE) +_VTE_NOQ(CCH, CONTROL, 0x94, NONE, 0, NONE) +_VTE_NOQ(NAK, CONTROL, 0x95, NONE, 0, NONE) +_VTE_NOQ(SPA, CONTROL, 0x96, NONE, 0, NONE) +_VTE_NOQ(EPA, CONTROL, 0x97, NONE, 0, NONE) +_VTE_NOQ(ST, CONTROL, 0x9c, NONE, 0, NONE) diff -Nru vte2.91-0.52.2/src/parser-cat.cc vte2.91-0.54.0/src/parser-cat.cc --- vte2.91-0.52.2/src/parser-cat.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-cat.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,547 @@ +/* + * Copyright (C) 2001,2002,2003 Red Hat, Inc. + * Copyright © 2017, 2018 Christian Persch + * + * This programme is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This programme is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "debug.h" +#include "parser.hh" +#include "utf8.hh" + +static char const* +seq_to_str(unsigned int type) +{ + switch (type) { + case VTE_SEQ_NONE: return "NONE"; + case VTE_SEQ_IGNORE: return "IGNORE"; + case VTE_SEQ_GRAPHIC: return "GRAPHIC"; + case VTE_SEQ_CONTROL: return "CONTROL"; + case VTE_SEQ_ESCAPE: return "ESCAPE"; + case VTE_SEQ_CSI: return "CSI"; + case VTE_SEQ_DCS: return "DCS"; + case VTE_SEQ_OSC: return "OSC"; + case VTE_SEQ_SCI: return "SCI"; + case VTE_SEQ_APC: return "APC"; + case VTE_SEQ_PM: return "PM"; + case VTE_SEQ_SOS: return "SOS"; + default: + assert(false); + } +} + +static char const* +cmd_to_str(unsigned int command) +{ + switch (command) { +#define _VTE_CMD(cmd) case VTE_CMD_##cmd: return #cmd; +#define _VTE_NOP(cmd) _VTE_CMD(cmd) +#include "parser-cmd.hh" +#undef _VTE_CMD +#undef _VTE_NOP + default: + return nullptr; + } +} + +#if 0 +static char const* +charset_alias_to_str(unsigned int cs) +{ + switch (cs) { +#define _VTE_CHARSET_PASTE(name) +#define _VTE_CHARSET(name) _VTE_CHARSET_PASTE(name) +#define _VTE_CHARSET_ALIAS_PASTE(name1,name2) case VTE_CHARSET_##name1: return #name1 "(" ## #name2 ## ")"; +#define _VTE_CHARSET_ALIAS(name1,name2) +#include "parser-charset.hh" +#undef _VTE_CHARSET_PASTE +#undef _VTE_CHARSET +#undef _VTE_CHARSET_ALIAS_PASTE +#undef _VTE_CHARSET_ALIAS + default: + return nullptr; /* not an alias */ + } +} + +static char const* +charset_to_str(unsigned int cs) +{ + auto alias = charset_alias_to_str(cs); + if (alias) + return alias; + + switch (cs) { +#define _VTE_CHARSET_PASTE(name) case VTE_CHARSET_##name: return #name; +#define _VTE_CHARSET(name) _VTE_CHARSET_PASTE(name) +#define _VTE_CHARSET_ALIAS_PASTE(name1,name2) +#define _VTE_CHARSET_ALIAS(name1,name2) +#include "parser-charset.hh" +#undef _VTE_CHARSET_PASTE +#undef _VTE_CHARSET +#undef _VTE_CHARSET_ALIAS_PASTE +#undef _VTE_CHARSET_ALIAS + default: + static char buf[32]; + snprintf(buf, sizeof(buf), "UNKOWN(%u)", cs); + return buf; + } +} +#endif + +#define SEQ_START "\e[7m" +#define SEQ_END "\e[27m" + +#define SEQ_START_RED "\e[7;31m" +#define SEQ_END_RED "\e[27;39m" + +class printer { +public: + printer(GString* str, + bool plain, + char const* intro, + char const* outro) + : m_str(str), + m_plain(plain), + m_outro(outro) { + if (!m_plain) + g_string_append(m_str, intro); + } + ~printer() { + if (!m_plain) + g_string_append(m_str, m_outro); + } +private: + GString* m_str; + bool m_plain; + char const* m_outro; +}; + +static void +print_params(GString* str, + struct vte_seq const* seq) +{ + if (seq->n_args > 0) + g_string_append_c(str, ' '); + + for (unsigned int i = 0; i < seq->n_args; i++) { + auto arg = seq->args[i]; + if (!vte_seq_arg_default(arg)) + g_string_append_printf(str, "%d", vte_seq_arg_value(arg)); + if (i + 1 < seq->n_args) + g_string_append_c(str, vte_seq_arg_nonfinal(arg) ? ':' : ';'); + } +} + +static void +print_pintro(GString* str, + unsigned int type, + unsigned int intermediates) +{ + if (type != VTE_SEQ_CSI && + type != VTE_SEQ_DCS) + return; + + unsigned int p = intermediates & 0x7; + if (p == 0) + return; + + g_string_append_c(str, ' '); + g_string_append_c(str, 0x40 - p); +} + +static void +print_intermediates(GString* str, + unsigned int type, + unsigned int intermediates) +{ + if (type == VTE_SEQ_CSI || + type == VTE_SEQ_DCS) + intermediates = intermediates >> 3; /* remove pintro */ + + while (intermediates != 0) { + unsigned int i = intermediates & 0x1f; + char c = 0x20 + i - 1; + + g_string_append_c(str, ' '); + if (c == 0x20) + g_string_append(str, "SP"); + else + g_string_append_c(str, c); + + intermediates = intermediates >> 5; + } +} + +static void +print_string(GString* str, + struct vte_seq const* seq) +{ + size_t len; + auto buf = vte_seq_string_get(&seq->arg_str, &len); + + g_string_append_c(str, '\"'); + for (size_t i = 0; i < len; ++i) + g_string_append_unichar(str, buf[i]); + g_string_append_c(str, '\"'); +} + +static void +print_seq_and_params(GString* str, + const struct vte_seq *seq, + bool plain) +{ + printer p(str, plain, SEQ_START, SEQ_END); + + if (seq->command != VTE_CMD_NONE) { + g_string_append_printf(str, "{%s", cmd_to_str(seq->command)); + print_params(str, seq); + g_string_append_c(str, '}'); + } else { + g_string_append_printf(str, "{%s", seq_to_str(seq->type)); + print_pintro(str, seq->type, seq->intermediates); + print_params(str, seq); + print_intermediates(str, seq->type, seq->intermediates); + g_string_append_printf(str, " %c}", seq->terminator); + } +} + +static void +print_seq(GString* str, + struct vte_seq const* seq, + bool codepoints, + bool plain) +{ + switch (seq->type) { + case VTE_SEQ_NONE: { + printer p(str, plain, SEQ_START_RED, SEQ_END_RED); + g_string_append(str, "{NONE}"); + break; + } + + case VTE_SEQ_IGNORE: { + printer p(str, plain, SEQ_START_RED, SEQ_END_RED); + g_string_append(str, "{IGN}"); + break; + } + + case VTE_SEQ_GRAPHIC: { + bool printable = g_unichar_isprint(seq->terminator); + if (codepoints || !printable) { + if (printable) { + char ubuf[7]; + ubuf[g_unichar_to_utf8(seq->terminator, ubuf)] = 0; + g_string_append_printf(str, "[%04X %s]", + seq->terminator, ubuf); + } else { + g_string_append_printf(str, "[%04X]", + seq->terminator); + } + } else { + g_string_append_unichar(str, seq->terminator); + } + break; + } + + case VTE_SEQ_CONTROL: + case VTE_SEQ_ESCAPE: { + printer p(str, plain, SEQ_START, SEQ_END); + g_string_append_printf(str, "{%s}", cmd_to_str(seq->command)); + break; + } + + case VTE_SEQ_CSI: + case VTE_SEQ_DCS: { + print_seq_and_params(str, seq, plain); + break; + } + + case VTE_SEQ_OSC: { + printer p(str, plain, SEQ_START, SEQ_END); + g_string_append(str, "{OSC "); + print_string(str, seq); + g_string_append_c(str, '}'); + break; + } + + case VTE_SEQ_SCI: { + if (seq->terminator <= 0x20) + g_string_append_printf(str, "{SCI %d/%d}", + seq->terminator / 16, + seq->terminator % 16); + else + g_string_append_printf(str, "{SCI %c}", seq->terminator); + break; + } + + default: + assert(false); + } +} + +static void +printout(GString* str) +{ + g_print("%s\n", str->str); + g_string_truncate(str, 0); +} + +static gsize seq_stats[VTE_SEQ_N]; +static gsize cmd_stats[VTE_CMD_N]; +static GArray* bench_times; + +static void +process_file_utf8(int fd, + bool codepoints, + bool plain, + bool quiet) +{ + struct vte_parser parser; + vte_parser_init(&parser); + + gsize const buf_size = 16384; + guchar* buf = g_new0(guchar, buf_size); + auto outbuf = g_string_sized_new(buf_size); + + auto start_time = g_get_monotonic_time(); + + vte::base::UTF8Decoder decoder; + + gsize buf_start = 0; + for (;;) { + auto len = read(fd, buf + buf_start, buf_size - buf_start); + if (!len) + break; + if (len == -1) { + if (errno == EAGAIN) + continue; + break; + } + + auto const bufend = buf + len; + + struct vte_seq *seq = &parser.seq; + + for (auto sptr = buf; sptr < bufend; ++sptr) { + switch (decoder.decode(*sptr)) { + case vte::base::UTF8Decoder::REJECT: + decoder.reset(); + + /* If a start byte occurred in the middle of a sequence, + * rewind the stream so we try to start a new character + * with it. + * Note that this will never lead to a loop, since in the + * next round this byte *will* be consumed. + */ + if (decoder.is_start_byte(*sptr)) + --sptr; + + /* Fall through to insert the U+FFFD replacement character. */ + /* [[fallthrough]]; */ + case vte::base::UTF8Decoder::ACCEPT: { + auto ret = vte_parser_feed(&parser, decoder.codepoint()); + if (G_UNLIKELY(ret < 0)) { + g_printerr("Parser error!\n"); + goto out; + } + + seq_stats[ret]++; + if (ret != VTE_SEQ_NONE) { + cmd_stats[seq->command]++; + if (!quiet) { + print_seq(outbuf, seq, codepoints, plain); + if (seq->command == VTE_CMD_LF) + printout(outbuf); + } + } + break; + } + + default: + break; + } + } + } + + out: + if (!quiet) + printout(outbuf); + + int64_t time_spent = g_get_monotonic_time() - start_time; + g_array_append_val(bench_times, time_spent); + + g_string_free(outbuf, TRUE); + g_free(buf); + vte_parser_deinit(&parser); +} + +static bool +process_file(int fd, + bool codepoints, + bool plain, + bool quiet, + int repeat) +{ + if (fd == STDIN_FILENO && repeat != 1) { + g_printerr("Cannot consume STDIN more than once\n"); + return false; + } + + for (auto i = 0; i < repeat; ++i) { + if (i > 0 && lseek(fd, 0, SEEK_SET) != 0) { + g_printerr("Failed to seek: %m\n"); + return false; + } + + process_file_utf8(fd, codepoints, plain, quiet); + } + + return true; +} + +int +main(int argc, + char *argv[]) +{ + gboolean benchmark = false; + gboolean codepoints = false; + gboolean plain = false; + gboolean quiet = false; + gboolean statistics = false; + int repeat = 1; + char** filenames = nullptr; + GOptionEntry const entries[] = { + { "benchmark", 'b', 0, G_OPTION_ARG_NONE, &benchmark, + "Measure time spent parsing each file", nullptr }, + { "codepoints", 'u', 0, G_OPTION_ARG_NONE, &codepoints, + "Output unicode code points by number", nullptr }, + { "plain", 'p', 0, G_OPTION_ARG_NONE, &plain, + "Output plain text without attributes", nullptr }, + { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, + "Suppress output except for statistics and benchmark", nullptr }, + { "repeat", 'r', 0, G_OPTION_ARG_INT, &repeat, + "Repeat each file COUNT times", "COUNT" }, + { "statistics", 's', 0, G_OPTION_ARG_NONE, &statistics, + "Output statistics", nullptr }, + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, + nullptr, nullptr }, + { nullptr } + }; + + setlocale(LC_ALL, ""); + _vte_debug_init(); + + auto context = g_option_context_new("[FILE…] — parser cat"); + g_option_context_set_help_enabled(context, true); + g_option_context_add_main_entries(context, entries, nullptr); + + GError* err = nullptr; + bool rv = g_option_context_parse(context, &argc, &argv, &err); + g_option_context_free(context); + + if (!rv) { + g_printerr("Failed to parse arguments: %s\n", err->message); + g_error_free(err); + return EXIT_FAILURE; + } + + int exit_status = EXIT_FAILURE; + + memset(&seq_stats, 0, sizeof(seq_stats)); + memset(&cmd_stats, 0, sizeof(cmd_stats)); + bench_times = g_array_new(false, true, sizeof(int64_t)); + + if (filenames != nullptr) { + for (auto i = 0; filenames[i] != nullptr; i++) { + char const* filename = filenames[i]; + + int fd = -1; + if (g_str_equal(filename, "-")) { + fd = STDIN_FILENO; + } else { + fd = open(filename, O_RDONLY); + if (fd == -1) { + g_printerr("Error opening file %s: %m\n", filename); + } + } + if (fd != -1) { + bool r = process_file(fd, codepoints, plain, quiet, repeat); + close(fd); + if (!r) + break; + } + } + + g_strfreev(filenames); + exit_status = EXIT_SUCCESS; + } else { + if (process_file(STDIN_FILENO, codepoints, plain, quiet, repeat)) + exit_status = EXIT_SUCCESS; + } + + if (statistics) { + for (unsigned int s = VTE_SEQ_NONE + 1; s < VTE_SEQ_N; s++) { + g_printerr("%\'16" G_GSIZE_FORMAT " %s\n", seq_stats[s], seq_to_str(s)); + } + + g_printerr("\n"); + for (unsigned int s = 0; s < VTE_CMD_N; s++) { + if (cmd_stats[s] > 0) { + g_printerr("%\'16" G_GSIZE_FORMAT " %s%s\n", + cmd_stats[s], + cmd_to_str(s), + s >= VTE_CMD_NOP_FIRST ? " [NOP]" : ""); + } + } + } + + if (benchmark) { + g_array_sort(bench_times, + [](void const* p1, void const* p2) -> int { + int64_t const t1 = *(int64_t const*)p1; + int64_t const t2 = *(int64_t const*)p2; + return t1 == t2 ? 0 : (t1 < t2 ? -1 : 1); + }); + + int64_t total_time = 0; + for (unsigned int i = 0; i < bench_times->len; ++i) + total_time += g_array_index(bench_times, int64_t, i); + + g_printerr("\nTimes: best %\'" G_GINT64_FORMAT "µs " + "worst %\'" G_GINT64_FORMAT "µs " + "average %\'" G_GINT64_FORMAT "µs\n", + g_array_index(bench_times, int64_t, 0), + g_array_index(bench_times, int64_t, bench_times->len - 1), + total_time / (int64_t)bench_times->len); + for (unsigned int i = 0; i < bench_times->len; ++i) + g_printerr(" %\'" G_GINT64_FORMAT "µs\n", + g_array_index(bench_times, int64_t, i)); + } + + g_array_free(bench_times,true); + + return exit_status; +} diff -Nru vte2.91-0.52.2/src/parser.cc vte2.91-0.54.0/src/parser.cc --- vte2.91-0.52.2/src/parser.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,1334 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2017, 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "parser.hh" + +#include +#include +#include +#include + +#include + +#include "parser-charset-tables.hh" + +#ifdef PARSER_INCLUDE_NOP +#define _VTE_NOQ(...) _VTE_SEQ(__VA_ARGS__) +#else +#define _VTE_NOQ(...) +#endif + +/* + * Terminal Parser + * This file contains a bunch of UTF-8 helpers and the main ctlseq-parser. The + * parser is a simple state-machine that correctly parses all CSI, DCS, OSC, ST + * control sequences and generic escape sequences. + * The parser itself does not perform any actions but lets the caller react to + * detected sequences. + */ + +/* + * Command Parser + * The ctl-seq parser "vte_parser" only detects whole sequences, it does not + * detect the specific command. Once a sequence is parsed, the command-parsers + * are used to figure out their meaning. + */ + +/* + * Intermediates (and, for CSI/DCS, the optional parameter character) are + * stored efficiently in an unsigned int. Intermediates can be 2/00..2/15, + * plus one value for 'no intermediate'; together that fits into 5 bits. + * Parameter character can be 'no parameter character', or one from + * 3/12..3/15; that fits into 3 bits. + * + * In @seq.intermediates, the nth intermediates is stored with shift n * 5, + * plus (for CSI/DCS) an additional shift of 3 for the parameter character + * which is stored at bits 0..2. + * + * VTE_SEQ_PARAMETER(u) extracts the parameter character + * of a CSI or DCS sequence + * VTE_SEQ_REMOVE_PARAMETER(u) extracts the intermediates + * of a CSI or DCS sequence + * VTE_SEQ_INTERMEDIATE(u) extracts the first intermediate from an + * intermediates value (for CSI/DCS, that must be without parameter + * character, see VTE_SEQ_REMOVE_PARAMETER) + * VTE_SEQ_REMOVE_INTERMEDIATE(u) extracts the remaining intermediates + * after the first one; use VTE_SEQ_INTERMEDIATE on its return value + * to extract the 2nd intermediate, and so on + */ + +#define VTE_SEQ_PARAMETER_BITS (3) +#define VTE_SEQ_INTERMEDIATE_BITS (5) +#define VTE_SEQ_INTERMEDIATE_MASK ((1U << VTE_SEQ_INTERMEDIATE_BITS) - 1U) +#define VTE_SEQ_PARAMETER_MASK ((1U << VTE_SEQ_PARAMETER_BITS) - 1U) +#define VTE_SEQ_PARAMETER(u) ((u) & VTE_SEQ_PARAMETER_MASK) +#define VTE_SEQ_REMOVE_PARAMETER(u) ((u) >> VTE_SEQ_PARAMETER_BITS) +#define VTE_SEQ_INTERMEDIATE(u) ((u) & VTE_SEQ_INTERMEDIATE_MASK) +#define VTE_SEQ_REMOVE_INTERMEDIATE(u) ((u) >> VTE_SEQ_INTERMEDIATE_BITS) +#define VTE_MAKE_CHARSET(c,s) ((c) | ((s) << VTE_CHARSET_SLOT_OFFSET)) + +/* + * _VTE_SEQ_CODE_ESC(final, intermediates): + * + * Make a value combining the final character and the intermediates, + * to be used to match a sequence against known sequences. + * + * Since this is only used with NONE or HASH as first intermediate, + * we can reduce the size of the lookup table by slashing the least + * significant bit off. + * + * Final characters is 3/0..7/14, needing 7 bits. + */ +#define _VTE_SEQ_CODE_ESC(f,i) (((f) - 0x30) | ((i) >> 1) << 7) + +/* + * _VTE_SEQ_CODE_COMBINE(parameter, intermediates) + * + * Combines intermediates and the parameter character into one + * value to be used when matching a sequence against known sequences. + */ +#define _VTE_SEQ_CODE_COMBINE(p,i) ((p) | ((i) << VTE_SEQ_PARAMETER_BITS)) + +/* + * _VTE_SEQ_CODE(final, intermediates): + * + * Make a value combining the final character and the intermediates, + * to be used to match a sequence against known sequences. Used for + * CSI and DCS sequences; use _VTE_SEQ_CODE_COMBINE to combine + * parameter and intermediates into one to pass as 2nd argument here. + * + * Final character is 4/0..7/14, needing 6 bits. + */ +#define _VTE_SEQ_CODE(f,i) (((f) - 0x40) | ((i) << 6)) + +/* + * @introducer: either a C1 control, or the final in the equivalent ESC F sequence + * @terminator: either a C1 control, or the final in the equivalent ESC F sequence + * + * Checks whether the OSC/DCS @introducer and the ST @terminator + * are from the same control set, i.e. both C0 or both C1. + * + * For OSC, this check allows C0 OSC with BEL-as-ST to pass, too. + */ +static inline bool parser_check_matching_controls(uint32_t introducer, + uint32_t terminator) +{ + return ((introducer ^ terminator) & 0x80) == 0; +} + +static unsigned int vte_parse_host_control(const struct vte_seq *seq) +{ + switch (seq->terminator) { +#define _VTE_SEQ(cmd,type,f,pi,ni,i0) case f: return VTE_CMD_##cmd; +#include "parser-c01.hh" +#undef _VTE_SEQ + default: return VTE_CMD_NONE; + } +} + +static unsigned int vte_parse_charset_94(uint32_t raw, + unsigned int intermediates) +{ + assert (raw >= 0x30 && raw < 0x7f); + + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + + switch (VTE_SEQ_INTERMEDIATE(intermediates)) { + case VTE_SEQ_INTERMEDIATE_NONE: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_94))) + return charset_graphic_94[raw - 0x30]; + break; + + case VTE_SEQ_INTERMEDIATE_SPACE: + return VTE_CHARSET_DRCS; + + case VTE_SEQ_INTERMEDIATE_BANG: + if (remaining_intermediates == 0 && + raw >= 0x40 && (raw < 0x40 + G_N_ELEMENTS(charset_graphic_94_with_2_1))) + return charset_graphic_94_with_2_1[raw - 0x40]; + break; + + case VTE_SEQ_INTERMEDIATE_DQUOTE: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_94_with_2_2))) + return charset_graphic_94_with_2_2[raw - 0x30]; + break; + + case VTE_SEQ_INTERMEDIATE_HASH: + case VTE_SEQ_INTERMEDIATE_CASH: + break; + + case VTE_SEQ_INTERMEDIATE_PERCENT: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_94_with_2_5))) + return charset_graphic_94_with_2_5[raw - 0x30]; + break; + + case VTE_SEQ_INTERMEDIATE_AND: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_94_with_2_6))) + return charset_graphic_94_with_2_6[raw - 0x30]; + break; + } + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_charset_94_n(uint32_t raw, + unsigned int intermediates) +{ + assert (raw >= 0x30 && raw < 0x7f); + + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + + switch (VTE_SEQ_INTERMEDIATE(intermediates)) { + case VTE_SEQ_INTERMEDIATE_NONE: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_94_n))) + return charset_graphic_94_n[raw - 0x30]; + break; + + case VTE_SEQ_INTERMEDIATE_SPACE: + return VTE_CHARSET_DRCS; + } + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_charset_96(uint32_t raw, + unsigned int intermediates) +{ + assert (raw >= 0x30 && raw < 0x7f); + + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + + switch (VTE_SEQ_INTERMEDIATE(intermediates)) { + case VTE_SEQ_INTERMEDIATE_NONE: + if (remaining_intermediates == 0 && + raw < (0x30 + G_N_ELEMENTS(charset_graphic_96))) + return charset_graphic_96[raw - 0x30]; + break; + + case VTE_SEQ_INTERMEDIATE_SPACE: + return VTE_CHARSET_DRCS; + } + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_charset_96_n(uint32_t raw, + unsigned int intermediates) +{ + if (VTE_SEQ_INTERMEDIATE(intermediates) == VTE_SEQ_INTERMEDIATE_SPACE) + return VTE_CHARSET_DRCS; + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_charset_ocs(uint32_t raw, + unsigned int intermediates) +{ + assert (raw >= 0x30 && raw < 0x7f); + + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + + switch (VTE_SEQ_INTERMEDIATE(intermediates)) { + case VTE_SEQ_INTERMEDIATE_NONE: /* OCS with standard return */ + if (remaining_intermediates == 0 && + raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_ocs_with_return))) + return charset_ocs_with_return[raw - 0x40]; + break; + + case VTE_SEQ_INTERMEDIATE_SLASH: /* OCS without standard return */ + if (remaining_intermediates == 0 && + raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_ocs_without_return))) + return charset_ocs_without_return[raw - 0x40]; + break; + } + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_charset_control(uint32_t raw, + unsigned int intermediates) +{ + assert (raw >= 0x30 && raw < 0x7f); + + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + + switch (VTE_SEQ_INTERMEDIATE(intermediates)) { + case VTE_SEQ_INTERMEDIATE_BANG: /* C0 controls */ + if (remaining_intermediates == 0 && + raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_control_c0))) + return charset_control_c0[raw - 0x40]; + break; + + case VTE_SEQ_INTERMEDIATE_DQUOTE: /* C1 controls */ + if (remaining_intermediates == 0 && + raw >= 0x40 && raw < (0x40 + G_N_ELEMENTS(charset_control_c1))) + return charset_control_c1[raw - 0x40]; + break; + } + + return VTE_CHARSET_NONE; +} + +static unsigned int vte_parse_host_escape(const struct vte_seq *seq, + unsigned int *cs_out) +{ + unsigned int intermediates = seq->intermediates; + unsigned int intermediate0 = VTE_SEQ_INTERMEDIATE(intermediates); + + /* Switch on the first intermediate */ + switch (intermediate0) { + case VTE_SEQ_INTERMEDIATE_NONE: + case VTE_SEQ_INTERMEDIATE_HASH: { /* Single control functions */ + switch (_VTE_SEQ_CODE_ESC(seq->terminator, intermediates)) { +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + case _VTE_SEQ_CODE_ESC(f, VTE_SEQ_INTERMEDIATE_##i): return VTE_CMD_##cmd; +#include "parser-esc.hh" +#undef _VTE_SEQ + default: return VTE_CMD_NONE; + } + break; + } + + case VTE_SEQ_INTERMEDIATE_SPACE: /* Announce code structure */ + if (VTE_SEQ_REMOVE_INTERMEDIATE(intermediates) == 0) + return VTE_CMD_ACS; + break; + + case VTE_SEQ_INTERMEDIATE_BANG: /* C0-designate */ + case VTE_SEQ_INTERMEDIATE_DQUOTE: /* C1-designate */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_control(seq->terminator, intermediates), + intermediate0 - VTE_SEQ_INTERMEDIATE_BANG); + return VTE_CMD_CnD; + + case VTE_SEQ_INTERMEDIATE_CASH: { /* Designate multi-byte character sets */ + unsigned int remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(intermediates); + unsigned int intermediate1 = VTE_SEQ_INTERMEDIATE(remaining_intermediates); + remaining_intermediates = VTE_SEQ_REMOVE_INTERMEDIATE(remaining_intermediates); + + /* Check the 2nd intermediate */ + switch (intermediate1) { + case VTE_SEQ_INTERMEDIATE_NONE: + /* For compatibility with an earlier version of ISO-2022, + * ESC 2/4 4/0, ESC 2/4 4/1 and ESC 2/4 4/2 designate G0 + * sets (i.e., without the 2/8 as 2nd intermediate byte). + */ + switch (seq->terminator) { + case '@': + case 'A': + case 'B': /* G0-designate multibyte charset */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_94_n(seq->terminator, + remaining_intermediates), + 0); + return VTE_CMD_GnDMm; + } + break; + + case VTE_SEQ_INTERMEDIATE_POPEN: /* G0-designate 94^n-set */ + case VTE_SEQ_INTERMEDIATE_PCLOSE: /* G1-designate 94^n-set */ + case VTE_SEQ_INTERMEDIATE_MULT: /* G2-designate 94^n-set */ + case VTE_SEQ_INTERMEDIATE_PLUS: /* G3-designate 94^n-set */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_94_n(seq->terminator, + remaining_intermediates), + intermediate1 - VTE_SEQ_INTERMEDIATE_POPEN); + return VTE_CMD_GnDMm; + + case VTE_SEQ_INTERMEDIATE_COMMA: /* Reserved for future standardisation */ + break; + + case VTE_SEQ_INTERMEDIATE_MINUS: /* G1-designate 96^n-set */ + case VTE_SEQ_INTERMEDIATE_DOT: /* G2-designate 96^n-set */ + case VTE_SEQ_INTERMEDIATE_SLASH: /* G3-designate 96^n-set */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_96_n(seq->terminator, + remaining_intermediates), + intermediate1 - VTE_SEQ_INTERMEDIATE_COMMA); + return VTE_CMD_GnDMm; + } + break; + } + + case VTE_SEQ_INTERMEDIATE_PERCENT: /* Designate other coding system */ + *cs_out = vte_parse_charset_ocs(seq->terminator, + VTE_SEQ_REMOVE_INTERMEDIATE(intermediates)); + return VTE_CMD_DOCS; + + case VTE_SEQ_INTERMEDIATE_AND: /* Identify revised registration */ + if (VTE_SEQ_REMOVE_INTERMEDIATE(intermediates) == 0) + return VTE_CMD_IRR; + break; + + case VTE_SEQ_INTERMEDIATE_SQUOTE: /* Reserved for future standardisation */ + break; + + case VTE_SEQ_INTERMEDIATE_POPEN: /* G0-designate 94-set */ + case VTE_SEQ_INTERMEDIATE_PCLOSE: /* G1-designate 94-set */ + case VTE_SEQ_INTERMEDIATE_MULT: /* G2-designate 94-set */ + case VTE_SEQ_INTERMEDIATE_PLUS: /* G3-designate 94-set */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_94(seq->terminator, + VTE_SEQ_REMOVE_INTERMEDIATE(intermediates)), + intermediate0 - VTE_SEQ_INTERMEDIATE_POPEN); + return VTE_CMD_GnDm; + + case VTE_SEQ_INTERMEDIATE_COMMA: /* Reserved for future standardisation */ + break; + + case VTE_SEQ_INTERMEDIATE_MINUS: /* G1-designate 96-set */ + case VTE_SEQ_INTERMEDIATE_DOT: /* G2-designate 96-set */ + case VTE_SEQ_INTERMEDIATE_SLASH: /* G3-designate 96-set */ + *cs_out = VTE_MAKE_CHARSET(vte_parse_charset_96(seq->terminator, + VTE_SEQ_REMOVE_INTERMEDIATE(intermediates)), + intermediate0 - VTE_SEQ_INTERMEDIATE_COMMA); + return VTE_CMD_GnDm; + } + + return VTE_CMD_NONE; +} + +static unsigned int vte_parse_host_csi(const struct vte_seq *seq) +{ + switch (_VTE_SEQ_CODE(seq->terminator, seq->intermediates)) { +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + case _VTE_SEQ_CODE(f, _VTE_SEQ_CODE_COMBINE(VTE_SEQ_PARAMETER_##p, VTE_SEQ_INTERMEDIATE_##i)): return VTE_CMD_##cmd; +#include "parser-csi.hh" +#undef _VTE_SEQ + default: return VTE_CMD_NONE; + } +} + +static unsigned int vte_parse_host_dcs(const struct vte_seq *seq) +{ + switch (_VTE_SEQ_CODE(seq->terminator, seq->intermediates)) { +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + case _VTE_SEQ_CODE(f, _VTE_SEQ_CODE_COMBINE(VTE_SEQ_PARAMETER_##p, VTE_SEQ_INTERMEDIATE_##i)): return VTE_CMD_##cmd; +#include "parser-dcs.hh" +#undef _VTE_SEQ + default: return VTE_CMD_NONE; + } +} + +static unsigned int vte_parse_host_sci(const struct vte_seq *seq) +{ + return VTE_CMD_NONE; +} + +/* + * State Machine + * This parser controls the parser-state and returns any detected sequence to + * the caller. The parser is based on this state-diagram from Paul Williams: + * https://vt100.net/emu/ + * It was written from scratch and extended where needed. + * This parser is fully compatible up to the vt500 series. We expect UCS-4 as + * input. It's the callers responsibility to do any UTF-8 parsing. + */ + +enum parser_state { + STATE_GROUND, /* initial state and ground */ + STATE_DCS_PASS_ESC, /* ESC after DCS which may be ESC \ aka C0 ST */ + STATE_OSC_STRING_ESC, /* ESC after OSC which may be ESC \ aka C0 ST */ + STATE_ESC, /* ESC sequence was started */ + STATE_ESC_INT, /* intermediate escape characters */ + STATE_CSI_ENTRY, /* starting CSI sequence */ + STATE_CSI_PARAM, /* CSI parameters */ + STATE_CSI_INT, /* intermediate CSI characters */ + STATE_CSI_IGNORE, /* CSI error; ignore this CSI sequence */ + STATE_DCS_ENTRY, /* starting DCS sequence */ + STATE_DCS_PARAM, /* DCS parameters */ + STATE_DCS_INT, /* intermediate DCS characters */ + STATE_DCS_PASS, /* DCS data passthrough */ + STATE_DCS_IGNORE, /* DCS error; ignore this DCS sequence */ + STATE_OSC_STRING, /* parsing OSC sequence */ + STATE_ST_IGNORE, /* unimplemented seq; ignore until ST */ + STATE_SCI, /* single character introducer sequence was started */ + + STATE_N, +}; + +/* Parser state transitioning */ + +typedef int (* parser_action_func)(struct vte_parser *parser, uint32_t raw); + +// FIXMEchpe: I get weird performance results here from +// either not inlining, inlining these function or the +// macros below. Sometimes (after a recompile) one is +// (as much as 50%!) slower, sometimes the other one etc. ‽ + +#if 1 // (inline) functions + +// #define PTINLINE inline +#define PTINLINE + +/* nop */ +static PTINLINE int parser_nop(struct vte_parser *parser, + uint32_t raw) +{ + return VTE_SEQ_NONE; +} +/* dispatch related actions */ +static PTINLINE int parser_action(struct vte_parser *parser, + uint32_t raw, + parser_action_func action) +{ + return action(parser, raw); +} + +/* perform state transition */ +static PTINLINE int parser_transition_no_action(struct vte_parser *parser, + uint32_t raw, + unsigned int state) +{ + parser->state = state; + return VTE_SEQ_NONE; +} + +/* perform state transition and dispatch related actions */ +static PTINLINE int parser_transition(struct vte_parser *parser, + uint32_t raw, + unsigned int state, + parser_action_func action) +{ + parser->state = state; + + return action(parser, raw); +} + +#undef PTINLINE + +#else // macros + +/* nop */ +#define parser_nop(parser,raw) \ + ({ VTE_SEQ_NONE; }) + +/* dispatch related actions */ +#define parser_action(p,r,a) \ + ({ \ + a((p), (r)); \ + }) + +/* perform state transition */ +#define parser_transition_no_action(p,r,s) \ + ({ \ + parser->state = s; \ + VTE_SEQ_NONE; \ + }) + +/* perform state transition and dispatch related actions */ +#define parser_transition(p,r,s,a) \ + ({ \ + (p)->state = s; \ + a((p), (r)); \ + }) + +#endif // (inline) functions or macros + +/** + * vte_parser_init() - Initialise parser object + * @parser: the struct vte_parser + */ +void vte_parser_init(struct vte_parser *parser) +{ + memset(parser, 0, sizeof(*parser)); + vte_seq_string_init(&parser->seq.arg_str); +} + +/** + * vte_parser_deinit() - Deinitialises parser object + * @parser: parser object to deinitialise + */ +void vte_parser_deinit(struct vte_parser *parser) +{ + vte_seq_string_free(&parser->seq.arg_str); +} + +static inline int parser_clear(struct vte_parser *parser, uint32_t raw) +{ + /* seq.command is set when the sequence is executed, + * seq.terminator is set when the final character is received, + * and seq.introducer is set when the introducer is received, + * and all this happens before the sequence is dispatched. + * Therefore these fiedls need not be cleared in any case. + */ + return VTE_SEQ_NONE; +} + +static inline int parser_clear_int(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.intermediates = 0; + parser->seq.n_intermediates = 0; + + return parser_clear(parser, raw); +} + +static inline int parser_clear_params(struct vte_parser *parser, uint32_t raw) +{ + /* The (n_args+1)th parameter may have been started but not + * finialised, so it needs cleaning too. All further params + * have not been touched, so need not be cleaned. + */ + unsigned int n_args = G_UNLIKELY(parser->seq.n_args >= VTE_PARSER_ARG_MAX) + ? VTE_PARSER_ARG_MAX + : parser->seq.n_args + 1; + memset(parser->seq.args, 0, n_args * sizeof(parser->seq.args[0])); +#ifdef PARSER_EXTRA_CLEAN + /* Assert that the assumed-clean params are actually clean. */ + for (unsigned int n = n_args; n < VTE_PARSER_ARG_MAX; ++n) + g_assert_cmpuint(parser->seq.args[n], ==, VTE_SEQ_ARG_INIT_DEFAULT); +#endif + + parser->seq.n_args = 0; + parser->seq.n_final_args = 0; + + return VTE_SEQ_NONE; +} + +static inline int parser_clear_int_and_params(struct vte_parser *parser, uint32_t raw) +{ + parser_clear_int(parser, raw); + return parser_clear_params(parser, raw); +} + +static int parser_ignore(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.type = VTE_SEQ_IGNORE; + parser->seq.command = VTE_CMD_NONE; + parser->seq.terminator = raw; + + return parser->seq.type; +} + +static int parser_print(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.type = VTE_SEQ_GRAPHIC; + parser->seq.command = VTE_CMD_GRAPHIC; + parser->seq.terminator = raw; + + return parser->seq.type; +} + +static int parser_execute(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.type = VTE_SEQ_CONTROL; + parser->seq.terminator = raw; + parser->seq.command = vte_parse_host_control(&parser->seq); + + return parser->seq.type; +} + +static int parser_collect_esc(struct vte_parser *parser, uint32_t raw) +{ + assert(raw >= 0x20 && raw <= 0x2f); + + /* ESCAPE sequences only have intermediates or 2/0..2/15, so there's no + * need for the extra shift as below for CSI/DCS sequences + */ + parser->seq.intermediates |= (VTE_SEQ_MAKE_INTERMEDIATE(raw) << (VTE_SEQ_INTERMEDIATE_BITS * parser->seq.n_intermediates++)); + + return VTE_SEQ_NONE; +} + +static int parser_collect_csi(struct vte_parser *parser, uint32_t raw) +{ + assert(raw >= 0x20 && raw <= 0x2f); + + /* In addition to 2/0..2/15 intermediates, CSI/DCS sequence + * can also have one parameter byte 3/12..3/15 at the + * start of the parameters (see parser_collect_parameter below); + * that's what the extra shift is for. + */ + parser->seq.intermediates |= (VTE_SEQ_MAKE_INTERMEDIATE(raw) << (VTE_SEQ_PARAMETER_BITS + + VTE_SEQ_INTERMEDIATE_BITS * parser->seq.n_intermediates++)); + + return VTE_SEQ_NONE; +} + +static int parser_collect_parameter(struct vte_parser *parser, uint32_t raw) +{ + assert(raw >= 0x3c && raw <= 0x3f); + + /* CSI/DCS may optionally have one parameter byte from 3/12..3/15 + * at the start of the parameters; we put that into the lowest + * part of @seq.intermediates. + * Note that there can only be *one* such byte; the state machine + * already enforces that, so we do not need any additional checks + * here. + */ + parser->seq.intermediates |= VTE_SEQ_MAKE_PARAMETER(raw); + + return VTE_SEQ_NONE; +} + +static void parser_params_overflow(struct vte_parser *parser, uint32_t raw) +{ + /* An overflow of the parameter number can only happen in + * STATE_{CSI,DCS}_PARAM, and it occurs when + * seq.n_arg == VTE_PARSER_ARG_MAX, and either an 0…9 + * is encountered, starting the next param, or an + * explicit ':' or ';' terminating a (defaulted) (sub)param, + * or when the intermediates/final character(s) occur + * after a defaulted (sub)param. + * + * Transition to STATE_{CSI,DCS}_IGNORE to ignore the + * whole sequence. + */ + parser_transition_no_action(parser, + raw, + parser->state == STATE_CSI_PARAM ? + STATE_CSI_IGNORE : STATE_DCS_IGNORE); +} + +/* The next two functions are only called when encountering a ';' or ':', + * so if there's already MAX-1 parameters, the ';' or ':' would finish + * the MAXth parameter and there would be a default or non-default + * MAX+1th parameter following it. + */ +static int parser_finish_param(struct vte_parser *parser, uint32_t raw) +{ + if (G_LIKELY(parser->seq.n_args < VTE_PARSER_ARG_MAX - 1)) { + vte_seq_arg_finish(&parser->seq.args[parser->seq.n_args], false); + ++parser->seq.n_args; + ++parser->seq.n_final_args; + } else + parser_params_overflow(parser, raw); + + return VTE_SEQ_NONE; +} + +static int parser_finish_subparam(struct vte_parser *parser, uint32_t raw) +{ + if (G_LIKELY(parser->seq.n_args < VTE_PARSER_ARG_MAX - 1)) { + vte_seq_arg_finish(&parser->seq.args[parser->seq.n_args], true); + ++parser->seq.n_args; + } else + parser_params_overflow(parser, raw); + + return VTE_SEQ_NONE; +} + +static int parser_param(struct vte_parser *parser, uint32_t raw) +{ + /* assert(raw >= '0' && raw <= '9'); */ + + if (G_LIKELY(parser->seq.n_args < VTE_PARSER_ARG_MAX)) + vte_seq_arg_push(&parser->seq.args[parser->seq.n_args], raw); + else + parser_params_overflow(parser, raw); + + return VTE_SEQ_NONE; +} + +static inline int parser_osc_start(struct vte_parser *parser, uint32_t raw) +{ + parser_clear(parser, raw); + + vte_seq_string_reset(&parser->seq.arg_str); + + parser->seq.introducer = raw; + return VTE_SEQ_NONE; +} + +static int parser_osc_collect(struct vte_parser *parser, uint32_t raw) +{ + /* + * Only characters from 0x20..0x7e and >= 0xa0 are allowed here. + * Our state-machine already verifies those restrictions. + */ + + if (G_UNLIKELY(!vte_seq_string_push(&parser->seq.arg_str, raw))) + parser->state = STATE_ST_IGNORE; + + return VTE_SEQ_NONE; +} + +static int parser_dcs_start(struct vte_parser *parser, uint32_t raw) +{ + parser_clear_int_and_params(parser, raw); + + vte_seq_string_reset(&parser->seq.arg_str); + + parser->seq.introducer = raw; + return VTE_SEQ_NONE; +} + +static int parser_dcs_consume(struct vte_parser *parser, uint32_t raw) +{ + /* parser->seq is cleared during DCS-START state, thus there's no need + * to clear invalid fields here. */ + + if (G_LIKELY(parser->seq.n_args < VTE_PARSER_ARG_MAX)) { + if (parser->seq.n_args > 0 || + vte_seq_arg_started(parser->seq.args[parser->seq.n_args])) { + vte_seq_arg_finish(&parser->seq.args[parser->seq.n_args], false); + ++parser->seq.n_args; + ++parser->seq.n_final_args; + } + } + + parser->seq.type = VTE_SEQ_DCS; + parser->seq.terminator = raw; + parser->seq.command = vte_parse_host_dcs(&parser->seq); + + return VTE_SEQ_NONE; +} + +static int parser_dcs_collect(struct vte_parser *parser, uint32_t raw) +{ + if (G_UNLIKELY(!vte_seq_string_push(&parser->seq.arg_str, raw))) + parser->state = STATE_DCS_IGNORE; + + return VTE_SEQ_NONE; +} + +static int parser_esc(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.type = VTE_SEQ_ESCAPE; + parser->seq.terminator = raw; + parser->seq.charset = VTE_CHARSET_NONE; + parser->seq.command = vte_parse_host_escape(&parser->seq, + &parser->seq.charset); + + return parser->seq.type; +} + +static int parser_csi(struct vte_parser *parser, uint32_t raw) +{ + /* parser->seq is cleared during CSI-ENTER state, thus there's no need + * to clear invalid fields here. */ + + if (G_LIKELY(parser->seq.n_args < VTE_PARSER_ARG_MAX)) { + if (parser->seq.n_args > 0 || + vte_seq_arg_started(parser->seq.args[parser->seq.n_args])) { + vte_seq_arg_finish(&parser->seq.args[parser->seq.n_args], false); + ++parser->seq.n_args; + ++parser->seq.n_final_args; + } + } + + parser->seq.type = VTE_SEQ_CSI; + parser->seq.terminator = raw; + parser->seq.command = vte_parse_host_csi(&parser->seq); + + return parser->seq.type; +} + +static int parser_osc(struct vte_parser *parser, uint32_t raw) +{ + /* parser->seq is cleared during OSC_START state, thus there's no need + * to clear invalid fields here. */ + + vte_seq_string_finish(&parser->seq.arg_str); + + /* We only dispatch a DCS if the introducer and string + * terminator are from the same control set, i.e. both + * C0 or both C1; we discard sequences with mixed controls. + */ + if (!parser_check_matching_controls(parser->seq.introducer, raw)) + return VTE_SEQ_IGNORE; + + parser->seq.type = VTE_SEQ_OSC; + parser->seq.command = VTE_CMD_OSC; + parser->seq.terminator = raw; + + return parser->seq.type; +} + +static int parser_dcs(struct vte_parser *parser, uint32_t raw) +{ + /* parser->seq was already filled in parser_dcs_consume() */ + + vte_seq_string_finish(&parser->seq.arg_str); + + /* We only dispatch a DCS if the introducer and string + * terminator are from the same control set, i.e. both + * C0 or both C1; we discard sequences with mixed controls. + */ + if (!parser_check_matching_controls(parser->seq.introducer, raw)) + return VTE_SEQ_IGNORE; + + return parser->seq.type; +} + +static int parser_sci(struct vte_parser *parser, uint32_t raw) +{ + parser->seq.type = VTE_SEQ_SCI; + parser->seq.terminator = raw; + parser->seq.command = vte_parse_host_sci(&parser->seq); + + return parser->seq.type; +} + +#define ACTION_CLEAR parser_clear +#define ACTION_CLEAR_INT parser_clear_int +#define ACTION_CLEAR_INT_AND_PARAMS parser_clear_int_and_params +#define ACTION_CLEAR_PARAMS_ONLY parser_clear_params +#define ACTION_IGNORE parser_ignore +#define ACTION_PRINT parser_print +#define ACTION_EXECUTE parser_execute +#define ACTION_COLLECT_ESC parser_collect_esc +#define ACTION_COLLECT_CSI parser_collect_csi +#define ACTION_COLLECT_DCS ACTION_COLLECT_CSI +#define ACTION_COLLECT_PARAMETER parser_collect_parameter +#define ACTION_PARAM parser_param +#define ACTION_FINISH_PARAM parser_finish_param +#define ACTION_FINISH_SUBPARAM parser_finish_subparam +#define ACTION_ESC_DISPATCH parser_esc +#define ACTION_CSI_DISPATCH parser_csi +#define ACTION_DCS_START parser_dcs_start +#define ACTION_DCS_CONSUME parser_dcs_consume +#define ACTION_DCS_COLLECT parser_dcs_collect +#define ACTION_DCS_DISPATCH parser_dcs +#define ACTION_OSC_START parser_osc_start +#define ACTION_OSC_COLLECT parser_osc_collect +#define ACTION_OSC_DISPATCH parser_osc +#define ACTION_SCI_DISPATCH parser_sci + +static int parser_feed_to_state(struct vte_parser *parser, uint32_t raw) +{ + switch (parser->state) { + case STATE_GROUND: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + case 0x80 ... 0x9f: /* C1 */ + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + } + + return parser_action(parser, raw, + ACTION_PRINT); + + case STATE_DCS_PASS_ESC: + case STATE_OSC_STRING_ESC: + if (raw == 0x5c /* '\' */) { + switch (parser->state) { + case STATE_DCS_PASS_ESC: + return parser_transition(parser, raw, STATE_GROUND, + ACTION_DCS_DISPATCH); + case STATE_OSC_STRING_ESC: + return parser_transition(parser, raw, STATE_GROUND, + ACTION_OSC_DISPATCH); + } + } + + /* Do the deferred clear and fallthrough to STATE_ESC */ + parser_transition(parser, 0x1b /* ESC */, STATE_ESC, + ACTION_CLEAR_INT); + /* fallthrough */ + case STATE_ESC: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_transition(parser, raw, STATE_ESC_INT, + ACTION_COLLECT_ESC); + case 0x30 ... 0x4f: /* ['0' - '~'] \ */ + case 0x51 ... 0x57: /* { 'P', 'X', 'Z' '[', ']', '^', '_' } */ + case 0x59: + case 0x5c: + case 0x60 ... 0x7e: + return parser_transition(parser, raw, STATE_GROUND, + ACTION_ESC_DISPATCH); + case 0x50: /* 'P' */ + return parser_transition(parser, raw, STATE_DCS_ENTRY, + ACTION_DCS_START); + case 0x5a: /* 'Z' */ + return parser_transition(parser, raw, STATE_SCI, + ACTION_CLEAR); + case 0x5b: /* '[' */ + return parser_transition(parser, raw, STATE_CSI_ENTRY, + ACTION_CLEAR_PARAMS_ONLY + /* rest already cleaned on ESC state entry */); + case 0x5d: /* ']' */ + return parser_transition(parser, raw, STATE_OSC_STRING, + ACTION_OSC_START); + case 0x58: /* 'X' */ + case 0x5e: /* '^' */ + case 0x5f: /* '_' */ + return parser_transition_no_action(parser, raw, STATE_ST_IGNORE); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + case STATE_ESC_INT: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_action(parser, raw, + ACTION_COLLECT_ESC); + case 0x30 ... 0x7e: /* ['0' - '~'] */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_ESC_DISPATCH); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + case STATE_CSI_ENTRY: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_transition(parser, raw, STATE_CSI_INT, + ACTION_COLLECT_CSI); + case 0x30 ... 0x39: /* ['0' - '9'] */ + return parser_transition(parser, raw, STATE_CSI_PARAM, + ACTION_PARAM); + case 0x3a: /* ':' */ + return parser_transition(parser, raw, STATE_CSI_PARAM, + ACTION_FINISH_SUBPARAM); + case 0x3b: /* ';' */ + return parser_transition(parser, raw, STATE_CSI_PARAM, + ACTION_FINISH_PARAM); + case 0x3c ... 0x3f: /* ['<' - '?'] */ + return parser_transition(parser, raw, STATE_CSI_PARAM, + ACTION_COLLECT_PARAMETER); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_CSI_DISPATCH); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition_no_action(parser, raw, STATE_CSI_IGNORE); + case STATE_CSI_PARAM: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_transition(parser, raw, STATE_CSI_INT, + ACTION_COLLECT_CSI); + case 0x30 ... 0x39: /* ['0' - '9'] */ + return parser_action(parser, raw, + ACTION_PARAM); + case 0x3a: /* ':' */ + return parser_action(parser, raw, + ACTION_FINISH_SUBPARAM); + case 0x3b: /* ';' */ + return parser_action(parser, raw, + ACTION_FINISH_PARAM); + case 0x3c ... 0x3f: /* ['<' - '?'] */ + return parser_transition_no_action(parser, raw, STATE_CSI_IGNORE); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_CSI_DISPATCH); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition_no_action(parser, raw, STATE_CSI_IGNORE); + case STATE_CSI_INT: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_action(parser, raw, + ACTION_COLLECT_CSI); + case 0x30 ... 0x3f: /* ['0' - '?'] */ + return parser_transition_no_action(parser, raw, STATE_CSI_IGNORE); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_CSI_DISPATCH); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition_no_action(parser, raw, STATE_CSI_IGNORE); + case STATE_CSI_IGNORE: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_EXECUTE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x3f: /* [' ' - '?'] */ + return parser_nop(parser, raw); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition_no_action(parser, raw, STATE_GROUND); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_nop(parser, raw); + case STATE_DCS_ENTRY: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ ESC */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_IGNORE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_transition(parser, raw, STATE_DCS_INT, + ACTION_COLLECT_DCS); + case 0x30 ... 0x39: /* ['0' - '9'] */ + return parser_transition(parser, raw, STATE_DCS_PARAM, + ACTION_PARAM); + case 0x3a: /* ':' */ + return parser_transition(parser, raw, STATE_DCS_PARAM, + ACTION_FINISH_SUBPARAM); + case 0x3b: /* ';' */ + return parser_transition(parser, raw, STATE_DCS_PARAM, + ACTION_FINISH_PARAM); + case 0x3c ... 0x3f: /* ['<' - '?'] */ + return parser_transition(parser, raw, STATE_DCS_PARAM, + ACTION_COLLECT_PARAMETER); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_DCS_PASS, + ACTION_DCS_CONSUME); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition(parser, raw, + STATE_DCS_PASS, ACTION_DCS_CONSUME); + case STATE_DCS_PARAM: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_IGNORE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_transition(parser, raw, STATE_DCS_INT, + ACTION_COLLECT_DCS); + case 0x30 ... 0x39: /* ['0' - '9'] */ + return parser_action(parser, raw, + ACTION_PARAM); + case 0x3a: /* ':' */ + return parser_action(parser, raw, + ACTION_FINISH_SUBPARAM); + case 0x3b: /* ';' */ + return parser_action(parser, raw, + ACTION_FINISH_PARAM); + case 0x3c ... 0x3f: /* ['<' - '?'] */ + return parser_transition_no_action(parser, raw, STATE_DCS_IGNORE); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_DCS_PASS, + ACTION_DCS_CONSUME); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition(parser, raw, + STATE_DCS_PASS, ACTION_DCS_CONSUME); + case STATE_DCS_INT: + switch (raw) { + case 0x00 ... 0x1a: /* C0 \ { ESC } */ + case 0x1c ... 0x1f: + return parser_action(parser, raw, + ACTION_IGNORE); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x20 ... 0x2f: /* [' ' - '\'] */ + return parser_action(parser, raw, + ACTION_COLLECT_DCS); + case 0x30 ... 0x3f: /* ['0' - '?'] */ + return parser_transition_no_action(parser, raw, STATE_DCS_IGNORE); + case 0x40 ... 0x7e: /* ['@' - '~'] */ + return parser_transition(parser, raw, STATE_DCS_PASS, + ACTION_DCS_CONSUME); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + return parser_transition(parser, raw, + STATE_DCS_PASS, ACTION_DCS_CONSUME); + case STATE_DCS_PASS: + switch (raw) { + case 0x00 ... 0x1a: /* ASCII \ { ESC } */ + case 0x1c ... 0x7f: + return parser_action(parser, raw, + ACTION_DCS_COLLECT); + case 0x1b: /* ESC */ + return parser_transition_no_action(parser, raw, STATE_DCS_PASS_ESC); + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_DCS_DISPATCH); + } + + return parser_action(parser, raw, + ACTION_DCS_COLLECT); + case STATE_DCS_IGNORE: + switch (raw) { + case 0x00 ... 0x1a: /* ASCII \ { ESC } */ + case 0x1c ... 0x7f: + return parser_nop(parser, raw); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x9c: /* ST */ + return parser_transition_no_action(parser, raw, STATE_GROUND); + } + + return parser_nop(parser, raw); + case STATE_OSC_STRING: + switch (raw) { + case 0x00 ... 0x06: /* C0 \ { BEL, ESC } */ + case 0x08 ... 0x1a: + case 0x1c ... 0x1f: + return parser_nop(parser, raw); + case 0x1b: /* ESC */ + return parser_transition_no_action(parser, raw, STATE_OSC_STRING_ESC); + case 0x20 ... 0x7f: /* [' ' - DEL] */ + return parser_action(parser, raw, + ACTION_OSC_COLLECT); + case 0x07: /* BEL */ + case 0x9c: /* ST */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_OSC_DISPATCH); + } + + return parser_action(parser, raw, + ACTION_OSC_COLLECT); + case STATE_ST_IGNORE: + switch (raw) { + case 0x00 ... 0x1a: /* ASCII \ { ESC } */ + case 0x1c ... 0x7f: + return parser_nop(parser, raw); + case 0x1b: /* ESC */ + return parser_transition(parser, raw, STATE_ESC, + ACTION_CLEAR_INT); + case 0x9c: /* ST */ + return parser_transition(parser, raw, + STATE_GROUND, ACTION_IGNORE); + } + + return parser_nop(parser, raw); + case STATE_SCI: + switch (raw) { + case 0x1b: /* ESC */ + return parser_transition(parser, raw, + STATE_ESC, ACTION_CLEAR_INT); + case 0x08 ... 0x0d: /* BS, HT, LF, VT, FF, CR */ + case 0x20 ... 0x7e: /* [' ' - '~'] */ + return parser_transition(parser, raw, STATE_GROUND, + ACTION_SCI_DISPATCH); + } + + return parser_transition(parser, raw, STATE_GROUND, + ACTION_IGNORE); + } + + g_warning("bad vte-parser state"); + return -EINVAL; +} + +int vte_parser_feed(struct vte_parser *parser, + uint32_t raw) +{ + /* + * Notes: + * * DEC treats GR codes as GL. We don't do that as we require UTF-8 + * as charset and, thus, it doesn't make sense to treat GR special. + * * During control sequences, unexpected C1 codes cancel the sequence + * and immediately start a new one. C0 codes, however, may or may not + * be ignored/executed depending on the sequence. + */ + + switch (raw) { + case 0x18: /* CAN */ + return parser_transition(parser, raw, + STATE_GROUND, ACTION_IGNORE); + case 0x1a: /* SUB */ + return parser_transition(parser, raw, + STATE_GROUND, ACTION_EXECUTE); + case 0x7f: /* DEL */ + return parser_nop(parser, raw); + case 0x80 ... 0x8f: /* C1 \ {DCS, SOS, SCI, CSI, ST, OSC, PM, APC} */ + case 0x91 ... 0x97: + case 0x99: + return parser_transition(parser, raw, + STATE_GROUND, ACTION_EXECUTE); + case 0x98: /* SOS */ + case 0x9e: /* PM */ + case 0x9f: /* APC */ + return parser_transition_no_action(parser, raw, STATE_ST_IGNORE); + // FIXMEchpe shouldn't this use ACTION_CLEAR? + case 0x90: /* DCS */ + return parser_transition(parser, raw, + STATE_DCS_ENTRY, ACTION_DCS_START); + case 0x9a: /* SCI */ + return parser_transition(parser, raw, + STATE_SCI, ACTION_CLEAR); + case 0x9d: /* OSC */ + return parser_transition(parser, raw, + STATE_OSC_STRING, ACTION_OSC_START); + case 0x9b: /* CSI */ + return parser_transition(parser, raw, + STATE_CSI_ENTRY, ACTION_CLEAR_INT_AND_PARAMS); + default: + return parser_feed_to_state(parser, raw); + } +} + +void vte_parser_reset(struct vte_parser *parser) +{ + parser_transition(parser, 0, STATE_GROUND, ACTION_IGNORE); +} diff -Nru vte2.91-0.52.2/src/parser-charset.hh vte2.91-0.54.0/src/parser-charset.hh --- vte2.91-0.52.2/src/parser-charset.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-charset.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,306 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define IR_NAME(num) ISO_2375_IR_##num +#define DEC_NAME(name) DEC_##name +#define NRCS_NAME(name) name##_NRCS +#define SUPPLEMENTAL_NAME(name) ISO_##name##_SUPPLEMENTAL + +#define IR(num) _VTE_CHARSET(IR_NAME(num)) +#define DEC(name) _VTE_CHARSET(DEC_NAME(name)) +#define NRCS(name) _VTE_CHARSET(NRCS_NAME(name)) +#define ALIAS(name1,name2) _VTE_CHARSET_ALIAS(name1,name2) + +_VTE_CHARSET(NONE) + +/* See ECMA-35 § 14.4 for the meaning of this */ +_VTE_CHARSET(DRCS) + +_VTE_CHARSET(EMPTY) + +/* Return to ISO-2022 */ +_VTE_CHARSET(RETURN) + +/* ISO 2375 IR sets */ + +IR(1) +IR(2) +IR(4) +IR(6) +IR(7) +IR(8_1) +IR(8_2) +IR(9_1) +IR(9_2) +IR(10) +IR(11) +IR(13) +IR(14) +IR(15) +IR(16) +IR(17) +IR(18) +IR(19) +IR(21) +IR(25) +IR(26) +IR(27) +IR(31) +IR(32) +IR(33) +IR(34) +IR(35) +IR(36) +IR(37) +IR(38) +IR(39) +IR(40) +IR(42) +IR(47) +IR(48) +IR(49) +IR(50) +IR(51) +IR(53) +IR(54) +IR(55) +IR(56) +IR(57) +IR(58) +IR(59) +IR(60) +IR(61) +IR(62) +IR(63) +IR(64) +IR(65) +IR(66) +IR(67) +IR(68) +IR(69) +IR(70) +IR(71) +IR(72) +IR(73) +IR(74) +IR(77) +IR(84) +IR(85) +IR(86) +IR(87) +IR(88) +IR(89) +IR(90) +IR(91) +IR(92) +IR(93) +IR(94) +IR(95) +IR(96) +IR(98) +IR(99) +IR(100) +IR(101) +IR(102) +IR(103) +IR(104) +IR(105) +IR(106) +IR(107) +IR(108) +IR(109) +IR(110) +IR(111) +IR(121) +IR(122) +IR(123) +IR(124) +IR(125) +IR(126) +IR(127) +IR(128) +IR(129) +IR(130) +IR(131) +IR(132) +IR(133) +IR(134) +IR(135) +IR(136) +IR(137) +IR(138) +IR(139) +IR(140) +IR(141) +IR(142) +IR(143) +IR(144) +IR(145) +IR(146) +IR(147) +IR(148) +IR(149) +IR(150) +IR(151) +IR(152) +IR(153) +IR(154) +IR(155) +IR(156) +IR(157) +IR(158) +IR(159) +IR(160) +IR(161) +IR(162) +IR(163) +IR(164) +IR(165) +IR(166) +IR(167) +IR(168) +IR(169) +IR(170) +IR(171) +IR(172) +IR(173) +IR(174) +IR(175) +IR(176) +IR(177) +IR(178) +IR(179) +IR(180) +IR(181) +IR(182) +IR(183) +IR(184) +IR(185) +IR(186) +IR(187) +IR(188) +IR(189) +IR(190) +IR(191) +IR(192) +IR(193) +IR(194) +IR(195) +IR(196) +IR(197) +IR(198) +IR(199) +IR(200) +IR(201) +IR(202) +IR(203) +IR(204) +IR(205) +IR(206) +IR(207) +IR(208) +IR(209) +IR(226) +IR(227) +IR(228) +IR(229) +IR(230) +IR(231) +IR(232) +IR(233) +IR(234) + +/* Use IRR to choose between them */ +IR(67_OR_124) +IR(72_OR_173) +IR(87_OR_168) + +/* DEC 94-sets */ + +/* This is referred to variously as DEC Supplemental or DEC Supplemental Graphic */ +DEC(SUPPLEMENTAL_GRAPHIC) /* ESC I 2/5 3/5 */ +DEC(SPECIAL_GRAPHIC) /* ESC I 3/0 */ +DEC(TECHNICAL) /* ESC I 3/14 */ +/* UPSS: User Preferred Supplemental Set */ +DEC(UPSS) /* ESC I 3/12 */ +DEC(CYRILLIC) /* ESC I 2/6 3/4 */ +DEC(GREEK) /* ESC I 2/2 3/15 */ +DEC(HEBREW) /* ESC I 2/2 3/4 */ +DEC(THAI) /* ESC I 2/6 3/3 */ +DEC(TURKISH) /* ESC I 2/5 3/0 */ + +/* DEC NRCS 94-sets */ + +/* FRENCH_CANADIAN: this has a secondary choice of ESC I 5/1 which is registered as + * ISO IR #54 (cyrillic), so we don't implement that alias +*/ +NRCS(FRENCH_CANADIAN) /* ESC I 3/9 */ + +/* FIXME: check if these correspond to any IR sets and make them an alias if so */ +NRCS(DUTCH) /* ESC I 3/4 */ +NRCS(GREEK) /* ESC I 2/2 3/14 */ +NRCS(HEBREW) /* ESC I 2/5 3/13 */ +NRCS(PORTUGUESE) /* ESC I 2/5 3/6 */ +NRCS(RUSSIAN) /* ESC I 2/6 3/5 */ +NRCS(SWISS) /* ESC I 3/13 */ +NRCS(TURKISH) /* ESC I 2/5 3/2 */ + +NRCS(SOFT) /* ESC I 2/5 3/3 */ + +/* Aliases. They were identified as an alias by their ISO IR sequence. + * Some have a secondary sequence. + */ + +ALIAS(DEC_NAME(KANJI_1978), IR_NAME(42)) /* G3 only: ESC 2/4 2/11 3/1 */ +ALIAS(DEC_NAME(KANJI_1983), IR_NAME(87)) /* G3 only: ESC 2/4 2/11 3/3 */ + +ALIAS(NRCS_NAME(AMERICAN), IR_NAME(6)) +ALIAS(NRCS_NAME(BRITISH), IR_NAME(4)) +ALIAS(NRCS_NAME(FINNISH), IR_NAME(8_1)) /* ESC I 3/5 */ + +/* ISO IR #25 is withdrawn in favour of #69; check which one DEC actually uses */ +ALIAS(NRCS_NAME(FRENCH), IR_NAME(25)) + +ALIAS(NRCS_NAME(GERMAN), IR_NAME(21)) +ALIAS(NRCS_NAME(ITALIAN), IR_NAME(15)) + +/* NORWEGIAN_DANISH: this has primary choice ESC I 6/0 which is ISO IR #60, + * secondary choice ESC I 4/5 which is ISO IR #9-1 and + * tertiary choice ESC 3/6. We link the tertiary choice to IR #9-1 since + * the VT220 manual only lists the 4/5 and 3/6 choices. + */ +ALIAS(NRCS_NAME(NORWEGIAN_DANISH), IR_NAME(9_1)) + +ALIAS(NRCS_NAME(SPANISH), IR_NAME(17)) +ALIAS(NRCS_NAME(SWEDISH), IR_NAME(11)) /* ESC I 3/7 */ + +ALIAS(SUPPLEMENTAL_NAME(GREEK), IR_NAME(126)) +ALIAS(SUPPLEMENTAL_NAME(HEBREW), IR_NAME(138)) +ALIAS(SUPPLEMENTAL_NAME(LATIN_1), IR_NAME(100)) +ALIAS(SUPPLEMENTAL_NAME(LATIN_2), IR_NAME(101)) +ALIAS(SUPPLEMENTAL_NAME(LATIN_5), IR_NAME(148)) +ALIAS(SUPPLEMENTAL_NAME(LATIN_CYRILLIC), IR_NAME(144)) + +#undef IR_NAME +#undef DEC_NAME +#undef NRCS_NAME +#undef SUPPLEMENTAL_NAME + +#undef IR +#undef DEC +#undef NRCS +#undef ALIAS diff -Nru vte2.91-0.52.2/src/parser-charset-tables.hh vte2.91-0.54.0/src/parser-charset-tables.hh --- vte2.91-0.52.2/src/parser-charset-tables.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-charset-tables.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,230 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define IR(num) VTE_CHARSET_ISO_2375_IR_##num +#define DEC(name) VTE_CHARSET_DEC_##name +#define NRCS(name) VTE_CHARSET_##name##_NRCS +#define EMPTY VTE_CHARSET_EMPTY +#define NA VTE_CHARSET_NONE +#define RET VTE_CHARSET_RETURN + +/* 94-character graphic character sets: + * G0: ESC 2/8 F + * G1: ESC 2/9 F + * G2: ESC 2/10 F + * G3: ESC 2/11 F + * C0: - + * C1: - + */ +/* NOTE: 4/8 'H' for IR(11) (SWEDISH_NRCS) conflicts with the + * primary choice on ISO_HEBREW_SUPPLEMENTAL. + * VT510 always chooses HEBREW; the table below prefers IR #11. + */ +static uint8_t const charset_graphic_94[] = { + /* 3/0..3/15 */ + DEC(SPECIAL_GRAPHIC), NA, NA, NA, NRCS(DUTCH), NRCS(FINNISH), NRCS(NORWEGIAN_DANISH), NRCS(SWEDISH), + NA, NRCS(FRENCH_CANADIAN), NA, NA, DEC(UPSS), NRCS(SWISS), DEC(TECHNICAL), NA, + /* 4/0..4/15 */ + IR(2), IR(4), IR(6), IR(8_1), IR(8_2), IR(9_1), IR(9_2), IR(10), + IR(11), IR(13), IR(14), IR(21), IR(16), IR(39), IR(37), IR(38), + /* 5/0..5/15 */ + IR(53), IR(54), IR(25), IR(55), IR(57), IR(27), IR(47), IR(49), + IR(31), IR(15), IR(17), IR(18), IR(19), IR(50), IR(51), IR(59), + /* 6/0..6/15 */ + IR(60), IR(61), IR(70), IR(71), IR(72_OR_173), IR(68), IR(69), IR(84), + IR(85), IR(86), IR(88), IR(89), IR(90), IR(91), IR(92), IR(93), + /* 7/0..7/13 */ + IR(94), IR(95), IR(96), IR(98), IR(99), IR(102), IR(103), IR(121), + IR(122), IR(137), IR(141), IR(146), IR(128), IR(147), EMPTY +}; + +/* 94-character graphic character sets, with second intermediate byte 2/1: + * G0: ESC 2/8 2/1 F + * G1: ESC 2/9 2/1 F + * G2: ESC 2/10 2/1 F + * G3: ESC 2/11 2/1 F + * C0: - + * C1: - + */ +static uint8_t const charset_graphic_94_with_2_1[] = { + /* 4/0..4/6 */ + IR(150), IR(151), IR(170), IR(207), IR(230), IR(231), IR(232) +}; + +/* 94-character graphic character sets, with second intermediate byte 2/2: + * G0: ESC 2/8 2/1 F + * G1: ESC 2/9 2/1 F + * G2: ESC 2/10 2/1 F + * G3: ESC 2/11 2/1 F + * C0: - + * C1: - + */ +static uint8_t const charset_graphic_94_with_2_2[] = { + /* 3/0..3/15 */ + NA, NA, NA, NA, DEC(HEBREW), NA, NA, NA, + NA, NA, NA, NA, NA, NA, NRCS(GREEK), DEC(GREEK), +}; + +/* 94-character graphic character sets, with second intermediate byte 2/5: + * G0: ESC 2/8 2/1 F + * G1: ESC 2/9 2/1 F + * G2: ESC 2/10 2/1 F + * G3: ESC 2/11 2/1 F + * C0: - + * C1: - + */ +static uint8_t const charset_graphic_94_with_2_5[] = { + /* 3/0..3/15 */ + DEC(TURKISH), NA, NRCS(TURKISH), NRCS(SOFT), NA, DEC(SUPPLEMENTAL_GRAPHIC), NRCS(PORTUGUESE), NA, + NA, NA, NA, NA, NA, NRCS(HEBREW), NA, NA, +}; + +/* 94-character graphic character sets, with second intermediate byte 2/6: + * G0: ESC 2/8 2/1 F + * G1: ESC 2/9 2/1 F + * G2: ESC 2/10 2/1 F + * G3: ESC 2/11 2/1 F + * C0: - + * C1: - + */ +static uint8_t const charset_graphic_94_with_2_6[] = { + /* 3/0..3/15 */ + NA, NA, NA, DEC(THAI), DEC(CYRILLIC), NRCS(RUSSIAN), NA, NA, + NA, NA, NA, NA, NA, NA, NA, NA, +}; + +/* 96-characters graphic character sets: + * G0: - + * G1: ESC 2/13 F + * G2: ESC 2/14 F + * G3: ESC 2/15 F + * C0: - + * C1: - + */ +static uint8_t const charset_graphic_96[] = { + /* 3/0..3/15 */ + NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, DEC(UPSS), NA, NA, NA, + /* 4/0..4/15 */ + IR(111), IR(100), IR(101), IR(109), IR(110), IR(123), IR(126), IR(127), + IR(138), IR(139), IR(142), IR(143), IR(144), IR(148), IR(152), IR(153), + /* 5/0..5/15 */ + IR(154), IR(155), IR(156), IR(164), IR(166), IR(167), IR(157), NA, + IR(158), IR(179), IR(180), IR(181), IR(182), IR(197), IR(198), IR(199), + /* 6/0..6/15 */ + IR(200), IR(201), IR(203), IR(204), IR(205), IR(206), IR(226), IR(208), + IR(209), IR(227), IR(234), NA, NA, NA, NA, NA, + /* 7/0..7/14 */ + NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, NA, IR(129), EMPTY +}; + +/* Multibyte graphic character sets: + * G0: ESC 2/4 2/8 F + * G1: ESC 2/4 2/9 F + * G2: ESC 2/4 2/10 F + * G3: ESC 2/4 2/11 F + * C0: - + * C1: - + * + * Note that exceptionally, ESC 2/4 4/0, ESC 2/4 4/1 and ESC 2/4 4/2 designate + * G0 sets for compatibility with an earlier version of ISO-2022. + */ +static uint8_t const charset_graphic_94_n[] = { + /* 3/0..3/15 */ + NA, DEC(KANJI_1978), NA, DEC(KANJI_1983), NA, NA, NA, NA, + NA, NA, NA, NA, NA, NA, NA, NA, + /* 4/0..4/15 */ + IR(42), IR(58), IR(87_OR_168), IR(149), IR(159), IR(165), IR(169), IR(171), + IR(172), IR(183), IR(184), IR(185), IR(186), IR(187), IR(202), IR(228), + /* 5/0..5/15 */ + IR(229), IR(233), NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, NA, NA, NA, NA, + /* 6/0..6/15 */ + NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, NA, NA, NA, NA, + /* 7/0..7/14 */ + NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, NA, NA, EMPTY, +}; + +/* C0 control character sets: + * G0: - + * G1: - + * G2: - + * G3: - + * C0: ESC 2/1 F + * C1: - + */ +static uint8_t const charset_control_c0[] = { + /* 4/0..4/12 */ + IR(1), IR(7), IR(48), IR(26), IR(36), IR(106), IR(74), IR(104), + IR(130), IR(132), IR(134), IR(135), IR(140) +}; + +/* C1 control character sets: + * G0: - + * G1: - + * G2: - + * G3: - + * C0: - + * C1: ESC 2/2 F + */ +static uint8_t const charset_control_c1[] = { + /* 4/0..4/8 */ + IR(56), IR(73), IR(67_OR_124), IR(77), IR(133), IR(40), IR(136), IR(105), + IR(107) +}; + +#if 0 +/* Single control functions as two-byte escape sequences + * ESC F + */ +static uint8_t const charset_control_single[] = { + /* 6/0..6/15 */ + IR(32), IR(33), IR(34), IR(35), IR(189), NA, NA, NA, + NA, NA, NA, NA, NA, NA, IR(62), IR(63), + /* 7/0..7/14 */ + NA, NA, NA, NA, NA, NA, NA, NA, + NA, NA, NA, NA, IR(64), IR(65), IR(66) +}; +#endif + +/* Non-ISO-2022 coding systems, with standard return: + * ESC 2/5 F + */ +static uint8_t const charset_ocs_with_return[] = { + /* 4/0..4/8 */ + RET, IR(108), IR(178), IR(131), IR(145), IR(160), IR(161), IR(196), + IR(188) +}; + +/* Non-ISO-2022 coding systems, without standard return: + * ESC 2/5 2/15 F + */ +static uint8_t const charset_ocs_without_return[] = { + /* 4/0..4/12 */ + IR(162), IR(163), IR(125), IR(174), IR(175), IR(176), IR(177), IR(190), + IR(191), IR(192), IR(193), IR(194), IR(195) +}; + +#undef IR +#undef DEC +#undef NRCS +#undef EMPTY +#undef NA +#undef RET diff -Nru vte2.91-0.52.2/src/parser-cmd.hh vte2.91-0.54.0/src/parser-cmd.hh --- vte2.91-0.52.2/src/parser-cmd.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-cmd.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,330 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_CMD) || !defined(_VTE_NOP) +#error "Must define _VTE_CMD and _VTE_NOP before including this file" +#endif + +/* Implemented in VTE: */ + +_VTE_CMD(NONE) /* placeholder */ +_VTE_CMD(GRAPHIC) /* graphics character */ +_VTE_CMD(ACS) /* announce code structure */ +_VTE_CMD(BEL) /* bell */ +_VTE_CMD(BS) /* backspace */ +_VTE_CMD(CBT) /* cursor backward tabulation */ +_VTE_CMD(CHA) /* cursor horizontal absolute */ +_VTE_CMD(CHT) /* cursor horizontal forward tabulation */ +_VTE_CMD(CNL) /* cursor next line */ +_VTE_CMD(CPL) /* cursor previous line */ +_VTE_CMD(CR) /* carriage return */ +_VTE_CMD(CTC) /* cursor tabulation control */ +_VTE_CMD(CUB) /* cursor backward */ +_VTE_CMD(CUD) /* cursor down */ +_VTE_CMD(CUF) /* cursor forward */ +_VTE_CMD(CUP) /* cursor position */ +_VTE_CMD(CUU) /* cursor up */ +_VTE_CMD(CnD) /* Cn-designate */ +_VTE_CMD(DA1) /* primary device attributes */ +_VTE_CMD(DA2) /* secondary device attributes */ +_VTE_CMD(DA3) /* tertiary device attributes */ +_VTE_CMD(DCH) /* delete character */ +_VTE_CMD(DECALN) /* screen alignment pattern */ +_VTE_CMD(DECBI) /* back index */ +_VTE_CMD(DECKPAM) /* keypad application mode */ +_VTE_CMD(DECKPNM) /* keypad numeric mode */ +_VTE_CMD(DECPCTERM_OR_XTERM_RPM) /* pcterm or xterm restore private mode */ +_VTE_CMD(DECRC) /* restore cursor */ +_VTE_CMD(DECREQTPARM) /* request terminal parameters */ +_VTE_CMD(DECRQCRA) /* request checksum of rectangular area */ +_VTE_CMD(DECRQM_DEC) /* request mode dec */ +_VTE_CMD(DECRQM_ECMA) /* request mode ecma */ +_VTE_CMD(DECRQSS) /* request selection or setting */ +_VTE_CMD(DECRQTSR) /* request terminal state report */ +_VTE_CMD(DECSCL) /* select conformance level */ +_VTE_CMD(DECSC) /* save cursor */ +_VTE_CMD(DECSCUSR) /* set cursor style */ +_VTE_CMD(DECSED) /* selective erase in display */ +_VTE_CMD(DECSEL) /* selective erase in line */ +_VTE_CMD(DECSLPP) /* set lines per page */ +_VTE_CMD(DECSLRM) /* set left and right margins */ +_VTE_CMD(DECSR) /* secure reset */ +_VTE_CMD(DECST8C) /* set tab at every 8 columns */ +_VTE_CMD(DECSTBM) /* set top and bottom margins */ +_VTE_CMD(DECSTR) /* soft terminal reset */ +_VTE_CMD(DL) /* delete line */ +_VTE_CMD(DOCS) /* designate-other-coding-system */ +_VTE_CMD(DSR_DEC) /* device status report dec */ +_VTE_CMD(DSR_ECMA) /* device status report ecma */ +_VTE_CMD(ECH) /* erase character */ +_VTE_CMD(ED) /* erase in display */ +_VTE_CMD(EL) /* erase in line */ +_VTE_CMD(FF) /* form feed */ +_VTE_CMD(GnDm) /* Gn-designate-9m-charset */ +_VTE_CMD(GnDMm) /* Gn-designate-multibyte-9m-charset */ +_VTE_CMD(HPA) /* horizontal position absolute */ +_VTE_CMD(HPR) /* horizontal position relative */ +_VTE_CMD(HT) /* horizontal tab */ +_VTE_CMD(HTJ) /* character tabulation with justification */ +_VTE_CMD(HTS) /* horizontal tab set */ +_VTE_CMD(HVP) /* horizontal and vertical position */ +_VTE_CMD(ICH) /* insert character */ +_VTE_CMD(IL) /* insert line */ +_VTE_CMD(IND) /* index */ +_VTE_CMD(LF) /* line feed */ +_VTE_CMD(LS0) /* locking shift 0 */ +_VTE_CMD(LS1) /* locking shift 1 */ +_VTE_CMD(LS1R) /* locking shift 1 right */ +_VTE_CMD(LS2) /* locking shift 2 */ +_VTE_CMD(LS2R) /* locking shift 2 right */ +_VTE_CMD(LS3) /* locking shift 3 */ +_VTE_CMD(LS3R) /* locking shift 3 right */ +_VTE_CMD(NEL) /* next line */ +_VTE_CMD(OSC) /* operating-system-command */ +_VTE_CMD(REP) /* repeat */ +_VTE_CMD(RI) /* reverse index */ +_VTE_CMD(RIS) /* reset to initial state */ +_VTE_CMD(RM_DEC) /* reset mode dec */ +_VTE_CMD(RM_ECMA) /* reset mode ecma */ +_VTE_CMD(SD) /* scroll down */ +_VTE_CMD(SD_OR_XTERM_IHMT) /* scroll down or xterm initiate highlight mouse tracking */ +_VTE_CMD(SGR) /* select graphics rendition */ +_VTE_CMD(SM_DEC) /* set mode dec */ +_VTE_CMD(SM_ECMA) /* set mode ecma */ +_VTE_CMD(SS2) /* single shift 2 */ +_VTE_CMD(SS3) /* single shift 3 */ +_VTE_CMD(SUB) /* substitute */ +_VTE_CMD(SU) /* scroll up */ +_VTE_CMD(TBC) /* tab clear */ +_VTE_CMD(TCC) /* tabulation centred on character */ +_VTE_CMD(TSR) /* tabulation stop remove */ +_VTE_CMD(VPA) /* vertical line position absolute */ +_VTE_CMD(VPR) /* vertical line position relative */ +_VTE_CMD(VT) /* vertical tab */ +_VTE_CMD(XTERM_RTM) /* xterm reset title mode */ +_VTE_CMD(XTERM_RPM) /* xterm restore private mode */ +_VTE_CMD(XTERM_SPM) /* xterm set private mode */ +_VTE_CMD(XTERM_WM) /* xterm window management */ + +/* Unimplemented in VTE: */ + +_VTE_NOP(ACK) /* acknowledge */ +_VTE_NOP(BPH) /* break permitted here */ +_VTE_NOP(CCH) /* cancel character */ +_VTE_NOP(CMD) /* coding method delimiter */ +_VTE_NOP(CVT) /* cursor line tabulation */ +_VTE_NOP(DAQ) /* define area qualification */ +_VTE_NOP(DC1) /* device control 1 / XON */ +_VTE_NOP(DC2) /* devince control 2 */ +_VTE_NOP(DC3) /* device control 3 / XOFF */ +_VTE_NOP(DC4) /* device control 4 */ +_VTE_NOP(DECAC) /* assign color */ +_VTE_NOP(DECANM) /* ansi mode */ +_VTE_NOP(DECARR) /* auto repeat rate */ +_VTE_NOP(DECATC) /* alternate text color */ +_VTE_NOP(DECAUPSS) /* assign user preferred supplemental sets */ +_VTE_NOP(DECCARA) /* change attributes in rectangular area */ +_VTE_NOP(DECCKD) /* copy key default */ +_VTE_NOP(DECCRA) /* copy rectangular area */ +_VTE_NOP(DECCRTST) /* CRT saver time */ +_VTE_NOP(DECDC) /* delete column */ +_VTE_NOP(DECDHL_BH) /* double width double height line: bottom half */ +_VTE_NOP(DECDHL_TH) /* double width double height line: top half */ +_VTE_NOP(DECDLDA) /* down line load allocation */ +_VTE_NOP(DECDLD) /* dynamically redefinable character sets extension */ +_VTE_NOP(DECDMAC) /* define macro */ +_VTE_NOP(DECDWL) /* double width single height line */ +_VTE_NOP(DECEFR) /* enable filter rectangle */ +_VTE_NOP(DECELF) /* enable local functions */ +_VTE_NOP(DECELR) /* enable locator reporting */ +_VTE_NOP(DECERA) /* erase rectangular area */ +_VTE_NOP(DECES) /* enable session */ +_VTE_NOP(DECFI) /* forward index */ +_VTE_NOP(DECFRA) /* fill rectangular area */ +_VTE_NOP(DECIC) /* insert column */ +_VTE_NOP(DECINVM) /* invoke macro */ +_VTE_NOP(DECKBD) /* keyboard language selection */ +_VTE_NOP(DECLANS) /* load answerback message */ +_VTE_NOP(DECLBAN) /* load banner message */ +_VTE_NOP(DECLBD) /* locator button define */ +_VTE_NOP(DECLFKC) /* local function key control */ +_VTE_NOP(DECLL) /* load leds */ +_VTE_NOP(DECLTOD) /* load time of day */ +_VTE_NOP(DECPAK) /* program alphanumeric key */ +_VTE_NOP(DECPCTERM) /* pcterm */ +_VTE_NOP(DECPFK) /* program function key */ +_VTE_NOP(DECPKA) /* program key action */ +_VTE_NOP(DECPKFMR) /* program key free memory report */ +_VTE_NOP(DECPS) /* play sound */ +_VTE_NOP(DECRARA) /* reverse attributes in rectangular area */ +_VTE_NOP(DECREGIS) /* ReGIS graphics */ +_VTE_NOP(DECRPAK) /* report all modifier/alphanumeric key state */ +_VTE_NOP(DECRPDE) /* report displayed extent */ +_VTE_NOP(DECRPFK) /* report function key definition */ +_VTE_NOP(DECRPKT) /* report key type */ +_VTE_NOP(DECRQDE) /* request display extent */ +_VTE_NOP(DECRQKT) /* request key type */ +_VTE_NOP(DECRQLP) /* request locator position */ +_VTE_NOP(DECRQPKFM) /* request program key free memory */ +_VTE_NOP(DECRQPSR) /* request presentation state report */ +_VTE_NOP(DECRQUPSS) /* request user preferred supplemental set */ +_VTE_NOP(DECRSPS) /* restore presentation state */ +_VTE_NOP(DECRSTS) /* restore terminal state */ +_VTE_NOP(DECSACE) /* select attribute change extent */ +_VTE_NOP(DECSASD) /* select active status display */ +_VTE_NOP(DECSCA) /* select character protection attribute */ +_VTE_NOP(DECSCPP) /* select columns per page */ +_VTE_NOP(DECSCP) /* select communication port */ +_VTE_NOP(DECSCS) /* select communication speed */ +_VTE_NOP(DECSDDT) /* select disconnect delay time */ +_VTE_NOP(DECSDPT) /* select digital printed data type */ +_VTE_NOP(DECSERA) /* selective erase rectangular area */ +_VTE_NOP(DECSEST) /* energy saver time */ +_VTE_NOP(DECSFC) /* select flow control */ +_VTE_NOP(DECSIXEL) /* SIXEL graphics */ +_VTE_NOP(DECSKCV) /* set key click volume */ +_VTE_NOP(DECSLCK) /* set lock key style */ +_VTE_NOP(DECSLE) /* select locator events */ +_VTE_NOP(DECSMBV) /* set margin bell volume */ +_VTE_NOP(DECSMKR) /* select modifier key reporting */ +_VTE_NOP(DECSNLS) /* set lines per screen */ +_VTE_NOP(DECSPMA) /* session page memory allocation */ +_VTE_NOP(DECSPPCS) /* select pro printer character set */ +_VTE_NOP(DECSPP) /* set port parameter */ +_VTE_NOP(DECSPRTT) /* select printer type */ +_VTE_NOP(DECSRFR) /* select refresh rate */ +_VTE_NOP(DECSSCLS) /* set scroll speed */ +_VTE_NOP(DECSSDT) /* select status display line type */ +_VTE_NOP(DECSSL) /* select setup language */ +_VTE_NOP(DECSTGLT) /* select color lookup table */ +_VTE_NOP(DECSTRL) /* set transmit rate limit */ +_VTE_NOP(DECSTUI) /* set terminal unit id */ +_VTE_NOP(DECSWBV) /* set warning bell volume */ +_VTE_NOP(DECSWL) /* single width single height line */ +_VTE_NOP(DECSZS) /* select zero symbol */ +_VTE_NOP(DECTID) /* select terminal id */ +_VTE_NOP(DECTME) /* terminal mode emulation */ +_VTE_NOP(DECTST) /* invoke confidence test */ +_VTE_NOP(DECUDK) /* user defined keys */ +_VTE_NOP(DECUS) /* update session */ +_VTE_NOP(DLE) /* data link escape */ +_VTE_NOP(DMI) /* disable manual input */ +_VTE_NOP(DTA) /* dimension text area */ +_VTE_NOP(EA) /* erase in area */ +_VTE_NOP(EF) /* erase in field */ +_VTE_NOP(EM) /* end of medium */ +_VTE_NOP(EMI) /* enable manual input */ +_VTE_NOP(ENQ) /* enquire */ +_VTE_NOP(EOT) /* end of transmission */ +_VTE_NOP(EPA) /* end of guarded area */ +_VTE_NOP(ESA) /* end of selected area */ +_VTE_NOP(ETB) /* end of transmission block */ +_VTE_NOP(ETX) /* end of text */ +_VTE_NOP(FNK) /* function key */ +_VTE_NOP(FNT) /* font selection */ +_VTE_NOP(GCC) /* graphic character combination */ +_VTE_NOP(GSM) /* graphic size modification */ +_VTE_NOP(GSS) /* graphic size selection */ +_VTE_NOP(HPB) /* horizontal position backward */ +_VTE_NOP(IDCS) /* identify DCS */ +_VTE_NOP(IGS) /* identify graphic subrepertoire */ +_VTE_NOP(INT) /* interrupt */ +_VTE_NOP(IRR) /* identify-revised-registration */ +_VTE_NOP(IS1) /* information separator 1 / unit separator (US) */ +_VTE_NOP(IS2) /* information separator 2 / record separator (RS) */ +_VTE_NOP(IS3) /* information separator 3 / group separator (GS)*/ +_VTE_NOP(IS4) /* information separator 4 / file separator (FS) */ +_VTE_NOP(JFY) /* justify */ +_VTE_NOP(MC_DEC) /* media copy dec */ +_VTE_NOP(MC_ECMA) /* media copy ecma */ +_VTE_NOP(MW) /* message waiting */ +_VTE_NOP(NAK) /* negative acknowledge */ +_VTE_NOP(NBH) /* no break permitted here */ +_VTE_NOP(NP) /* next page */ +_VTE_NOP(NUL) /* nul */ +_VTE_NOP(PEC) /* presentation expand or contract */ +_VTE_NOP(PFS) /* page format selection */ +_VTE_NOP(PLD) /* partial line forward */ +_VTE_NOP(PLU) /* partial line backward */ +_VTE_NOP(PPA) /* page position absolute */ +_VTE_NOP(PPB) /* page position backward */ +_VTE_NOP(PP) /* preceding page */ +_VTE_NOP(PPR) /* page position relative */ +_VTE_NOP(PTX) /* parallel texts */ +_VTE_NOP(PU1) /* private use 1 */ +_VTE_NOP(PU2) /* private use 2 */ +_VTE_NOP(QUAD) /* quad */ +_VTE_NOP(RLOGIN_MML) /* RLogin music macro language */ +_VTE_NOP(SACS) /* set additional character separation */ +_VTE_NOP(SAPV) /* select alternative presentation variants */ +_VTE_NOP(SCORC) /* SCO restore cursor */ +_VTE_NOP(SCO) /* select character orientation */ +_VTE_NOP(SCP) /* select character path */ +_VTE_NOP(SCS) /* set character spacing */ +_VTE_NOP(SDS) /* start directed string */ +_VTE_NOP(SEE) /* select editing extent */ +_VTE_NOP(SEF) /* sheet eject and feed */ +_VTE_NOP(SHS) /* select character spacing */ +_VTE_NOP(SIMD) /* select implicit movement direction */ +_VTE_NOP(SLH) /* set line home */ +_VTE_NOP(SLL) /* set line limit */ +_VTE_NOP(SL) /* scroll left */ +_VTE_NOP(SLS) /* set line spacing */ +_VTE_NOP(SOH) /* start of heading */ +_VTE_NOP(SPA) /* start of protected area */ +_VTE_NOP(SPD) /* select presentation directions */ +_VTE_NOP(SPH) /* set page home */ +_VTE_NOP(SPI) /* spacing increment */ +_VTE_NOP(SPL) /* set page limit */ +_VTE_NOP(SPQR) /* select print quality and rapidity */ +_VTE_NOP(SRCS) /* set reduced character separation */ +_VTE_NOP(SR) /* scroll right */ +_VTE_NOP(SRS) /* start reversed string */ +_VTE_NOP(SSA) /* start of selected area */ +_VTE_NOP(SSU) /* set size unit */ +_VTE_NOP(SSW) /* set space width */ +_VTE_NOP(ST) /* string terminator */ +_VTE_NOP(STAB) /* selective tabulation */ +_VTE_NOP(STS) /* set transmit state */ +_VTE_NOP(STX) /* start of text */ +_VTE_NOP(SVS) /* select line spacing */ +_VTE_NOP(SYN) /* synchronize */ +_VTE_NOP(TAC) /* tabulation aligned centre */ +_VTE_NOP(TALE) /* tabulation aligned leading edge */ +_VTE_NOP(TATE) /* tabulation aligned trailing edge */ +_VTE_NOP(TSS) /* thine space specification */ +_VTE_NOP(VTS) /* line tabulation set */ +_VTE_NOP(VPB) /* line position backward */ +_VTE_NOP(WYCAA) /* redefine character display attribute association */ +_VTE_NOP(WYDHL_BH) /* single width double height line: bottom half */ +_VTE_NOP(WYDHL_TH) /* single width double height line: top half */ +_VTE_NOP(WYLSFNT) /* load soft font */ +_VTE_NOP(WYSCRATE) /* set smooth scroll rate */ +_VTE_NOP(XDGSYNC) /* synchronous update */ +_VTE_NOP(XTERM_IHMT) /* xterm initiate highlight mouse tracking */ +_VTE_NOP(XTERM_MLHP) /* xterm memory lock hp bugfix */ +_VTE_NOP(XTERM_MUHP) /* xterm memory unlock hp bugfix */ +_VTE_NOP(XTERM_RQTCAP) /* xterm request termcap/terminfo */ +_VTE_NOP(XTERM_RRV) /* xterm reset resource value */ +_VTE_NOP(XTERM_SGFX) /* xterm sixel graphics */ +_VTE_NOP(XTERM_SGR_STACK_POP) /* xterm pop SGR stack */ +_VTE_NOP(XTERM_SGR_STACK_PUSH) /* xterm push SGR stack */ +_VTE_NOP(XTERM_SGR_REPORT) /* xterm SGR report */ +_VTE_NOP(XTERM_SRV) /* xterm set resource value */ +_VTE_NOP(XTERM_STCAP) /* xterm set termcap/terminfo */ +_VTE_NOP(XTERM_STM) /* xterm set title mode */ diff -Nru vte2.91-0.52.2/src/parser-csi.hh vte2.91-0.54.0/src/parser-csi.hh --- vte2.91-0.52.2/src/parser-csi.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-csi.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,212 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_SEQ) || !defined(_VTE_NOQ) +#error "Must define _VTE_SEQ and _VTE_NOQ before including this file" +#endif + +_VTE_SEQ(ICH, CSI, '@', NONE, 0, NONE ) /* insert-character */ +_VTE_NOQ(SL, CSI, '@', NONE, 1, SPACE ) /* scroll left */ +_VTE_SEQ(CUU, CSI, 'A', NONE, 0, NONE ) /* cursor-up */ +_VTE_NOQ(SR, CSI, 'A', NONE, 1, SPACE ) /* scroll right */ +_VTE_SEQ(CUD, CSI, 'B', NONE, 0, NONE ) /* cursor-down */ +_VTE_NOQ(GSM, CSI, 'B', NONE, 1, SPACE ) /* graphic size modification */ +_VTE_SEQ(CUF, CSI, 'C', NONE, 0, NONE ) /* cursor-forward */ +_VTE_NOQ(GSS, CSI, 'C', NONE, 1, SPACE ) /* graphic size selection */ +_VTE_SEQ(CUB, CSI, 'D', NONE, 0, NONE ) /* cursor-backward */ +_VTE_NOQ(FNT, CSI, 'D', NONE, 1, SPACE ) /* font selection */ +_VTE_SEQ(CNL, CSI, 'E', NONE, 0, NONE ) /* cursor-next-line */ +_VTE_SEQ(CPL, CSI, 'F', NONE, 0, NONE ) /* cursor-previous-line */ +_VTE_NOQ(JFY, CSI, 'F', NONE, 1, SPACE ) /* justify */ +_VTE_NOQ(TSS, CSI, 'E', NONE, 1, SPACE ) /* thine space specification */ +_VTE_SEQ(CHA, CSI, 'G', NONE, 0, NONE ) /* cursor-horizontal-absolute */ +_VTE_NOQ(SPI, CSI, 'G', NONE, 1, SPACE ) /* spacing increment */ +_VTE_SEQ(CUP, CSI, 'H', NONE, 0, NONE ) /* cursor-position */ +_VTE_NOQ(QUAD, CSI, 'H', NONE, 1, SPACE ) /* quad */ +_VTE_SEQ(CHT, CSI, 'I', NONE, 0, NONE ) /* cursor-horizontal-forward-tabulation */ +_VTE_NOQ(SSU, CSI, 'I', NONE, 1, SPACE ) /* set size unit */ +_VTE_SEQ(ED, CSI, 'J', NONE, 0, NONE ) /* erase-in-display */ +_VTE_NOQ(PFS, CSI, 'J', NONE, 1, SPACE ) /* page format selection */ +_VTE_SEQ(DECSED, CSI, 'J', WHAT, 0, NONE ) /* selective-erase-in-display */ +_VTE_SEQ(EL, CSI, 'K', NONE, 0, NONE ) /* erase-in-line */ +_VTE_NOQ(SHS, CSI, 'K', NONE, 1, SPACE ) /* select character spacing */ +_VTE_SEQ(DECSEL, CSI, 'K', WHAT, 0, NONE ) /* selective-erase-in-line */ +_VTE_SEQ(IL, CSI, 'L', NONE, 0, NONE ) /* insert-line */ +_VTE_NOQ(SVS, CSI, 'L', NONE, 1, SPACE ) /* select line spacing */ +_VTE_SEQ(DL, CSI, 'M', NONE, 0, NONE ) /* delete-line */ +_VTE_NOQ(IGS, CSI, 'M', NONE, 1, SPACE ) /* identify graphic subrepertoire */ +_VTE_NOQ(EF, CSI, 'N', NONE, 0, NONE ) /* erase in field */ +_VTE_NOQ(EA, CSI, 'O', NONE, 0, NONE ) /* erase in area */ +_VTE_NOQ(IDCS, CSI, 'O', NONE, 1, SPACE ) /* identify DCS */ +_VTE_SEQ(DCH, CSI, 'P', NONE, 0, NONE ) /* delete-character */ +_VTE_NOQ(PPA, CSI, 'P', NONE, 1, SPACE ) /* page-position-absolute */ +_VTE_NOQ(SEE, CSI, 'Q', NONE, 0, NONE ) /* select editing extent */ +_VTE_NOQ(PPR, CSI, 'Q', NONE, 1, SPACE ) /* page-position-relative */ +_VTE_NOQ(PPB, CSI, 'R', NONE, 1, SPACE ) /* page-position-backward */ +_VTE_SEQ(SU, CSI, 'S', NONE, 0, NONE ) /* scroll-up */ +_VTE_NOQ(SPD, CSI, 'S', NONE, 1, SPACE ) /* select presentation directions */ +_VTE_NOQ(XTERM_SGFX, CSI, 'S', WHAT, 0, NONE ) /* xterm-sixel-graphics */ +_VTE_SEQ(SD_OR_XTERM_IHMT, CSI, 'T', NONE, 0, NONE ) /* scroll-down or xterm-initiate-highlight-mouse-tracking */ +_VTE_NOQ(DTA, CSI, 'T', NONE, 1, SPACE ) /* dimension text area */ +_VTE_SEQ(XTERM_RTM, CSI, 'T', GT, 0, NONE ) /* xterm-reset-title-mode */ +_VTE_NOQ(NP, CSI, 'U', NONE, 0, NONE ) /* next-page */ +_VTE_NOQ(SLH, CSI, 'U', NONE, 1, SPACE ) /* set line home */ +_VTE_NOQ(PP, CSI, 'V', NONE, 0, NONE ) /* preceding-page */ +_VTE_NOQ(SLL, CSI, 'V', NONE, 1, SPACE ) /* set line limit */ +_VTE_SEQ(CTC, CSI, 'W', NONE, 0, NONE ) /* cursor tabulation control */ +_VTE_NOQ(FNK, CSI, 'W', NONE, 1, SPACE ) /* function key */ +_VTE_SEQ(DECST8C, CSI, 'W', WHAT, 0, NONE ) /* set-tab-at-every-8-columns */ +_VTE_SEQ(ECH, CSI, 'X', NONE, 0, NONE ) /* erase-character */ +_VTE_NOQ(SPQR, CSI, 'X', NONE, 1, SPACE ) /* select print quality and rapidity */ +_VTE_NOQ(CVT, CSI, 'Y', NONE, 0, NONE ) /* cursor line tabulation */ +_VTE_NOQ(SEF, CSI, 'Y', NONE, 1, SPACE ) /* sheet eject and feed */ +_VTE_SEQ(CBT, CSI, 'Z', NONE, 0, NONE ) /* cursor-backward-tabulation */ +_VTE_NOQ(PEC, CSI, 'Z', NONE, 1, SPACE ) /* presentation expand or contract */ +_VTE_NOQ(SRS, CSI, '[', NONE, 0, NONE ) /* start reversed string */ +_VTE_NOQ(SSW, CSI, '[', NONE, 1, SPACE ) /* set space width */ +_VTE_NOQ(PTX, CSI, '\\', NONE, 0, NONE ) /* parallel texts */ +_VTE_NOQ(SACS, CSI, '\\', NONE, 1, SPACE ) /* set additional character separation */ +_VTE_NOQ(SDS, CSI, ']', NONE, 0, NONE ) /* start directed string */ +_VTE_NOQ(SAPV, CSI, ']', NONE, 1, SPACE ) /* select alternative presentation variants */ +_VTE_NOQ(SIMD, CSI, '^', NONE, 0, NONE ) /* select implicit movement direction */ +_VTE_NOQ(STAB, CSI, '^', NONE, 1, SPACE ) /* selective tabulation */ +_VTE_NOQ(GCC, CSI, '_', NONE, 1, SPACE ) /* graphic character combination */ +_VTE_SEQ(HPA, CSI, '`', NONE, 0, NONE ) /* horizontal-position-absolute */ +_VTE_NOQ(TATE, CSI, '`', NONE, 1, SPACE ) /* tabulation-aligned-trailing-edge */ +_VTE_SEQ(HPR, CSI, 'a', NONE, 0, NONE ) /* horizontal-position-relative */ +_VTE_NOQ(TALE, CSI, 'a', NONE, 1, SPACE ) /* tabulation-aligned-leading-edge */ +_VTE_SEQ(REP, CSI, 'b', NONE, 0, NONE ) /* repeat */ +_VTE_NOQ(TAC, CSI, 'b', NONE, 1, SPACE ) /* tabulation-aligned-centre */ +_VTE_SEQ(DA1, CSI, 'c', NONE, 0, NONE ) /* primary-device-attributes */ +_VTE_SEQ(TCC, CSI, 'c', NONE, 1, SPACE ) /* tabulation-centred-on-character */ +_VTE_SEQ(DA3, CSI, 'c', EQUAL, 0, NONE ) /* tertiary-device-attributes */ +_VTE_SEQ(DA2, CSI, 'c', GT, 0, NONE ) /* secondary-device-attributes */ +_VTE_SEQ(VPA, CSI, 'd', NONE, 0, NONE ) /* vertical-line-position-absolute */ +_VTE_SEQ(TSR, CSI, 'd', NONE, 1, SPACE ) /* tabulation-stop-remove */ +_VTE_SEQ(VPR, CSI, 'e', NONE, 0, NONE ) /* vertical-line-position-relative */ +_VTE_NOQ(SCO, CSI, 'e', NONE, 1, SPACE ) /* select character orientation */ +_VTE_SEQ(HVP, CSI, 'f', NONE, 0, NONE ) /* horizontal-and-vertical-position */ +_VTE_NOQ(SRCS, CSI, 'f', NONE, 1, SPACE ) /* set reduced character separation */ +_VTE_SEQ(TBC, CSI, 'g', NONE, 0, NONE ) /* tab-clear */ +_VTE_NOQ(SCS, CSI, 'g', NONE, 1, SPACE ) /* set character spacing */ +_VTE_NOQ(DECLFKC, CSI, 'g', NONE, 1, MULT ) /* local-function-key-control */ +_VTE_SEQ(SM_ECMA, CSI, 'h', NONE, 0, NONE ) /* set-mode-ecma */ +_VTE_NOQ(SLS, CSI, 'h' , NONE, 1, SPACE ) /* set line spacing */ +_VTE_SEQ(SM_DEC, CSI, 'h', WHAT, 0, NONE ) /* set-mode-dec */ +_VTE_NOQ(MC_ECMA, CSI, 'i', NONE, 0, NONE ) /* media-copy-ecma */ +_VTE_NOQ(SPH, CSI, 'i', NONE, 1, SPACE ) /* set page home */ +_VTE_NOQ(MC_DEC, CSI, 'i', WHAT, 0, NONE ) /* media-copy-dec */ +_VTE_NOQ(HPB, CSI, 'j', NONE, 0, NONE ) /* horizontal position backward */ +_VTE_NOQ(SPL, CSI, 'j', NONE, 1, SPACE ) /* set page limit */ +_VTE_NOQ(VPB, CSI, 'k', NONE, 0, NONE ) /* line position backward */ +_VTE_NOQ(SCP, CSI, 'k', NONE, 1, SPACE ) /* select character path */ +_VTE_SEQ(RM_ECMA, CSI, 'l', NONE, 0, NONE ) /* reset-mode-ecma */ +_VTE_SEQ(RM_DEC, CSI, 'l', WHAT, 0, NONE ) /* reset-mode-dec */ +_VTE_SEQ(SGR, CSI, 'm', NONE, 0, NONE ) /* select-graphics-rendition */ +_VTE_NOQ(XTERM_SRV, CSI, 'm', GT, 0, NONE ) /* xterm-set-resource-value */ +_VTE_SEQ(DSR_ECMA, CSI, 'n', NONE, 0, NONE ) /* device-status-report-ecma */ +_VTE_NOQ(XTERM_RRV, CSI, 'n', GT, 0, NONE ) /* xterm-reset-resource-value */ +_VTE_SEQ(DSR_DEC, CSI, 'n', WHAT, 0, NONE ) /* device-status-report-dec */ +_VTE_NOQ(DAQ, CSI, 'o', NONE, 0, NONE ) /* define area qualification */ +_VTE_NOQ(DECSSL, CSI, 'p', NONE, 0, NONE ) /* select-setup-language */ +_VTE_NOQ(DECSSCLS, CSI, 'p', NONE, 1, SPACE ) /* set-scroll-speed */ +_VTE_SEQ(DECSTR, CSI, 'p', NONE, 1, BANG ) /* soft-terminal-reset */ +_VTE_SEQ(DECSCL, CSI, 'p', NONE, 1, DQUOTE ) /* select-conformance-level */ +_VTE_SEQ(DECRQM_ECMA, CSI, 'p', NONE, 1, CASH ) /* request-mode-ecma */ +_VTE_NOQ(DECSDPT, CSI, 'p', NONE, 1, PCLOSE ) /* select-digital-printed-data-type */ +_VTE_NOQ(DECSPPCS, CSI, 'p', NONE, 1, MULT ) /* select-pro-printer-character-set */ +_VTE_SEQ(DECSR, CSI, 'p', NONE, 1, PLUS ) /* secure-reset */ +_VTE_NOQ(DECLTOD, CSI, 'p', NONE, 1, COMMA ) /* load-time-of-day */ +_VTE_NOQ(DECARR, CSI, 'p', NONE, 1, MINUS ) /* auto repeat rate */ +_VTE_SEQ(XTERM_SPM, CSI, 'p', GT, 0, NONE ) /* xterm-set-private-mode */ +_VTE_SEQ(DECRQM_DEC, CSI, 'p', WHAT, 1, CASH ) /* request-mode-dec */ +_VTE_NOQ(DECLL, CSI, 'q', NONE, 0, NONE ) /* load-leds */ +_VTE_SEQ(DECSCUSR, CSI, 'q', NONE, 1, SPACE ) /* set-cursor-style */ +_VTE_NOQ(DECSCA, CSI, 'q', NONE, 1, DQUOTE ) /* select-character-protection-attribute */ +_VTE_NOQ(DECSDDT, CSI, 'q', NONE, 1, CASH ) /* select-disconnect-delay-time */ +_VTE_SEQ(DECSR, CSI, 'q', NONE, 1, MULT ) /* secure-reset */ +_VTE_NOQ(DECELF, CSI, 'q', NONE, 1, PLUS ) /* enable-local-functions */ +_VTE_NOQ(DECTID, CSI, 'q', NONE, 1, COMMA ) /* select-terminal-id */ +_VTE_NOQ(DECCRTST, CSI, 'q', NONE, 1, MINUS ) /* CRT saver time */ +_VTE_SEQ(DECSTBM, CSI, 'r', NONE, 0, NONE ) /* set-top-and-bottom-margins */ +_VTE_NOQ(DECSKCV, CSI, 'r', NONE, 1, SPACE ) /* set-key-click-volume */ +_VTE_NOQ(DECCARA, CSI, 'r', NONE, 1, CASH ) /* change-attributes-in-rectangular-area */ +_VTE_NOQ(DECSCS, CSI, 'r', NONE, 1, MULT ) /* select-communication-speed */ +_VTE_NOQ(DECSMKR, CSI, 'r', NONE, 1, PLUS ) /* select-modifier-key-reporting */ +_VTE_NOQ(DECSEST, CSI, 'r', NONE, 1, MINUS ) /* energy saver time */ +_VTE_SEQ(DECPCTERM_OR_XTERM_RPM, CSI, 'r', WHAT, 0, NONE ) /* pcterm or xterm-restore-private-mode */ +_VTE_SEQ(DECSLRM, CSI, 's', NONE, 0, NONE ) /* set-left-and-right-margins */ +_VTE_NOQ(DECSPRTT, CSI, 's', NONE, 1, CASH ) /* select-printer-type */ +_VTE_NOQ(DECSFC, CSI, 's', NONE, 1, MULT ) /* select-flow-control */ +_VTE_SEQ(XTERM_SPM, CSI, 's', WHAT, 0, NONE ) /* xterm-set-private-mode */ +_VTE_SEQ(XTERM_WM, CSI, 't', NONE, 0, NONE ) /* xterm-window-management */ +_VTE_NOQ(DECSWBV, CSI, 't', NONE, 1, SPACE ) /* set-warning-bell-volume */ +_VTE_NOQ(DECSRFR, CSI, 't', NONE, 1, DQUOTE ) /* select-refresh-rate */ +_VTE_NOQ(DECRARA, CSI, 't', NONE, 1, CASH ) /* reverse-attributes-in-rectangular-area */ +_VTE_NOQ(XTERM_STM, CSI, 't', GT, 0, NONE ) /* xterm-set-title-mode */ +_VTE_NOQ(SCORC, CSI, 'u', NONE, 0, NONE ) /* SCO restore-cursor */ +_VTE_NOQ(DECSMBV, CSI, 'u', NONE, 1, SPACE ) /* set-margin-bell-volume */ +_VTE_NOQ(DECSTRL, CSI, 'u', NONE, 1, DQUOTE ) /* set-transmit-rate-limit */ +_VTE_SEQ(DECRQTSR, CSI, 'u', NONE, 1, CASH ) /* request-terminal-state-report */ +_VTE_NOQ(DECSCP, CSI, 'u', NONE, 1, MULT ) /* select-communication-port */ +_VTE_NOQ(DECRQKT, CSI, 'u', NONE, 1, COMMA ) /* request-key-type */ +_VTE_NOQ(DECRQUPSS, CSI, 'u', WHAT, 0, NONE ) /* request-user-preferred-supplemental-set */ +_VTE_NOQ(DECSLCK, CSI, 'v', NONE, 1, SPACE ) /* set-lock-key-style */ +_VTE_NOQ(DECRQDE, CSI, 'v', NONE, 1, DQUOTE ) /* request-display-extent */ +_VTE_NOQ(DECCRA, CSI, 'v', NONE, 1, CASH ) /* copy-rectangular-area */ +_VTE_NOQ(DECRPKT, CSI, 'v', NONE, 1, COMMA ) /* report-key-type */ +_VTE_NOQ(WYCAA, CSI, 'w', NONE, 0, NONE ) /* redefine character display attribute association */ +_VTE_NOQ(DECRPDE, CSI, 'w', NONE, 1, DQUOTE ) /* report displayed extent */ +_VTE_NOQ(DECRQPSR, CSI, 'w', NONE, 1, CASH ) /* request-presentation-state-report */ +_VTE_NOQ(DECEFR, CSI, 'w', NONE, 1, SQUOTE ) /* enable-filter-rectangle */ +_VTE_NOQ(DECSPP, CSI, 'w', NONE, 1, PLUS ) /* set-port-parameter */ +_VTE_SEQ(DECREQTPARM, CSI, 'x', NONE, 0, NONE ) /* request-terminal-parameters */ +_VTE_NOQ(DECFRA, CSI, 'x', NONE, 1, CASH ) /* fill-rectangular-area */ +_VTE_NOQ(DECES, CSI, 'x', NONE, 1, AND ) /* enable session */ +_VTE_NOQ(DECSACE, CSI, 'x', NONE, 1, MULT ) /* select-attribute-change-extent */ +_VTE_NOQ(DECRQPKFM, CSI, 'x', NONE, 1, PLUS ) /* request-program-key-free-memory */ +_VTE_NOQ(DECSPMA, CSI, 'x', NONE, 1, COMMA ) /* session page memory allocation */ +_VTE_NOQ(DECTST, CSI, 'y', NONE, 0, NONE ) /* invoke-confidence-test */ +_VTE_SEQ(DECRQCRA, CSI, 'y', NONE, 1, MULT ) /* request-checksum-of-rectangular-area */ +_VTE_NOQ(DECPKFMR, CSI, 'y', NONE, 1, PLUS ) /* program-key-free-memory-report */ +_VTE_NOQ(DECUS, CSI, 'y', NONE, 1, COMMA ) /* update session */ +_VTE_NOQ(WYSCRATE, CSI, 'z', NONE, 0, NONE ) /* set smooth scroll rate */ +_VTE_NOQ(DECERA, CSI, 'z', NONE, 1, CASH ) /* erase-rectangular-area */ +_VTE_NOQ(DECELR, CSI, 'z', NONE, 1, SQUOTE ) /* enable-locator-reporting */ +_VTE_NOQ(DECINVM, CSI, 'z', NONE, 1, MULT ) /* invoke-macro */ +_VTE_NOQ(DECPKA, CSI, 'z', NONE, 1, PLUS ) /* program-key-action */ +_VTE_NOQ(DECDLDA, CSI, 'z', NONE, 1, COMMA ) /* down line load allocation */ +_VTE_NOQ(XTERM_SGR_STACK_PUSH, CSI, '{', NONE, 1, HASH ) /* push SGR stack */ +_VTE_NOQ(DECSERA, CSI, '{', NONE, 1, CASH ) /* selective-erase-rectangular-area */ +_VTE_NOQ(DECSLE, CSI, '{', NONE, 1, SQUOTE ) /* select-locator-events */ +_VTE_NOQ(DECSTGLT, CSI, '{', NONE, 1, PCLOSE ) /* select color lookup table */ +_VTE_NOQ(DECSZS, CSI, '{', NONE, 1, COMMA ) /* select zero symbol */ +_VTE_NOQ(XTERM_SGR_REPORT, CSI, '|', NONE, 1, HASH ) /* SGR report */ +_VTE_NOQ(DECSCPP, CSI, '|', NONE, 1, CASH ) /* select-columns-per-page */ +_VTE_NOQ(DECRQLP, CSI, '|', NONE, 1, SQUOTE ) /* request-locator-position */ +_VTE_NOQ(DECSNLS, CSI, '|', NONE, 1, MULT ) /* set-lines-per-screen */ +_VTE_NOQ(DECAC, CSI, '|', NONE, 1, COMMA ) /* assign color */ +_VTE_NOQ(DECKBD, CSI, '}', NONE, 1, SPACE ) /* keyboard-language-selection */ +_VTE_NOQ(XTERM_SGR_STACK_POP, CSI, '}', NONE, 1, HASH ) /* pop SGR stack */ +_VTE_NOQ(DECSASD, CSI, '}', NONE, 1, CASH ) /* select-active-status-display */ +_VTE_NOQ(DECIC, CSI, '}', NONE, 1, SQUOTE ) /* insert-column */ +_VTE_NOQ(DECATC, CSI, '}', NONE, 1, COMMA ) /* alternate text color */ +_VTE_NOQ(DECTME, CSI, '~', NONE, 1, SPACE ) /* terminal-mode-emulation */ +_VTE_NOQ(DECSSDT, CSI, '~', NONE, 1, CASH ) /* select-status-display-line-type */ +_VTE_NOQ(DECDC, CSI, '~', NONE, 1, SQUOTE ) /* delete-column */ +_VTE_NOQ(DECPS, CSI, '~', NONE, 1, COMMA ) /* play sound */ diff -Nru vte2.91-0.52.2/src/parser-dcs.hh vte2.91-0.54.0/src/parser-dcs.hh --- vte2.91-0.52.2/src/parser-dcs.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-dcs.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_SEQ) || !defined(_VTE_NOQ) +#error "Must define _VTE_SEQ and _VTE_NOQ before including this file" +#endif + +_VTE_NOQ(RLOGIN_MML, DCS, 'm', NONE, 1, HASH ) /* RLogin music macro language */ +_VTE_NOQ(DECREGIS, DCS, 'p', NONE, 0, NONE ) /* ReGIS-graphics */ +_VTE_NOQ(DECRSTS, DCS, 'p', NONE, 1, CASH ) /* restore-terminal-state */ +_VTE_NOQ(XTERM_STCAP, DCS, 'p', NONE, 1, PLUS ) /* xterm set termcap/terminfo */ +_VTE_NOQ(DECSIXEL, DCS, 'q', NONE, 0, NONE ) /* SIXEL-graphics */ +_VTE_SEQ(DECRQSS, DCS, 'q', NONE, 1, CASH ) /* request-selection-or-setting */ +_VTE_NOQ(XTERM_RQTCAP, DCS, 'q', NONE, 1, PLUS ) /* xterm request termcap/terminfo */ +_VTE_NOQ(DECLBAN, DCS, 'r', NONE, 0, NONE ) /* load-banner-message */ +_VTE_SEQ(DECRQSS, DCS, 'r', NONE, 1, CASH ) /* request-selection-or-setting */ +_VTE_SEQ(DECRQTSR, DCS, 's', NONE, 1, CASH ) /* request-terminal-state-report */ +_VTE_SEQ(XDGSYNC, DCS, 's', EQUAL, 0, NONE ) /* synchronous update */ +_VTE_NOQ(DECRSPS, DCS, 't', NONE, 1, CASH ) /* restore-presentation-state */ +_VTE_NOQ(DECAUPSS, DCS, 'u', NONE, 1, BANG ) /* assign-user-preferred-supplemental-sets */ +_VTE_NOQ(DECLANS, DCS, 'v', NONE, 0, NONE ) /* load-answerback-message */ +_VTE_NOQ(DECLBD, DCS, 'w', NONE, 0, NONE ) /* locator-button-define */ +_VTE_NOQ(DECPFK, DCS, 'x', NONE, 1, DQUOTE ) /* program-function-key */ +_VTE_NOQ(DECPAK, DCS, 'y', NONE, 1, DQUOTE ) /* program-alphanumeric-key */ +_VTE_NOQ(DECDMAC, DCS, 'z', NONE, 1, BANG ) /* define-macro */ +_VTE_NOQ(DECCKD, DCS, 'z', NONE, 1, DQUOTE ) /* copy-key-default */ +_VTE_NOQ(DECDLD, DCS, '{', NONE, 0, NONE ) /* dynamically-redefinable-character-sets-extension */ +_VTE_NOQ(DECSTUI, DCS, '{', NONE, 1, BANG ) /* set-terminal-unit-id */ +_VTE_NOQ(DECUDK, DCS, '|', NONE, 0, NONE ) /* user-defined-keys */ +_VTE_NOQ(WYLSFNT, DCS, '}', NONE, 0, NONE ) /* load soft font */ +_VTE_NOQ(DECRPFK, DCS, '}', NONE, 1, DQUOTE ) /* report function key definition */ +_VTE_NOQ(DECRPAK, DCS, '~', NONE, 1, DQUOTE ) /* report all modifier/alphanumeric key state */ diff -Nru vte2.91-0.52.2/src/parser-esc.hh vte2.91-0.54.0/src/parser-esc.hh --- vte2.91-0.52.2/src/parser-esc.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-esc.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_SEQ) || !defined(_VTE_NOQ) +#error "Must define _VTE_SEQ and _VTE_NOQ before including this file" +#endif + +_VTE_NOQ(DECDHL_TH, ESCAPE, '3', NONE, 1, HASH ) /* double-width-double-height-line: top half */ +_VTE_NOQ(DECDHL_BH, ESCAPE, '4', NONE, 1, HASH ) /* double-width-double-height-line: bottom half */ +_VTE_NOQ(DECSWL, ESCAPE, '5', NONE, 1, HASH ) /* single-width-single-height-line */ +_VTE_SEQ(DECBI, ESCAPE, '6', NONE, 0, NONE ) /* back-index */ +_VTE_NOQ(DECDWL, ESCAPE, '6', NONE, 1, HASH ) /* double-width-single-height-line */ +_VTE_SEQ(DECSC, ESCAPE, '7', NONE, 0, NONE ) /* save-cursor */ +_VTE_SEQ(DECRC, ESCAPE, '8', NONE, 0, NONE ) /* restore-cursor */ +_VTE_SEQ(DECALN, ESCAPE, '8', NONE, 1, HASH ) /* screen-alignment-pattern */ +_VTE_NOQ(DECFI, ESCAPE, '9', NONE, 0, NONE ) /* forward-index */ +_VTE_NOQ(WYDHL_TH, ESCAPE, ':', NONE, 0, HASH ) /* single width double height line: top half */ +_VTE_NOQ(WYDHL_BH, ESCAPE, ';', NONE, 0, HASH ) /* single width double height line: bottom half */ +_VTE_NOQ(DECANM, ESCAPE, '<', NONE, 0, NONE ) /* ansi-mode */ +_VTE_SEQ(DECKPAM, ESCAPE, '=', NONE, 0, NONE ) /* keypad-application-mode */ +_VTE_SEQ(DECKPNM, ESCAPE, '>', NONE, 0, NONE ) /* keypad-numeric-mode */ +_VTE_NOQ(BPH, ESCAPE, 'B', NONE, 0, NONE ) /* break permitted here */ +_VTE_NOQ(NBH, ESCAPE, 'C', NONE, 0, NONE ) /* no break permitted here */ +_VTE_SEQ(IND, ESCAPE, 'D', NONE, 0, NONE ) /* index */ +_VTE_SEQ(NEL, ESCAPE, 'E', NONE, 0, NONE ) /* next-line */ +_VTE_NOQ(SSA, ESCAPE, 'F', NONE, 0, NONE ) /* start of selected area */ +_VTE_NOQ(ESA, ESCAPE, 'G', NONE, 0, NONE ) /* end of selected area */ +_VTE_SEQ(HTS, ESCAPE, 'H', NONE, 0, NONE ) /* horizontal-tab-set */ +_VTE_NOQ(HTJ, ESCAPE, 'I', NONE, 0, NONE ) /* character tabulation with justification */ +_VTE_NOQ(VTS, ESCAPE, 'J', NONE, 0, NONE ) /* line tabulation set */ +_VTE_NOQ(PLD, ESCAPE, 'K', NONE, 0, NONE ) /* partial line forward */ +_VTE_NOQ(PLU, ESCAPE, 'L', NONE, 0, NONE ) /* partial line backward */ +_VTE_SEQ(RI, ESCAPE, 'M', NONE, 0, NONE ) /* reverse-index */ +_VTE_SEQ(SS2, ESCAPE, 'N', NONE, 0, NONE ) /* single-shift-2 */ +_VTE_SEQ(SS3, ESCAPE, 'O', NONE, 0, NONE ) /* single-shift-3 */ +_VTE_NOQ(PU1, ESCAPE, 'Q', NONE, 0, NONE ) /* private use 1 */ +_VTE_NOQ(PU2, ESCAPE, 'R', NONE, 0, NONE ) /* private use 2 */ +_VTE_NOQ(STS, ESCAPE, 'S', NONE, 0, NONE ) /* set transmit state */ +_VTE_NOQ(CCH, ESCAPE, 'T', NONE, 0, NONE ) /* cancel character */ +_VTE_NOQ(MW, ESCAPE, 'U', NONE, 0, NONE ) /* message waiting */ +_VTE_NOQ(SPA, ESCAPE, 'V', NONE, 0, NONE ) /* start-of-protected-area */ +_VTE_NOQ(EPA, ESCAPE, 'W', NONE, 0, NONE ) /* end-of-guarded-area */ +_VTE_NOQ(ST, ESCAPE, '\\', NONE, 0, NONE ) /* string-terminator */ +_VTE_NOQ(DMI, ESCAPE, '`', NONE, 0, NONE ) /* disable manual input */ +_VTE_NOQ(INT, ESCAPE, 'a', NONE, 0, NONE ) /* interrupt */ +_VTE_NOQ(EMI, ESCAPE, 'b', NONE, 0, NONE ) /* enable manual input */ +_VTE_SEQ(RIS, ESCAPE, 'c', NONE, 0, NONE ) /* reset-to-initial-state */ +_VTE_NOQ(CMD, ESCAPE, 'd', NONE, 0, NONE ) /* coding-method-delimiter */ +_VTE_NOQ(XTERM_MLHP, ESCAPE, 'l', NONE, 0, NONE ) /* xterm-memory-lock-hp-bugfix */ +_VTE_NOQ(XTERM_MUHP, ESCAPE, 'm', NONE, 0, NONE ) /* xterm-memory-unlock-hp-bugfix */ +_VTE_SEQ(LS2, ESCAPE, 'n', NONE, 0, NONE ) /* locking-shift-2 */ +_VTE_SEQ(LS3, ESCAPE, 'o', NONE, 0, NONE ) /* locking-shift-3 */ +_VTE_SEQ(LS3R, ESCAPE, '|', NONE, 0, NONE ) /* locking-shift-3-right */ +_VTE_SEQ(LS2R, ESCAPE, '}', NONE, 0, NONE ) /* locking-shift-2-right */ +_VTE_SEQ(LS1R, ESCAPE, '~', NONE, 0, NONE ) /* locking-shift-1-right */ diff -Nru vte2.91-0.52.2/src/parser-glue.hh vte2.91-0.54.0/src/parser-glue.hh --- vte2.91-0.52.2/src/parser-glue.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-glue.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,1002 @@ +/* + * Copyright © 2017, 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include + +#include "parser.hh" + +namespace vte { + +namespace parser { + +class Sequence; + +class Parser { +public: + friend class Sequence; + + Parser() noexcept + { + vte_parser_init(&m_parser); + } + Parser(Parser const&) = delete; + Parser(Parser&&) = delete; + + ~Parser() noexcept + { + vte_parser_deinit(&m_parser); + } + + Parser& operator=(Parser const&) = delete; + Parser& operator=(Parser&&) = delete; + + inline int feed(uint32_t raw) noexcept + { + return vte_parser_feed(&m_parser, raw); + } + + inline void reset() noexcept + { + vte_parser_reset(&m_parser); + } + +protected: + struct vte_parser m_parser; +}; // class Parser + +class Sequence { +public: + + Sequence() = default; + Sequence(Sequence const&) = delete; + Sequence(Sequence&&) = delete; + ~Sequence() = default; + + Sequence(Parser& parser) + { + m_seq = &parser.m_parser.seq; + } + + typedef int number; + + char* ucs4_to_utf8(gunichar const* str, + ssize_t len = -1) const noexcept; + + void print() const noexcept; + + /* type: + * + * + * Returns: the type of the sequence, a value from the VTE_SEQ_* enum + */ + inline constexpr unsigned int type() const noexcept + { + return m_seq->type; + } + + /* command: + * + * Returns: the command the sequence codes for, a value + * from the VTE_CMD_* enum, or %VTE_CMD_NONE if the command is + * unknown + */ + inline constexpr unsigned int command() const noexcept + { + return m_seq->command; + } + + /* charset: + * + * This is the charset to use in a %VTE_CMD_GnDm, %VTE_CMD_GnDMm, + * %VTE_CMD_CnD or %VTE_CMD_DOCS command. + * + * Returns: the charset, a value from the VTE_CHARSET_* enum. + */ + inline constexpr unsigned int charset() const noexcept + { + return VTE_CHARSET_GET_CHARSET(m_seq->charset); + } + + /* slot: + * + * This is the slot in a %VTE_CMD_GnDm, %VTE_CMD_GnDMm, + * or %VTE_CMD_CnD command. + * + * Returns: the slot, a value from the 0..3 for Gn*, or 0..1 for CnD + */ + inline constexpr unsigned int slot() const noexcept + { + return VTE_CHARSET_GET_SLOT(m_seq->charset); + } + + /* introducer: + * + * This is the character introducing the sequence, if any. + * + * Returns: the introducing character + */ + inline constexpr uint32_t introducer() const noexcept + { + return m_seq->introducer; + } + + /* terminator: + * + * This is the character terminating the sequence, or, for a + * %VTE_SEQ_GRAPHIC sequence, the graphic character. + * + * Returns: the terminating character + */ + inline constexpr uint32_t terminator() const noexcept + { + return m_seq->terminator; + } + + + /* is_c1: + * + * Whether the sequence was introduced with a C0 or C1 control. + * + * Returns: the introducing character + */ + inline constexpr bool is_c1() const noexcept + { + return (introducer() & 0x80) != 0; + } + + // FIXMEchpe: upgrade to C++17 and use the u32string_view version below, instead + /* + * string: + * + * This is the string argument of a DCS or OSC sequence. + * + * Returns: the string argument + */ + inline std::u32string string() const noexcept + { + size_t len; + auto buf = vte_seq_string_get(&m_seq->arg_str, &len); + return std::u32string(reinterpret_cast(buf), len); + } + + #if 0 + /* + * string: + * + * This is the string argument of a DCS or OSC sequence. + * + * Returns: the string argument + */ + inline constexpr std::u32string_view string() const noexcept + { + size_t len = 0; + auto buf = vte_seq_string_get(&m_seq->arg_str, &len); + return std::u32string_view(buf, len); + } + #endif + + /* + * string: + * + * This is the string argument of a DCS or OSC sequence. + * + * Returns: the string argument + */ + std::string string_utf8() const noexcept; + + inline char* string_param() const noexcept + { + size_t len = 0; + auto buf = vte_seq_string_get(&m_seq->arg_str, &len); + return ucs4_to_utf8(buf, len); + } + + /* size: + * + * Returns: the number of parameters + */ + inline constexpr unsigned int size() const noexcept + { + return m_seq->n_args; + } + + + /* size: + * + * Returns: the number of parameter blocks, counting runs of subparameters + * as only one parameter + */ + inline constexpr unsigned int size_final() const noexcept + { + return m_seq->n_final_args; + } + + /* capacity: + * + * Returns: the number of parameter blocks, counting runs of subparameters + * as only one parameter + */ + inline constexpr unsigned int capacity() const noexcept + { + return G_N_ELEMENTS(m_seq->args); + } + + /* param: + * @idx: + * @default_v: the value to use for default parameters + * + * Returns: the value of the parameter at index @idx, or @default_v if + * the parameter at this index has default value, or the index + * is out of bounds + */ + inline constexpr int param(unsigned int idx, + int default_v = -1) const noexcept + { + return __builtin_expect(idx < size(), 1) ? vte_seq_arg_value(m_seq->args[idx], default_v) : default_v; + } + + /* param: + * @idx: + * @default_v: the value to use for default parameters + * @min_v: the minimum value + * @max_v: the maximum value + * + * Returns: the value of the parameter at index @idx, or @default_v if + * the parameter at this index has default value, or the index + * is out of bounds. The returned value is clamped to the + * range @min_v..@max_v. + */ + inline constexpr int param(unsigned int idx, + int default_v, + int min_v, + int max_v) const noexcept + { + auto v = param(idx, default_v); + return std::min(std::max(v, min_v), max_v); + } + + /* param_nonfinal: + * @idx: + * + * Returns: whether the parameter at @idx is nonfinal, i.e. + * there are more subparameters after it. + */ + inline constexpr bool param_nonfinal(unsigned int idx) const noexcept + { + return __builtin_expect(idx < size(), 1) ? vte_seq_arg_nonfinal(m_seq->args[idx]) : false; + } + + /* param_default: + * @idx: + * + * Returns: whether the parameter at @idx has default value + */ + inline constexpr bool param_default(unsigned int idx) const noexcept + { + return __builtin_expect(idx < size(), 1) ? vte_seq_arg_default(m_seq->args[idx]) : true; + } + + /* next: + * @idx: + * + * Returns: the index of the next parameter block + */ + inline constexpr unsigned int next(unsigned int idx) const noexcept + { + /* Find the final parameter */ + while (param_nonfinal(idx)) + ++idx; + /* And return the index after that one */ + return ++idx; + } + + inline constexpr unsigned int cbegin() const noexcept + { + return 0; + } + + inline constexpr unsigned int cend() const noexcept + { + return size(); + } + + /* collect: + * + * Collects some final parameters. + * + * Returns: %true if the sequence parameter list begins with + * a run of final parameters that were collected. + */ + inline constexpr bool collect(unsigned int start_idx, + std::initializer_list params, + int default_v = -1) const noexcept + { + unsigned int idx = start_idx; + for (auto i : params) { + *i = param(idx, default_v); + idx = next(idx); + } + + return (idx - start_idx) == params.size(); + } + + /* collect1: + * @idx: + * @default_v: + * + * Collects one final parameter. + * + * Returns: the parameter value, or @default_v if the parameter has + * default value or is not a final parameter + */ + inline constexpr int collect1(unsigned int idx, + int default_v = -1) const noexcept + { + return __builtin_expect(idx < size(), 1) ? vte_seq_arg_value_final(m_seq->args[idx], default_v) : default_v; + } + + /* collect1: + * @idx: + * @default_v: + * @min_v: + * @max_v + * + * Collects one final parameter. + * + * Returns: the parameter value clamped to the @min_v .. @max_v range, + * or @default_v if the parameter has default value or is not a final parameter + */ + inline constexpr int collect1(unsigned int idx, + int default_v, + int min_v, + int max_v) const noexcept + { + int v = __builtin_expect(idx < size(), 1) ? vte_seq_arg_value_final(m_seq->args[idx], default_v) : default_v; + return std::min(std::max(v, min_v), max_v); + } + + /* collect_subparams: + * + * Collects some subparameters. + * + * Returns: %true if the sequence parameter list contains enough + * subparams at @start_idx + */ + inline constexpr bool collect_subparams(unsigned int start_idx, + std::initializer_list params, + int default_v = -1) const noexcept + { + unsigned int idx = start_idx; + for (auto i : params) { + *i = param(idx++, default_v); + } + + return idx <= next(start_idx); + } + + inline explicit operator bool() const { return m_seq != nullptr; } + + /* This is only used in the test suite */ + struct vte_seq** seq_ptr() { return &m_seq; } + +private: + struct vte_seq *m_seq{nullptr}; + + char const* type_string() const; + char const* command_string() const; +}; // class Sequence + +/* Helper classes to unify UTF-32 and UTF-8 versions of SequenceBuilder. + * ::put will only be called with C1 controls, so it's ok to simplify + * the UTF-8 version to simply prepend 0xc2. + */ +template +class DirectEncoder { +public: + using string_type = std::basic_string; + inline void put(string_type& s, C const c) const noexcept + { + s.push_back(c); + } +}; // class DirectEncoder + +class UTF8Encoder { +public: + using string_type = std::basic_string; + inline void put(string_type& s, unsigned char const c) const noexcept + { + s.push_back(0xc2); + s.push_back(c); + } +}; // class UTF8Encoder + +template> +class SequenceBuilder { +public: + using string_type = S; + using encoder_type = E; + +private: + struct vte_seq m_seq; + string_type m_arg_str; + unsigned char m_intermediates[4]; + unsigned char m_n_intermediates{0}; + unsigned char m_param_intro{0}; + encoder_type m_encoder; + +public: + SequenceBuilder(unsigned int type = VTE_SEQ_NONE) + { + memset(&m_seq, 0, sizeof(m_seq)); + set_type(type); + } + + SequenceBuilder(unsigned int type, + uint32_t f) + : SequenceBuilder(type) + { + set_final(f); + } + + SequenceBuilder(unsigned int type, + string_type const& str) + : SequenceBuilder(type) + { + set_string(str); + } + + SequenceBuilder(unsigned int type, + string_type&& str) + : SequenceBuilder(type) + { + set_string(str); + } + + SequenceBuilder(SequenceBuilder const&) = delete; + SequenceBuilder(SequenceBuilder&&) = delete; + ~SequenceBuilder() = default; + + SequenceBuilder& operator= (SequenceBuilder const&) = delete; + SequenceBuilder& operator= (SequenceBuilder&&) = delete; + + inline void set_type(unsigned int type) noexcept + { + m_seq.type = type; + } + + inline void set_final(uint32_t t) noexcept + { + m_seq.terminator = t; + } + + inline void append_intermediate(unsigned char i) noexcept + { + assert(unsigned(m_n_intermediates + 1) <= (sizeof(m_intermediates)/sizeof(m_intermediates[0]))); + + m_intermediates[m_n_intermediates++] = i; + } + + inline void append_intermediates(std::initializer_list l) noexcept + { + assert(m_n_intermediates + l.size() <= (sizeof(m_intermediates)/sizeof(m_intermediates[0]))); + + for (uint32_t i : l) { + m_intermediates[m_n_intermediates++] = i; + } + } + + inline void set_param_intro(unsigned char p) noexcept + { + m_param_intro = p; + } + + inline void append_param(int p) noexcept + { + assert(m_seq.n_args + 1 <= (sizeof(m_seq.args) / sizeof(m_seq.args[0]))); + m_seq.args[m_seq.n_args++] = vte_seq_arg_init(std::min(p, 0xffff)); + } + + inline void append_params(std::initializer_list params) noexcept + { + assert(m_seq.n_args + params.size() <= (sizeof(m_seq.args) / sizeof(m_seq.args[0]))); + for (int p : params) + m_seq.args[m_seq.n_args++] = vte_seq_arg_init(std::min(p, 0xffff)); + } + + inline void append_subparams(std::initializer_list subparams) noexcept + { + assert(m_seq.n_args + subparams.size() <= (sizeof(m_seq.args) / sizeof(m_seq.args[0]))); + for (int p : subparams) { + int* arg = &m_seq.args[m_seq.n_args++]; + *arg = vte_seq_arg_init(std::min(p, 0xffff)); + vte_seq_arg_finish(arg, false); + } + vte_seq_arg_refinish(&m_seq.args[m_seq.n_args - 1], true); + } + + inline void set_string(string_type const& str) noexcept + { + m_arg_str = str; + } + + inline void set_string(string_type&& str) noexcept + { + m_arg_str = str; + } + + enum class Introducer { + NONE, + DEFAULT, + C0, + C1 + }; + + enum class ST { + NONE, + DEFAULT, + C0, + C1, + BEL + }; + + +private: + void append_introducer_(string_type& s, + bool c1 = true) const noexcept + { + /* Introducer */ + if (c1) { + switch (m_seq.type) { + case VTE_SEQ_ESCAPE: m_encoder.put(s, 0x1b); break; // ESC + case VTE_SEQ_CSI: m_encoder.put(s, 0x9b); break; // CSI + case VTE_SEQ_DCS: m_encoder.put(s, 0x90); break; // DCS + case VTE_SEQ_OSC: m_encoder.put(s, 0x9d); break; // OSC + case VTE_SEQ_APC: m_encoder.put(s, 0x9f); break; // APC + case VTE_SEQ_PM: m_encoder.put(s, 0x9e); break; // PM + case VTE_SEQ_SOS: m_encoder.put(s, 0x98); break; // SOS + case VTE_SEQ_SCI: m_encoder.put(s, 0x9a); break; // SCI + default: return; + } + } else { + s.push_back(0x1B); // ESC + switch (m_seq.type) { + case VTE_SEQ_ESCAPE: break; // nothing more + case VTE_SEQ_CSI: s.push_back(0x5b); break; // [ + case VTE_SEQ_DCS: s.push_back(0x50); break; // P + case VTE_SEQ_OSC: s.push_back(0x5d); break; // ] + case VTE_SEQ_APC: s.push_back(0x5f); break; // _ + case VTE_SEQ_PM: s.push_back(0x5e); break; // ^ + case VTE_SEQ_SOS: s.push_back(0x58); break; // X + case VTE_SEQ_SCI: s.push_back(0x5a); break; // Z + default: return; + } + } + } + + void append_introducer(string_type& s, + bool c1 = true, + Introducer introducer = Introducer::DEFAULT) const noexcept + { + switch (introducer) { + case Introducer::NONE: + break; + case Introducer::DEFAULT: + append_introducer_(s, c1); + break; + case Introducer::C0: + append_introducer_(s, false); + break; + case Introducer::C1: + append_introducer_(s, true); + } + } + + void append_params(string_type& s) const noexcept + { + /* Parameters */ + switch (m_seq.type) { + case VTE_SEQ_CSI: + case VTE_SEQ_DCS: { + + if (m_param_intro != 0) + s.push_back(m_param_intro); + auto n_args = m_seq.n_args; + for (unsigned int n = 0; n < n_args; n++) { + auto arg = vte_seq_arg_value(m_seq.args[n]); + if (n > 0) { + s.push_back(";:"[vte_seq_arg_nonfinal(m_seq.args[n])]); + } + if (arg >= 0) { + char buf[16]; + int l = g_snprintf(buf, sizeof(buf), "%d", arg); + for (int j = 0; j < l; j++) + s.push_back(buf[j]); + } + } + break; + } + default: + break; + } + } + + void append_intermediates_and_final(string_type& s) const noexcept + { + /* Intermediates and Final */ + switch (m_seq.type) { + case VTE_SEQ_ESCAPE: + case VTE_SEQ_CSI: + case VTE_SEQ_DCS: + #pragma GCC diagnostic push + #if G_GNUC_CHECK_VERSION(7, 0) + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" + #endif + for (unsigned char n = 0; n < m_n_intermediates; n++) + s.push_back(m_intermediates[n]); + /* [[fallthrough]]; */ + #pragma GCC diagnostic pop + case VTE_SEQ_SCI: + if (m_seq.terminator != 0) + s.push_back(m_seq.terminator); + break; + default: + break; + } + } + + void append_arg_string(string_type& s, + bool c1 = false, + ssize_t max_arg_str_len = -1, + ST st = ST::DEFAULT) const noexcept + { + /* String and ST */ + switch (m_seq.type) { + case VTE_SEQ_DCS: + case VTE_SEQ_OSC: + + if (max_arg_str_len < 0) + s.append(m_arg_str, 0, max_arg_str_len); + else + s.append(m_arg_str); + + switch (st) { + case ST::NONE: + // omit ST + break; + case ST::DEFAULT: + if (c1) { + m_encoder.put(s, 0x9c); // ST + } else { + s.push_back(0x1b); // ESC + s.push_back(0x5c); // BACKSLASH + } + break; + case ST::C0: + s.push_back(0x1b); // ESC + s.push_back(0x5c); // BACKSLASH + break; + case ST::C1: + m_encoder.put(s, 0x9c); // ST + break; + case ST::BEL: + s.push_back(0x7); // BEL + break; + default: + break; + } + } + } + +public: + void to_string(string_type& s, + bool c1 = false, + ssize_t max_arg_str_len = -1, + Introducer introducer = Introducer::DEFAULT, + ST st = ST::DEFAULT) const noexcept + { + append_introducer(s, c1, introducer); + append_params(s); + append_intermediates_and_final(s); + append_arg_string(s, c1, max_arg_str_len, st); + } + + /* The following are only used in the test suite */ + void reset_params() noexcept + { + m_seq.n_args = 0; + } + + void assert_equal(Sequence const& seq) const noexcept + { + g_assert_cmpuint(seq.type(), ==, m_seq.type); + g_assert_cmphex(seq.terminator(), ==, m_seq.terminator); + } + + void assert_equal_full(Sequence const& seq) const noexcept + { + assert_equal(seq); + + auto type = seq.type(); + if (type == VTE_SEQ_CSI || + type == VTE_SEQ_DCS) { + /* We may get one arg less back, if it's at default */ + if (m_seq.n_args != seq.size()) { + g_assert_cmpuint(m_seq.n_args, ==, seq.size() + 1); + g_assert_true(vte_seq_arg_default(m_seq.args[m_seq.n_args - 1])); + } + for (unsigned int n = 0; n < seq.size(); n++) + g_assert_cmpint(vte_seq_arg_value(m_seq.args[n]), ==, seq.param(n)); + } + } +}; // class SequenceBuilder + +using u8SequenceBuilder = SequenceBuilder; +using u32SequenceBuilder = SequenceBuilder; + +class ReplyBuilder : public u8SequenceBuilder { +public: + ReplyBuilder(unsigned int reply, + std::initializer_list params) + { + switch (reply) { +#define _VTE_REPLY_PARAMS(params) append_params(params); +#define _VTE_REPLY_STRING(str) set_string(str); +#define _VTE_REPLY(cmd,type,final,pintro,intermediate,code) \ + case VTE_REPLY_##cmd: \ + set_type(VTE_SEQ_##type); \ + set_final(final); \ + set_param_intro(VTE_SEQ_PARAMETER_CHAR_##pintro); \ + if (VTE_SEQ_INTERMEDIATE_CHAR_##intermediate != VTE_SEQ_INTERMEDIATE_CHAR_NONE) \ + append_intermediate(VTE_SEQ_INTERMEDIATE_CHAR_##intermediate); \ + code \ + break; +#include "parser-reply.hh" +#undef _VTE_REPLY +#undef _VTE_REPLY_PARAMS +#undef _VTE_REPLY_STRING + default: + assert(false); + break; + } + append_params(params); + } + +}; // class ReplyBuilder + +class StringTokeniser { +public: + using string_type = std::string; + using char_type = std::string::value_type; + +private: + string_type const& m_string; + char_type m_separator{';'}; + +public: + StringTokeniser(string_type& s, + char_type separator = ';') + : m_string{s}, + m_separator{separator} + { + } + + StringTokeniser(string_type&& s, + char_type separator = ';') + : m_string{s}, + m_separator{separator} + { + } + + StringTokeniser(StringTokeniser const&) = delete; + StringTokeniser(StringTokeniser&&) = delete; + ~StringTokeniser() = default; + + StringTokeniser& operator=(StringTokeniser const&) = delete; + StringTokeniser& operator=(StringTokeniser&&) = delete; + + /* + * const_iterator: + * + * InputIterator for string tokens. + */ + class const_iterator { + public: + using difference_type = ptrdiff_t; + using value_type = string_type; + using pointer = string_type; + using reference = string_type; + using iterator_category = std::input_iterator_tag; + using size_type = string_type::size_type; + + private: + string_type const* m_string; + char_type m_separator{';'}; + string_type::size_type m_position; + string_type::size_type m_next_separator; + + public: + const_iterator(string_type const* str, + char_type separator, + size_type position) + : m_string{str}, + m_separator{separator}, + m_position{position}, + m_next_separator{m_string->find(m_separator, m_position)} + { + } + + const_iterator(string_type const* str, + char_type separator) + : m_string{str}, + m_separator{separator}, + m_position{string_type::npos}, + m_next_separator{string_type::npos} + { + } + + const_iterator(const_iterator const&) = default; + const_iterator(const_iterator&& o) + : m_string{o.m_string}, + m_separator{o.m_separator}, + m_position{o.m_position}, + m_next_separator{o.m_next_separator} + { + } + + ~const_iterator() = default; + + const_iterator& operator=(const_iterator const& o) + { + m_string = o.m_string; + m_separator = o.m_separator; + m_position = o.m_position; + m_next_separator = o.m_next_separator; + return *this; + } + + const_iterator& operator=(const_iterator&& o) + { + m_string = std::move(o.m_string); + m_separator = o.m_separator; + m_position = o.m_position; + m_next_separator = o.m_next_separator; + return *this; + } + + inline bool operator==(const_iterator const& o) const noexcept + { + return m_position == o.m_position; + } + + inline bool operator!=(const_iterator const& o) const noexcept + { + return m_position != o.m_position; + } + + inline const_iterator& operator++() noexcept + { + if (m_next_separator != string_type::npos) { + m_position = ++m_next_separator; + m_next_separator = m_string->find(m_separator, m_position); + } else + m_position = string_type::npos; + + return *this; + } + + /* + * number: + * + * Returns the value of the iterator as a number, or -1 + * if the string could not be parsed as a number, or + * the parsed values exceeds the uint16_t range. + * + * Returns: true if a number was parsed + */ + bool number(int& v) const noexcept + { + auto const s = size(); + if (s == 0) { + v = -1; + return true; + } + + v = 0; + size_type i; + for (i = 0; i < s; ++i) { + char_type c = (*m_string)[m_position + i]; + if (c < '0' || c > '9') + return false; + + v = v * 10 + (c - '0'); + if (v > 0xffff) + return false; + } + + /* All consumed? */ + return i == s; + } + + inline size_type size() const noexcept + { + if (m_next_separator != string_type::npos) + return m_next_separator - m_position; + else + return m_string->size() - m_position; + } + + inline size_type size_remaining() const noexcept + { + return m_string->size() - m_position; + } + + inline string_type operator*() const noexcept + { + return m_string->substr(m_position, size()); + } + + /* + * string_remaining: + * + * Returns the whole string left, including possibly more separators. + */ + inline string_type string_remaining() const noexcept + { + return m_string->substr(m_position); + } + + inline void append(string_type& str) const noexcept + { + str.append(m_string->substr(m_position, size())); + } + + inline void append_remaining(string_type& str) const noexcept + { + str.append(m_string->substr(m_position)); + } + + }; // class const_iterator + + inline const_iterator cbegin(char_type c = ';') const noexcept + { + return const_iterator(&m_string, m_separator, 0); + } + + inline const_iterator cend() const noexcept + { + return const_iterator(&m_string, m_separator); + } + + inline const_iterator begin(char_type c = ';') const noexcept + { + return cbegin(); + } + + inline const_iterator end() const noexcept + { + return cend(); + } + +}; // class StringTokeniser + +} // namespace parser + +} // namespace vte diff -Nru vte2.91-0.52.2/src/parser.hh vte2.91-0.54.0/src/parser.hh --- vte2.91-0.52.2/src/parser.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,193 @@ +/* + * Copyright © 2015 David Herrmann + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +#include "parser-arg.hh" +#include "parser-string.hh" + +struct vte_parser; +struct vte_seq; + +/* + * Parsers + * The vte_parser object parses control-sequences for both host and terminal + * side. Based on this parser, there is a set of command-parsers that take a + * vte_seq sequence and returns the command it represents. This is different + * for host and terminal side, and so far we only provide the terminal side, as + * host side is not used by anyone. + */ + +#define VTE_PARSER_ARG_MAX (32) + +enum { + VTE_SEQ_NONE, /* placeholder, no sequence parsed */ + + VTE_SEQ_IGNORE, /* no-op character */ + VTE_SEQ_GRAPHIC, /* graphic character */ + VTE_SEQ_CONTROL, /* control character */ + VTE_SEQ_ESCAPE, /* escape sequence */ + VTE_SEQ_CSI, /* control sequence function */ + VTE_SEQ_DCS, /* device control string */ + VTE_SEQ_OSC, /* operating system control */ + VTE_SEQ_SCI, /* single character control function */ + VTE_SEQ_APC, /* application program command */ + VTE_SEQ_PM, /* privacy message */ + VTE_SEQ_SOS, /* start of string */ + + VTE_SEQ_N, +}; + +enum { + VTE_SEQ_INTERMEDIATE_CHAR_NONE = 0, + + VTE_SEQ_INTERMEDIATE_CHAR_SPACE = ' ', /* 02/00 */ + VTE_SEQ_INTERMEDIATE_CHAR_BANG = '!', /* 02/01 */ + VTE_SEQ_INTERMEDIATE_CHAR_DQUOTE = '"', /* 02/02 */ + VTE_SEQ_INTERMEDIATE_CHAR_HASH = '#', /* 02/03 */ + VTE_SEQ_INTERMEDIATE_CHAR_CASH = '$', /* 02/04 */ + VTE_SEQ_INTERMEDIATE_CHAR_PERCENT = '%', /* 02/05 */ + VTE_SEQ_INTERMEDIATE_CHAR_AND = '&', /* 02/06 */ + VTE_SEQ_INTERMEDIATE_CHAR_SQUOTE = '\'', /* 02/07 */ + VTE_SEQ_INTERMEDIATE_CHAR_POPEN = '(', /* 02/08 */ + VTE_SEQ_INTERMEDIATE_CHAR_PCLOSE = ')', /* 02/09 */ + VTE_SEQ_INTERMEDIATE_CHAR_MULT = '*', /* 02/10 */ + VTE_SEQ_INTERMEDIATE_CHAR_PLUS = '+', /* 02/11 */ + VTE_SEQ_INTERMEDIATE_CHAR_COMMA = ',', /* 02/12 */ + VTE_SEQ_INTERMEDIATE_CHAR_MINUS = '-', /* 02/13 */ + VTE_SEQ_INTERMEDIATE_CHAR_DOT = '.', /* 02/14 */ + VTE_SEQ_INTERMEDIATE_CHAR_SLASH = '/', /* 02/15 */ +}; + +enum { + VTE_SEQ_PARAMETER_CHAR_NONE = 0, + + /* Numbers; not used * 03/00..03/09 */ + /* COLON is reserved = ':' * 03/10 */ + /* SEMICOLON is reserved = ';' * 03/11 */ + VTE_SEQ_PARAMETER_CHAR_LT = '<', /* 03/12 */ + VTE_SEQ_PARAMETER_CHAR_EQUAL = '=', /* 03/13 */ + VTE_SEQ_PARAMETER_CHAR_GT = '>', /* 03/14 */ + VTE_SEQ_PARAMETER_CHAR_WHAT = '?' /* 03/15 */ +}; + +#define VTE_SEQ_MAKE_INTERMEDIATE(c) ((c) - ' ' + 1) + +enum { + VTE_SEQ_INTERMEDIATE_NONE = 0, + + VTE_SEQ_INTERMEDIATE_SPACE = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_SPACE ), + VTE_SEQ_INTERMEDIATE_BANG = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_BANG ), + VTE_SEQ_INTERMEDIATE_DQUOTE = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_DQUOTE ), + VTE_SEQ_INTERMEDIATE_HASH = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_HASH ), + VTE_SEQ_INTERMEDIATE_CASH = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_CASH ), + VTE_SEQ_INTERMEDIATE_PERCENT = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_PERCENT), + VTE_SEQ_INTERMEDIATE_AND = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_AND ), + VTE_SEQ_INTERMEDIATE_SQUOTE = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_SQUOTE ), + VTE_SEQ_INTERMEDIATE_POPEN = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_POPEN ), + VTE_SEQ_INTERMEDIATE_PCLOSE = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_PCLOSE ), + VTE_SEQ_INTERMEDIATE_MULT = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_MULT ), + VTE_SEQ_INTERMEDIATE_PLUS = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_PLUS ), + VTE_SEQ_INTERMEDIATE_COMMA = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_COMMA ), + VTE_SEQ_INTERMEDIATE_MINUS = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_MINUS ), + VTE_SEQ_INTERMEDIATE_DOT = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_DOT ), + VTE_SEQ_INTERMEDIATE_SLASH = VTE_SEQ_MAKE_INTERMEDIATE(VTE_SEQ_INTERMEDIATE_CHAR_SLASH ), +}; + +#define VTE_SEQ_MAKE_PARAMETER(c) ('?' - (c) + 1) + +enum { + VTE_SEQ_PARAMETER_NONE = 0, + + VTE_SEQ_PARAMETER_LT = VTE_SEQ_MAKE_PARAMETER(VTE_SEQ_PARAMETER_CHAR_LT ), + VTE_SEQ_PARAMETER_EQUAL = VTE_SEQ_MAKE_PARAMETER(VTE_SEQ_PARAMETER_CHAR_EQUAL), + VTE_SEQ_PARAMETER_GT = VTE_SEQ_MAKE_PARAMETER(VTE_SEQ_PARAMETER_CHAR_GT ), + VTE_SEQ_PARAMETER_WHAT = VTE_SEQ_MAKE_PARAMETER(VTE_SEQ_PARAMETER_CHAR_WHAT ), +}; + +enum { +#define _VTE_CMD(cmd) VTE_CMD_##cmd, +#define _VTE_NOP(cmd) VTE_CMD_##cmd, +#include "parser-cmd.hh" +#undef _VTE_CMD +#undef _VTE_NOP + + VTE_CMD_N, + VTE_CMD_NOP_FIRST = VTE_CMD_ACK +}; + +enum { +#define _VTE_REPLY(cmd,type,final,pintro,intermediate,code) VTE_REPLY_##cmd, +#include "parser-reply.hh" +#undef _VTE_REPLY + + VTE_REPLY_N +}; + +enum { +#define _VTE_CHARSET_PASTE(name) VTE_CHARSET_##name, +#define _VTE_CHARSET(name) _VTE_CHARSET_PASTE(name) +#define _VTE_CHARSET_ALIAS_PASTE(name1,name2) VTE_CHARSET_##name1 = VTE_CHARSET_##name2, +#define _VTE_CHARSET_ALIAS(name1,name2) _VTE_CHARSET_ALIAS_PASTE(name1,name2) +#include "parser-charset.hh" +#undef _VTE_CHARSET_PASTE +#undef _VTE_CHARSET +#undef _VTE_CHARSET_ALIAS_PASTE +#undef _VTE_CHARSET_ALIAS +}; + +enum { +#define _VTE_OSC(osc,value) VTE_OSC_##osc = value, +#include "parser-osc.hh" +#undef _VTE_OSC + + VTE_OSC_N +}; + +#define VTE_CHARSET_CHARSET_MASK ((1U << 16) - 1U) +#define VTE_CHARSET_SLOT_OFFSET (16) +#define VTE_CHARSET_GET_CHARSET(c) ((c) & VTE_CHARSET_CHARSET_MASK) +#define VTE_CHARSET_GET_SLOT(c) ((c) >> VTE_CHARSET_SLOT_OFFSET) + +struct vte_seq { + unsigned int type; + unsigned int command; + uint32_t terminator; + unsigned int intermediates; + unsigned int n_intermediates; + unsigned int charset; + unsigned int n_args; + unsigned int n_final_args; + vte_seq_arg_t args[VTE_PARSER_ARG_MAX]; + vte_seq_string_t arg_str; + uint32_t introducer; +}; + +struct vte_parser { + struct vte_seq seq; + unsigned int state; +}; + +void vte_parser_init(struct vte_parser *parser); +void vte_parser_deinit(struct vte_parser *parser); +int vte_parser_feed(struct vte_parser *parser, + uint32_t raw); +void vte_parser_reset(struct vte_parser *parser); diff -Nru vte2.91-0.52.2/src/parser-osc.hh vte2.91-0.54.0/src/parser-osc.hh --- vte2.91-0.52.2/src/parser-osc.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-osc.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,100 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License) or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful) + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not) see . + */ + +#if !defined(_VTE_OSC) +#error "Must define _VTE_OSC before including this file" +#endif + +/* _VTE_OSC(DTTERM_CWD, 3) Conflicts with XTERM_SET_XPROPERTY */ + +_VTE_OSC(EMACS_51, 51) + +_VTE_OSC(ITERM2_GROWL, 9) +_VTE_OSC(ITERM2_133, 133) +_VTE_OSC(ITERM2_1337, 1337) + +_VTE_OSC(KONSOLE_30, 30) +_VTE_OSC(KONSOLE_31, 31) + +/* _VTE_OSC(MINTTY_CLIPBOARD_COPY_WINDOW_TITLE, 7721) */ +/* _VTE_OSC(MINTTY_CHANGE_FONT_SIZE, 7770) */ +/* _VTE_OSC(MINTTY_QUERY_FONT_SUPPORTS_CHARACTERS, 7771) */ +/* _VTE_OSC(MINTTY_CHANGE_FONT_AND_WINDOW_SIZE, 7777) */ +/* _VTE_OSC(MINTTY_INDIC_WIDE, 77119) out of range */ + +_VTE_OSC(RLOGIN_SET_KANJI_MODE, 800) +_VTE_OSC(RLOGIN_SPEECH, 801) + +/* _VTE_OSC(RXVT_MENU, 10) * Conflics with XTERM_SET_COLOR_TEXT_FG */ +_VTE_OSC(RXVT_SET_BACKGROUND_PIXMAP, 20) +_VTE_OSC(RXVT_SET_COLOR_FG, 39) +_VTE_OSC(RXVT_SET_COLOR_BG, 49) +_VTE_OSC(RXVT_DUMP_SCREEN, 55) + +_VTE_OSC(URXVT_SET_LOCALE, 701) +_VTE_OSC(URXVT_VERSION, 702) +_VTE_OSC(URXVT_SET_COLOR_TEXT_ITALIC, 704) +_VTE_OSC(URXVT_SET_COLOR_TEXT_BOLD, 706) +_VTE_OSC(URXVT_SET_COLOR_UNDERLINE, 707) +_VTE_OSC(URXVT_SET_COLOR_BORDER, 708) +_VTE_OSC(URXVT_SET_FONT, 710) +_VTE_OSC(URXVT_SET_FONT_BOLD, 711) +_VTE_OSC(URXVT_SET_FONT_ITALIC, 712) +_VTE_OSC(URXVT_SET_FONT_BOLD_ITALIC, 713) +_VTE_OSC(URXVT_VIEW_UP, 720) +_VTE_OSC(URXVT_VIEW_DOWN, 721) +_VTE_OSC(URXVT_EXTENSION, 777) + +_VTE_OSC(VTECWF, 6) +_VTE_OSC(VTECWD, 7) +_VTE_OSC(VTEHYPER, 8) + +_VTE_OSC(XTERM_SET_WINDOW_AND_ICON_TITLE, 0) +_VTE_OSC(XTERM_SET_ICON_TITLE, 1) +_VTE_OSC(XTERM_SET_WINDOW_TITLE, 2) +_VTE_OSC(XTERM_SET_XPROPERTY, 3) +_VTE_OSC(XTERM_SET_COLOR, 4) +_VTE_OSC(XTERM_SET_COLOR_SPECIAL, 5) +/* _VTE_OSC(XTERM_SET_COLOR_MODE, 6) Conflict with our own OSC 6 VTECWF; so use 106 */ +_VTE_OSC(XTERM_SET_COLOR_TEXT_FG, 10) +_VTE_OSC(XTERM_SET_COLOR_TEXT_BG, 11) +_VTE_OSC(XTERM_SET_COLOR_CURSOR_BG, 12) +_VTE_OSC(XTERM_SET_COLOR_MOUSE_CURSOR_FG, 13) +_VTE_OSC(XTERM_SET_COLOR_MOUSE_CURSOR_BG, 14) +_VTE_OSC(XTERM_SET_COLOR_TEK_FG, 15) +_VTE_OSC(XTERM_SET_COLOR_TEK_BG, 16) +_VTE_OSC(XTERM_SET_COLOR_HIGHLIGHT_BG, 17) +_VTE_OSC(XTERM_SET_COLOR_TEK_CURSOR, 18) +_VTE_OSC(XTERM_SET_COLOR_HIGHLIGHT_FG, 19) +_VTE_OSC(XTERM_LOGFILE, 46) +_VTE_OSC(XTERM_SET_FONT, 50) +_VTE_OSC(XTERM_SET_XSELECTION, 52) +_VTE_OSC(XTERM_RESET_COLOR, 104) +_VTE_OSC(XTERM_RESET_COLOR_SPECIAL, 105) +_VTE_OSC(XTERM_SET_COLOR_MODE, 106) +_VTE_OSC(XTERM_RESET_COLOR_TEXT_FG, 110) +_VTE_OSC(XTERM_RESET_COLOR_TEXT_BG, 111) +_VTE_OSC(XTERM_RESET_COLOR_CURSOR_BG, 112) +_VTE_OSC(XTERM_RESET_COLOR_MOUSE_CURSOR_FG, 113) +_VTE_OSC(XTERM_RESET_COLOR_MOUSE_CURSOR_BG, 114) +_VTE_OSC(XTERM_RESET_COLOR_TEK_FG, 115) +_VTE_OSC(XTERM_RESET_COLOR_TEK_BG, 116) +_VTE_OSC(XTERM_RESET_COLOR_HIGHLIGHT_BG, 117) +_VTE_OSC(XTERM_RESET_COLOR_TEK_CURSOR, 118) +_VTE_OSC(XTERM_RESET_COLOR_HIGHLIGHT_FG, 119) + +_VTE_OSC(YF_RQGWR, 8900) diff -Nru vte2.91-0.52.2/src/parser-reply.hh vte2.91-0.54.0/src/parser-reply.hh --- vte2.91-0.52.2/src/parser-reply.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-reply.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if !defined(_VTE_REPLY) +#error "Must define _VTE_REPLY before including this file" +#endif + +_VTE_REPLY(NONE, NONE, 0, NONE, NONE,) /* placeholder */ + + +_VTE_REPLY(APC, APC, 0, NONE, NONE, ) /* application program command */ +_VTE_REPLY(DECEKBD, APC, 0, NONE, NONE, ) /* extended keyboard report */ + +_VTE_REPLY(XTERM_FOCUS_IN, CSI, 'I', NONE, NONE, ) /* XTERM focus in report */ +_VTE_REPLY(URXVT_MOUSE_EXT_REPORT, CSI, 'M', NONE, NONE, ) /* URXVT mouse mode report */ +_VTE_REPLY(XTERM_MOUSE_EXT_SGR_REPORT_BUTTON_PRESS, CSI, 'M', LT, NONE, ) /* XTERM SGR mouse mode button press report */ +_VTE_REPLY(XTERM_FOCUS_OUT, CSI, 'O', NONE, NONE, ) /* XTERM focus out report */ +_VTE_REPLY(DECXCPR, CSI, 'R', WHAT, NONE, ) /* extended cursor position report */ +_VTE_REPLY(CPR, CSI, 'R', NONE, NONE, ) /* cursor position report */ +_VTE_REPLY(DECDA1R, CSI, 'c', WHAT, NONE, ) /* DA1 report */ +_VTE_REPLY(DECDA2R, CSI, 'c', GT, NONE, ) /* DA2 report */ +_VTE_REPLY(SGR, CSI, 'm', NONE, NONE, ) /* SGR */ +_VTE_REPLY(XTERM_MOUSE_EXT_SGR_REPORT_BUTTON_RELEASE, CSI, 'm', LT, NONE, ) /* XTERM SGR mouse mode button release report */ +_VTE_REPLY(DSR, CSI, 'n', NONE, NONE, ) /* device status report */ +_VTE_REPLY(DECDSR, CSI, 'n', WHAT, NONE, ) /* device status report */ +_VTE_REPLY(DECSCUSR, CSI, 'q', NONE, SPACE, ) /* set-cursor-style */ +_VTE_REPLY(DECSRC, CSI, 'q', NONE, MULT, ) /* secure reset confirmation */ +_VTE_REPLY(DECSTBM, CSI, 'r', NONE, NONE, ) /* set-top-and-bottom-margins */ +_VTE_REPLY(XTERM_WM, CSI, 't', NONE, NONE, ) /* XTERM WM report */ +_VTE_REPLY(DECRPDE, CSI, 'w', NONE, DQUOTE,) /* report displayed extent */ +_VTE_REPLY(DECRPKT, CSI, 'v', NONE, COMMA, ) /* report key type */ +_VTE_REPLY(DECREPTPARM, CSI, 'x', NONE, NONE, ) /* report terminal parameters */ +_VTE_REPLY(DECPKMFR, CSI, 'y', NONE, PLUS, ) /* program key free memory report */ +_VTE_REPLY(DECRPM_ECMA, CSI, 'y', NONE, CASH, ) /* report ECMA mode */ +_VTE_REPLY(DECRPM_DEC, CSI, 'y', WHAT, CASH, ) /* report private mode */ +_VTE_REPLY(DECMSR, CSI, '{', NONE, MULT, ) /* macro space report */ +_VTE_REPLY(XTERM_BRACKET, CSI, '~', NONE, NONE, ) /* XTERM bracketed paste */ + +_VTE_REPLY(DECTABSR, DCS, '@', NONE, CASH, ) /* tabulation stop report */ +_VTE_REPLY(DECRPSS, DCS, 'r', NONE, CASH, ) /* report state or setting */ +_VTE_REPLY(DECTSR, DCS, 's', NONE, CASH, ) /* terminal state report */ +_VTE_REPLY(DECCTR, DCS, 's', NONE, CASH, _VTE_REPLY_PARAMS({2})) /* color table report */ +_VTE_REPLY(DECAUPSS, DCS, 'u', NONE, BANG, ) /* assign user preferred supplemental set */ +_VTE_REPLY(DECCIR, DCS, 'u', NONE, CASH, _VTE_REPLY_PARAMS({1})) /* cursor information report */ +_VTE_REPLY(DECRPTUI, DCS, '|', NONE, BANG, _VTE_REPLY_STRING("7E565445") /* "~VTE" */) /* report terminal unit ID */ +_VTE_REPLY(DECRPFK, DCS, '}', NONE, DQUOTE,) /* report function key */ +_VTE_REPLY(DECCKSR, DCS, '~', NONE, BANG, ) /* memory checksum report */ +_VTE_REPLY(DECRPAK, DCS, '~', NONE, DQUOTE,) /* report all modifiers/alphanumeric key */ + +_VTE_REPLY(OSC, OSC, 0, NONE, NONE, ) /* operating system command */ + +_VTE_REPLY(PM, PM, 0, NONE, NONE, ) /* privacy message */ + +_VTE_REPLY(SOS, SOS, 0, NONE, NONE, ) /* start of string */ diff -Nru vte2.91-0.52.2/src/parser-string.hh vte2.91-0.54.0/src/parser-string.hh --- vte2.91-0.52.2/src/parser-string.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-string.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,138 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include +#include + +/* + * vte_seq_string_t: + * + * A type to hold the argument string of a DSC or OSC sequence. + */ +typedef struct vte_seq_string_t { + uint32_t capacity; + uint32_t len; + uint32_t* buf; +} vte_seq_string_t; + +#define VTE_SEQ_STRING_DEFAULT_CAPACITY (1 << 7) /* must be power of two */ +#define VTE_SEQ_STRING_MAX_CAPACITY (1 << 12) + +/* + * vte_seq_string_init: + * + * Returns: a new #vte_seq_string_t + */ +static inline void vte_seq_string_init(vte_seq_string_t* str) noexcept +{ + str->capacity = VTE_SEQ_STRING_DEFAULT_CAPACITY; + str->len = 0; + str->buf = (uint32_t*)g_malloc0_n(str->capacity, sizeof(uint32_t)); +} + +/* + * vte_seq_string_free: + * @string: + * + * Frees @string's storage and itself. + */ +static inline void vte_seq_string_free(vte_seq_string_t* str) noexcept +{ + g_free(str->buf); +} + +/* + * vte_seq_string_ensure_capacity: + * @string: + * + * If @string's length is at capacity, and capacity is not maximal, + * expands the string's capacity. + * + * Returns: %true if the string has capacity for at least one more character + */ +static inline bool vte_seq_string_ensure_capacity(vte_seq_string_t* str) noexcept +{ + if (str->len < str->capacity) + return true; + if (str->capacity >= VTE_SEQ_STRING_MAX_CAPACITY) + return false; + + str->capacity *= 2; + str->buf = (uint32_t*)g_realloc_n(str->buf, str->capacity, sizeof(uint32_t)); + return true; +} + +/* + * vte_seq_string_push: + * @string: + * @c: a character + * + * Appends @c to @str, or iff @str already has maximum length, does nothing. + * + * Returns: %true if the character was appended + */ +static inline bool vte_seq_string_push(vte_seq_string_t* str, + uint32_t c) noexcept +{ + if (!vte_seq_string_ensure_capacity(str)) + return false; + + str->buf[str->len++] = c; + return true; +} + +/* + * vte_seq_string_finish: + * @string: + * + * Finishes @string; after this no more vte_seq_string_push() calls + * are allowed until the string is reset with vte_seq_string_reset(). + */ +static inline void vte_seq_string_finish(vte_seq_string_t* str) +{ +} + +/* + * vte_seq_string_reset: + * @string: + * + * Resets @string. + */ +static inline void vte_seq_string_reset(vte_seq_string_t* str) noexcept +{ + /* Zero length. However, don't clear the buffer, nor shrink the capacity. */ + str->len = 0; +} + +/* + * vte_seq_string_get: + * @string: + * @len: location to store the buffer length in code units + * + * Returns: the string's buffer as an array of uint32_t code units + */ +static constexpr inline uint32_t* vte_seq_string_get(vte_seq_string_t const* str, + size_t* len) noexcept +{ + assert(len != nullptr); + *len = str->len; + return str->buf; +} diff -Nru vte2.91-0.52.2/src/parser-test.cc vte2.91-0.54.0/src/parser-test.cc --- vte2.91-0.52.2/src/parser-test.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/parser-test.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,1484 @@ +/* + * Copyright © 2017, 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include + +#include +#include +#include +#include +#include + +using namespace std::literals; + +#include + +#include "parser.hh" +#include "parser-glue.hh" +#include "parser-charset-tables.hh" + +#ifdef PARSER_INCLUDE_NOP +#define _VTE_NOP(...) _VTE_CMD(__VA_ARGS__) +#define _VTE_NOQ(...) _VTE_SEQ(__VA_ARGS__) +#else +#define _VTE_NOP(...) +#define _VTE_NOQ(...) +#endif + +using namespace vte::parser; + +Parser parser{}; +Sequence seq{parser}; + +#if 0 +static char const* +seq_to_str(unsigned int type) +{ + switch (type) { + case VTE_SEQ_NONE: return "NONE"; + case VTE_SEQ_IGNORE: return "IGNORE"; + case VTE_SEQ_GRAPHIC: return "GRAPHIC"; + case VTE_SEQ_CONTROL: return "CONTROL"; + case VTE_SEQ_ESCAPE: return "ESCAPE"; + case VTE_SEQ_CSI: return "CSI"; + case VTE_SEQ_DCS: return "DCS"; + case VTE_SEQ_OSC: return "OSC"; + case VTE_SEQ_APC: return "APC"; + case VTE_SEQ_PM: return "PM"; + case VTE_SEQ_SOS: return "SOS"; + case VTE_SEQ_SCI: return "SCI"; + default: + g_assert_not_reached(); + } +} + +static char const* +cmd_to_str(unsigned int command) +{ + switch (command) { +#define _VTE_CMD(cmd) case VTE_CMD_##cmd: return #cmd; +#include "parser-cmd.hh" +#undef _VTE_CMD + default: + static char buf[32]; + snprintf(buf, sizeof(buf), "UNKOWN(%u)", command); + return buf; + } +} + +static char const* +charset_to_str(unsigned int cs) +{ + switch (cs) { +#define _VTE_CHARSET_PASTE(name) case VTE_CHARSET_##name: return #name; +#define _VTE_CHARSET(name) _VTE_CHARSET_PASTE(name) +#define _VTE_CHARSET_ALIAS_PASTE(name1,name2) +#define _VTE_CHARSET_ALIAS(name1,name2) +#include "parser-charset.hh" +#undef _VTE_CHARSET_PASTE +#undef _VTE_CHARSET +#undef _VTE_CHARSET_ALIAS_PASTE +#undef _VTE_CHARSET_ALIAS + default: + static char buf[32]; + snprintf(buf, sizeof(buf), "UNKOWN(%u)", cs); + return buf; + } +} +#endif + +static const char c0str[][6] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", + "SPACE" +}; + +static const char c1str[][5] = { + "DEL", + "0x80", "0x81", "BPH", "NBH", "0x84", "NEL", "SSA", "ESA", + "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", + "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", + "SOS", "0x99", "SCI", "CSI", "ST", "OSC", "PM", "APC" +}; + +static void +print_escaped(std::u32string const& s) +{ + for (auto it : s) { + uint32_t c = (char32_t)it; + + if (c <= 0x20) + g_print("%s ", c0str[c]); + else if (c < 0x7f) + g_print("%c ", c); + else if (c < 0xa0) + g_print("%s ", c1str[c - 0x7f]); + else + g_print("U+%04X", c); + } + g_print("\n"); +} + +#if 0 +static void +print_seq() +{ + auto c = seq.terminator(); + if (seq.command() == VTE_CMD_GRAPHIC) { + char buf[7]; + buf[g_unichar_to_utf8(c, buf)] = 0; + g_print("%s U+%04X [%s]\n", cmd_to_str(seq.command()), + c, + g_unichar_isprint(c) ? buf : "�"); + } else { + g_print("%s", cmd_to_str(seq.command())); + if (seq.size()) { + g_print(" "); + for (unsigned int i = 0; i < seq.size(); i++) { + if (i > 0) + g_print(";"); + g_print("%d", seq.param(i)); + } + } + g_print("\n"); + } +} +#endif + +class vte_seq_builder : public u32SequenceBuilder { +public: + vte_seq_builder(unsigned int type, + uint32_t f) + : u32SequenceBuilder(type, f) + { + } + + vte_seq_builder(unsigned int type, + u32SequenceBuilder::string_type const& str) + : u32SequenceBuilder(type) + { + set_string(str); + } + + void set_intermediates(uint32_t* i, + unsigned int ni) noexcept + { + for (unsigned int n = 0; n < ni; ++n) + append_intermediate(i[n]); + } + + + void set_params(int* params, + unsigned int n) noexcept + { + for (unsigned int i = 0; i < n; ++i) + append_param(params[i]); + } + + void print(bool c1 = false) const noexcept + { + std::u32string s; + to_string(s, c1); + print_escaped(s); + } +}; + +static int +feed_parser(std::u32string const& s) +{ + int rv = VTE_SEQ_NONE; + for (auto it : s) { + rv = parser.feed((uint32_t)(char32_t)it); + if (rv < 0) + break; + } + return rv; +} + +static int +feed_parser(vte_seq_builder& b, + bool c1 = false) +{ + std::u32string s; + b.to_string(s, c1); + + return feed_parser(s); +} + +static void +test_seq_arg(void) +{ + /* Basic test */ + vte_seq_arg_t arg = VTE_SEQ_ARG_INIT_DEFAULT; + g_assert_false(vte_seq_arg_started(arg)); + g_assert_true(vte_seq_arg_default(arg)); + + vte_seq_arg_push(&arg, '1'); + vte_seq_arg_push(&arg, '2'); + vte_seq_arg_push(&arg, '3'); + vte_seq_arg_finish(&arg); + + g_assert_cmpint(vte_seq_arg_value(arg), ==, 123); + g_assert_false(vte_seq_arg_default(arg)); + + /* Test max value */ + arg = VTE_SEQ_ARG_INIT_DEFAULT; + vte_seq_arg_push(&arg, '6'); + vte_seq_arg_push(&arg, '5'); + vte_seq_arg_push(&arg, '5'); + vte_seq_arg_push(&arg, '3'); + vte_seq_arg_push(&arg, '6'); + vte_seq_arg_finish(&arg); + + g_assert_cmpint(vte_seq_arg_value(arg), ==, 65535); +} + +static void +test_seq_string(void) +{ + vte_seq_string_t str; + vte_seq_string_init(&str); + + size_t len; + auto buf = vte_seq_string_get(&str, &len); + g_assert_cmpuint(len, ==, 0); + + for (unsigned int i = 0; i < VTE_SEQ_STRING_MAX_CAPACITY; ++i) { + auto rv = vte_seq_string_push(&str, 0xfffdU); + g_assert_true(rv); + + buf = vte_seq_string_get(&str, &len); + g_assert_cmpuint(len, ==, i + 1); + } + + /* Try one more */ + auto rv = vte_seq_string_push(&str, 0xfffdU); + g_assert_false(rv); + + buf = vte_seq_string_get(&str, &len); + for (unsigned int i = 0; i < len; i++) + g_assert_cmpuint(buf[i], ==, 0xfffdU); + + vte_seq_string_reset(&str); + buf = vte_seq_string_get(&str, &len); + g_assert_cmpuint(len, ==, 0); + + vte_seq_string_free(&str); +} + +static void +test_seq_control(void) +{ + static struct { + uint32_t c; + unsigned int cmd; + } const controls [] = { +#define _VTE_SEQ(cmd,type,f,pi,ni,i0) { f, VTE_CMD_##cmd }, +#include "parser-c01.hh" +#undef _VTE_SEQ + }; + + for (unsigned int i = 0; i < G_N_ELEMENTS(controls); i++) { + parser.reset(); + auto rv = parser.feed(controls[i].c); + g_assert_cmpuint(rv, ==, VTE_SEQ_CONTROL); + g_assert_cmpuint(controls[i].cmd, ==, seq.command()); + } +} + +static void +test_seq_esc_invalid(void) +{ + /* Tests invalid ESC 0/n and ESC 1/n sequences, which should never result in + * an VTE_SEQ_ESCAPE type sequence, but instead always in the C0 control. + */ + for (uint32_t f = 0x0; f < 0x20; f++) { + parser.reset(); + + vte_seq_builder b{VTE_SEQ_ESCAPE, f}; + auto rv = feed_parser(b); + g_assert_cmpint(rv, !=, VTE_SEQ_ESCAPE); + } +} + +static void +test_seq_esc(uint32_t f, + uint32_t i[], + unsigned int ni) +{ + vte_seq_builder b{VTE_SEQ_ESCAPE, f}; + b.set_intermediates(i, ni); + + parser.reset(); + auto rv = feed_parser(b); + if (rv != VTE_SEQ_ESCAPE) + return; + + b.assert_equal(seq); +} + +static void +test_seq_esc_nF(void) +{ + /* Tests nF sequences, that is ESC 2/n [2/m..] F with F being 3/0..7/14. + * They could have any number of itermediates, but we only test up to 4. + */ + + uint32_t i[4]; + for (uint32_t f = 0x30; f < 0x7f; f++) { + test_seq_esc(f, i, 0); + for (i[0] = 0x20; i[0] < 0x30; i[0]++) { + test_seq_esc(f, i, 1); + for (i[1] = 0x20; i[1] < 0x30; i[1]++) { + test_seq_esc(f, i, 2); + for (i[2] = 0x20; i[2] < 0x30; i[2]++) { + test_seq_esc(f, i, 3); + for (i[3] = 0x20; i[3] < 0x30; i[3]++) { + test_seq_esc(f, i, 4); + } + } + } + } + } +} + +static void +test_seq_esc_charset(uint32_t f, /* final */ + uint32_t i[], /* intermediates */ + unsigned int ni, /* number of intermediates */ + unsigned int cmd, /* expected command */ + unsigned int cs /* expected charset */, + unsigned int slot /* expected slot */) +{ + vte_seq_builder b{VTE_SEQ_ESCAPE, f}; + b.set_intermediates(i, ni); + + parser.reset(); + auto rv = feed_parser(b); + g_assert_cmpint(rv, ==, VTE_SEQ_ESCAPE); + b.assert_equal(seq); + + g_assert_cmpint(seq.command(), ==, cmd); + g_assert_cmpint(seq.charset(), ==, cs); + g_assert_cmpint(seq.slot(), ==, slot); +} + +static void +test_seq_esc_charset(uint32_t i[], /* intermediates */ + unsigned int ni, /* number of intermediates */ + uint8_t const* const table, /* table */ + unsigned int ntable, /* number of table entries */ + uint32_t ts, /* start of table */ + unsigned int cmd, /* expected command */ + unsigned int defaultcs /* default charset */, + unsigned int slot /* expected slot */) +{ + for (uint32_t f = 0x30; f < 0x7f; f++) { + int cs; + + if (f >= ts && f < (ts + ntable)) + cs = table[f - ts]; + else + cs = defaultcs; + + test_seq_esc_charset(f, i, ni, cmd, cs, slot); + } +} + +static void +test_seq_esc_charset_94(void) +{ + uint32_t i[4]; + + /* Single byte 94-sets */ + for (i[0] = 0x28; i[0] <= 0x2b; i[0]++) { + int slot = i[0] - 0x28; + + test_seq_esc_charset(i, 1, + charset_graphic_94, + G_N_ELEMENTS(charset_graphic_94), + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x20; + test_seq_esc_charset(i, 2, nullptr, 0, 0, + VTE_CMD_GnDm, VTE_CHARSET_DRCS, slot); + + i[1] = 0x21; + test_seq_esc_charset(i, 2, + charset_graphic_94_with_2_1, + G_N_ELEMENTS(charset_graphic_94_with_2_1), + 0x40, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x22; + test_seq_esc_charset(i, 2, + charset_graphic_94_with_2_2, + G_N_ELEMENTS(charset_graphic_94_with_2_2), + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x23; + test_seq_esc_charset(i, 2, nullptr, 0, + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + /* 2/4 is multibyte charsets */ + + i[1] = 0x25; + test_seq_esc_charset(i, 2, + charset_graphic_94_with_2_5, + G_N_ELEMENTS(charset_graphic_94_with_2_5), + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x26; + test_seq_esc_charset(i, 2, + charset_graphic_94_with_2_6, + G_N_ELEMENTS(charset_graphic_94_with_2_6), + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x27; + test_seq_esc_charset(i, 2, nullptr, 0, 0, + VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + } +} + +static void +test_seq_esc_charset_96(void) +{ + uint32_t i[4]; + + /* Single byte 96-sets */ + for (i[0] = 0x2d; i[0] <= 0x2f; i[0]++) { + int slot = i[0] - 0x2c; + + test_seq_esc_charset(i, 1, + charset_graphic_96, + G_N_ELEMENTS(charset_graphic_96), + 0x30, VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + + i[1] = 0x20; + test_seq_esc_charset(i, 2, nullptr, 0, 0, + VTE_CMD_GnDm, VTE_CHARSET_DRCS, slot); + + /* 2/4 is multibyte charsets, 2/5 is DOCS. Other indermediates may be present + * in Fp sequences, but none are actually in use. + */ + for (i[1] = 0x21; i[1] < 0x28; i[1]++) { + if (i[1] == 0x24 || i[1] == 0x25) + continue; + + test_seq_esc_charset(i, 2, nullptr, 0, 0, + VTE_CMD_GnDm, VTE_CHARSET_NONE, slot); + } + } +} + +static void +test_seq_esc_charset_94_n(void) +{ + uint32_t i[4]; + + /* Multibyte 94-sets */ + i[0] = 0x24; + for (i[1] = 0x28; i[1] <= 0x2b; i[1]++) { + int slot = i[1] - 0x28; + + test_seq_esc_charset(i, 2, + charset_graphic_94_n, + G_N_ELEMENTS(charset_graphic_94_n), + 0x30, VTE_CMD_GnDMm, VTE_CHARSET_NONE, slot); + + i[2] = 0x20; + test_seq_esc_charset(i, 3, nullptr, 0, 0, + VTE_CMD_GnDMm, VTE_CHARSET_DRCS, slot); + + /* There could be one more intermediate byte. */ + for (i[2] = 0x21; i[2] < 0x28; i[2]++) { + if (i[2] == 0x24) /* TODO */ + continue; + + test_seq_esc_charset(i, 3, nullptr, 0, 0, + VTE_CMD_GnDMm, VTE_CHARSET_NONE, slot); + } + } + + /* As a special exception, ESC 2/4 4/[012] are also possible */ + test_seq_esc_charset(0x40, i, 1, VTE_CMD_GnDMm, charset_graphic_94_n[0x40 - 0x30], 0); + test_seq_esc_charset(0x41, i, 1, VTE_CMD_GnDMm, charset_graphic_94_n[0x41 - 0x30], 0); + test_seq_esc_charset(0x42, i, 1, VTE_CMD_GnDMm, charset_graphic_94_n[0x42 - 0x30], 0); +} + +static void +test_seq_esc_charset_96_n(void) +{ + uint32_t i[4]; + + /* Multibyte 94-sets */ + i[0] = 0x24; + for (i[1] = 0x2d; i[1] <= 0x2f; i[1]++) { + int slot = i[1] - 0x2c; + + test_seq_esc_charset(i, 2, nullptr, 0, 0, + VTE_CMD_GnDMm, VTE_CHARSET_NONE, slot); + + i[2] = 0x20; + test_seq_esc_charset(i, 3, nullptr, 0, 0, + VTE_CMD_GnDMm, VTE_CHARSET_DRCS, slot); + + /* There could be one more intermediate byte. */ + for (i[2] = 0x21; i[2] < 0x28; i[2]++) { + test_seq_esc_charset(i, 3, nullptr, 0, 0, + VTE_CMD_GnDMm, VTE_CHARSET_NONE, slot); + } + } +} + +static void +test_seq_esc_charset_control(void) +{ + uint32_t i[4]; + + /* C0 controls: ESC 2/1 F */ + i[0] = 0x21; + test_seq_esc_charset(i, 1, + charset_control_c0, + G_N_ELEMENTS(charset_control_c0), + 0x40, VTE_CMD_CnD, VTE_CHARSET_NONE, 0); + + /* C1 controls: ESC 2/2 F */ + i[0] = 0x22; + test_seq_esc_charset(i, 1, + charset_control_c1, + G_N_ELEMENTS(charset_control_c1), + 0x40, VTE_CMD_CnD, VTE_CHARSET_NONE, 1); +} + +static void +test_seq_esc_charset_other(void) +{ + uint32_t i[4]; + + /* Other coding systems: ESC 2/5 F or ESC 2/5 2/15 F */ + i[0] = 0x25; + test_seq_esc_charset(i, 1, + charset_ocs_with_return, + G_N_ELEMENTS(charset_ocs_with_return), + 0x40, VTE_CMD_DOCS, VTE_CHARSET_NONE, 0); + + i[1] = 0x2f; + test_seq_esc_charset(i, 2, + charset_ocs_without_return, + G_N_ELEMENTS(charset_ocs_without_return), + 0x40, VTE_CMD_DOCS, VTE_CHARSET_NONE, 0); +} + +static void +test_seq_esc_Fpes(void) +{ + /* Tests Fp, Fe and Ft sequences, that is ESC 3/n .. ESC 7/14 */ + + for (uint32_t f = 0x30; f < 0x7f; f++) { + parser.reset(); + + vte_seq_builder b{VTE_SEQ_ESCAPE, f}; + + auto rv = feed_parser(b); + int expected_rv; + switch (f) { + case 'P': /* DCS */ + case 'X': /* SOS */ + case 'Z': /* SCI */ + case '_': /* APC */ + case '[': /* CSI */ + case ']': /* OSC */ + case '^': /* PM */ + expected_rv = VTE_SEQ_NONE; + break; + default: + expected_rv = VTE_SEQ_ESCAPE; + break; + } + g_assert_cmpint(rv, ==, expected_rv); + if (rv != VTE_SEQ_NONE) + b.assert_equal(seq); + } +} + +static void +test_seq_esc_known(uint32_t f, + uint32_t i, + unsigned int cmd) +{ + vte_seq_builder b{VTE_SEQ_ESCAPE, f}; + if (i != 0) + b.set_intermediates(&i, 1); + + auto rv = feed_parser(b); + g_assert_cmpint(rv, ==, VTE_SEQ_ESCAPE); + g_assert_cmpint(seq.command(), ==, cmd); +} + +static void +test_seq_esc_known(void) +{ + parser.reset(); + +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + test_seq_esc_known(f, VTE_SEQ_INTERMEDIATE_CHAR_##i, VTE_CMD_##cmd); +#include "parser-esc.hh" +#undef _VTE_SEQ +} + +static void +test_seq_csi(uint32_t f, + uint32_t p, + vte_seq_arg_t params[16], + uint32_t i[4], + unsigned int ni) +{ + vte_seq_builder b{VTE_SEQ_CSI, f}; + b.set_intermediates(i, ni); + b.set_param_intro(p); + + int expected_rv = (f & 0xF0) == 0x30 ? VTE_SEQ_NONE : VTE_SEQ_CSI; + + for (unsigned int n = 0; n <= 16; n++) { + b.reset_params(); + b.set_params(params, n); + + parser.reset(); + /* First with C0 CSI */ + auto rv = feed_parser(b, false); + g_assert_cmpint(rv, ==, expected_rv); + if (rv != VTE_SEQ_NONE) + b.assert_equal_full(seq); + + /* Now with C1 CSI */ + rv = feed_parser(b, true); + if (rv != VTE_SEQ_NONE) + b.assert_equal_full(seq); + } +} + +static void +test_seq_csi(uint32_t p, + vte_seq_arg_t params[16]) +{ + uint32_t i[4]; + for (uint32_t f = 0x30; f < 0x7f; f++) { + test_seq_csi(f, p, params, i, 0); + for (i[0] = 0x20; i[0] < 0x30; i[0]++) { + test_seq_csi(f, p, params, i, 1); + for (i[1] = 0x20; i[1] < 0x30; i[1]++) { + test_seq_csi(f, p, params, i, 2); + } + } + } +} + +static void +test_seq_csi(vte_seq_arg_t params[16]) +{ + test_seq_csi(0, params); + for (uint32_t p = 0x3c; p <= 0x3f; p++) + test_seq_csi(p, params); +} + +static void +test_seq_csi(void) +{ + /* Tests CSI sequences, that is sequences of the form + * CSI P...P I...I F + * with parameter bytes P from 3/0..3/15, intermediate bytes I from 2/0..2/15 and + * final byte F from 4/0..7/14. + * There could be any number of intermediate bytes, but we only test up to 2. + * There could be any number of extra params bytes, but we only test up to 1. + * CSI can be either the C1 control itself, or ESC [ + */ + vte_seq_arg_t params1[16]{ -1, 0, 1, 9, 10, 99, 100, 999, + 1000, 9999, 10000, 65534, 65535, 65536, -1, -1 }; + test_seq_csi(params1); + + vte_seq_arg_t params2[16]{ 1, -1, -1, -1, 1, -1, 1, 1, + 1, -1, -1, -1, -1, 1, 1, 1 }; + test_seq_csi(params2); +} + +static void +test_seq_sci(uint32_t f, + bool valid) +{ + vte_seq_builder b{VTE_SEQ_SCI, f}; + + /* First with C0 SCI */ + auto rv = feed_parser(b, false); + if (valid) { + g_assert_cmpint(rv, ==, VTE_SEQ_SCI); + b.assert_equal_full(seq); + } else + g_assert_cmpint(rv, !=, VTE_SEQ_SCI); + + /* Now with C1 SCI */ + rv = feed_parser(b, true); + if (valid) { + g_assert_cmpint(rv, ==, VTE_SEQ_SCI); + b.assert_equal_full(seq); + } else + g_assert_cmpint(rv, !=, VTE_SEQ_SCI); +} + +static void +test_seq_sci(void) +{ + /* Tests SCI sequences, that is sequences of the form SCI F + * with final byte 0/8..0/13 or 2/0..7/14 + * SCI can be either the C1 control itself, or ESC Z + */ + parser.reset(); + + for (uint32_t f = 0x8; f <= 0xd; ++f) + test_seq_sci(f, true); + for (uint32_t f = 0x20; f <= 0x7e; ++f) + test_seq_sci(f, true); + for (uint32_t f = 0x7f; f <= 0xff; ++f) + test_seq_sci(f, false); +} + +static void +test_seq_csi_known(uint32_t f, + uint32_t p, + uint32_t i, + unsigned int cmd) +{ + vte_seq_builder b{VTE_SEQ_CSI, f}; + if (p != 0) + b.set_param_intro(p); + if (i != 0) + b.set_intermediates(&i, 1); + + auto rv = feed_parser(b); + g_assert_cmpint(rv, ==, VTE_SEQ_CSI); + g_assert_cmpint(seq.command(), ==, cmd); +} + +static void +test_seq_csi_known(void) +{ + parser.reset(); + +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + test_seq_csi_known(f, VTE_SEQ_PARAMETER_CHAR_##p, VTE_SEQ_INTERMEDIATE_CHAR_##i, VTE_CMD_##cmd); +#include "parser-csi.hh" +#undef _VTE_SEQ +} + +static void +test_seq_dcs(uint32_t f, + uint32_t p, + vte_seq_arg_t params[16], + uint32_t i[4], + unsigned int ni, + std::u32string const& str, + int expected_rv = VTE_SEQ_DCS) +{ + vte_seq_builder b{VTE_SEQ_DCS, f}; + b.set_intermediates(i, ni); + b.set_param_intro(p); + b.set_string(str); + + int expected_rv0 = (f & 0xF0) == 0x30 || expected_rv == VTE_SEQ_NONE ? VTE_SEQ_ESCAPE /* the C0 ST */ : expected_rv; + int expected_rv1 = (f & 0xF0) == 0x30 ? VTE_SEQ_NONE : expected_rv; + + for (unsigned int n = 0; n <= 16; n++) { + b.reset_params(); + b.set_params(params, n); + + parser.reset(); + + /* First with C0 DCS */ + auto rv0 = feed_parser(b, false); + g_assert_cmpint(rv0, ==, expected_rv0); + if (rv0 != VTE_SEQ_ESCAPE && rv0 != VTE_SEQ_NONE) + b.assert_equal_full(seq); + if (rv0 == VTE_SEQ_ESCAPE) + g_assert_cmpint(seq.command(), ==, VTE_CMD_ST); + + /* Now with C1 DCS */ + auto rv1 = feed_parser(b, true); + g_assert_cmpint(rv1, ==, expected_rv1); + if (rv1 != VTE_SEQ_NONE) + b.assert_equal_full(seq); + } +} + +static void +test_seq_dcs(uint32_t p, + vte_seq_arg_t params[16], + std::u32string const& str, + int expected_rv = VTE_SEQ_DCS) +{ + uint32_t i[4]; + for (uint32_t f = 0x40; f < 0x7f; f++) { + test_seq_dcs(f, p, params, i, 0, str, expected_rv); + } + + for (uint32_t f = 0x30; f < 0x7f; f++) { + for (i[0] = 0x20; i[0] < 0x30; i[0]++) { + test_seq_dcs(f, p, params, i, 1, str, expected_rv); + for (i[1] = 0x20; i[1] < 0x30; i[1]++) { + test_seq_dcs(f, p, params, i, 2, str, expected_rv); + } + } + } +} + +static void +test_seq_dcs(vte_seq_arg_t params[16], + std::u32string const& str, + int expected_rv = VTE_SEQ_DCS) +{ + test_seq_dcs(0, params, str); + for (uint32_t p = 0x3c; p <= 0x3f; p++) + test_seq_dcs(p, params, str, expected_rv); +} + +static void +test_seq_dcs(std::u32string const& str, + int expected_rv = VTE_SEQ_DCS) +{ + /* Tests DCS sequences, that is sequences of the form + * DCS P...P I...I F D...D ST + * with parameter bytes P from 3/0..3/15, intermediate bytes I from 2/0..2/15 and + * final byte F from 4/0..7/14. + * There could be any number of intermediate bytes, but we only test up to 2. + * There could be any number of extra params bytes, but we only test up to 1. + * DCS can be either the C1 control itself, or ESC [; ST can be either the C1 + * control itself, or ESC \\ + */ + vte_seq_arg_t params1[16]{ -1, 0, 1, 9, 10, 99, 100, 999, + 1000, 9999, 10000, 65534, 65535, 65536, -1, -1 }; + test_seq_dcs(params1, str, expected_rv); + + vte_seq_arg_t params2[16]{ 1, -1, -1, -1, 1, -1, 1, 1, + 1, -1, -1, -1, -1, 1, 1, 1 }; + test_seq_dcs(params2, str, expected_rv); +} + +static void +test_seq_dcs_simple(std::u32string const& str, + int expected_rv = VTE_SEQ_DCS) +{ + vte_seq_arg_t params[16]{ 1, -1, -1, -1, 1, -1, 1, 1, + 1, -1, -1, -1, -1, 1, 1, 1 }; + uint32_t i[4]; + + test_seq_dcs(0x40, 0, params, i, 0, str, expected_rv); +} + +static void +test_seq_dcs(void) +{ + /* Length exceeded */ + test_seq_dcs_simple(std::u32string(VTE_SEQ_STRING_MAX_CAPACITY + 1, 0x100000), VTE_SEQ_NONE); + + test_seq_dcs(U""s); + test_seq_dcs(U"123;TESTING"s); +} + +static void +test_seq_dcs_known(uint32_t f, + uint32_t p, + uint32_t i, + unsigned int cmd) +{ + vte_seq_builder b{VTE_SEQ_DCS, f}; + if (p != 0) + b.set_param_intro(p); + if (i != 0) + b.set_intermediates(&i, 1); + + auto rv = feed_parser(b); + g_assert_cmpint(rv, ==, VTE_SEQ_DCS); + g_assert_cmpint(seq.command(), ==, cmd); +} + +static void +test_seq_dcs_known(void) +{ + parser.reset(); + +#define _VTE_SEQ(cmd,type,f,p,ni,i) \ + test_seq_dcs_known(f, VTE_SEQ_PARAMETER_CHAR_##p, VTE_SEQ_INTERMEDIATE_CHAR_##i, VTE_CMD_##cmd); +#include "parser-dcs.hh" +#undef _VTE_SEQ +} + +static void +test_seq_parse(char const* str) +{ + std::u32string s; + s.push_back(0x9B); /* CSI */ + for (unsigned int i = 0; str[i]; i++) + s.push_back(str[i]); + s.push_back(0x6d); /* m = SGR */ + + parser.reset(); + auto rv = feed_parser(s); + g_assert_cmpint(rv, ==, VTE_SEQ_CSI); +} + +static void +test_seq_csi_param(char const* str, + std::vector args, + std::vector args_nonfinal) +{ + g_assert_cmpuint(args.size(), ==, args_nonfinal.size()); + + test_seq_parse(str); + + if (seq.size() < VTE_PARSER_ARG_MAX) + g_assert_cmpuint(seq.size(), ==, args.size()); + + unsigned int n_final_args = 0; + for (unsigned int i = 0; i < seq.size(); i++) { + g_assert_cmpint(seq.param(i), ==, args[i]); + + auto is_nonfinal = args_nonfinal[i]; + if (!is_nonfinal) + n_final_args++; + + g_assert_cmpint(seq.param_nonfinal(i), ==, is_nonfinal); + } + + g_assert_cmpuint(seq.size_final(), ==, n_final_args); +} + +static void +test_seq_csi_param(void) +{ + /* Tests that CSI parameters and subparameters are parsed correctly. */ + + test_seq_csi_param("", { }, { }); + test_seq_csi_param(";", { -1, -1 }, { false, false }); + test_seq_csi_param(":", { -1, -1 }, { true, false }); + test_seq_csi_param(";:", { -1, -1, -1 }, { false, true, false }); + test_seq_csi_param("::;;", { -1, -1, -1, -1, -1 }, { true, true, false, false, false }); + + test_seq_csi_param("1;2:3:4:5:6;7:8;9:0", + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, + { false, true, true, true, true, false, true, false, true, false }); + + test_seq_csi_param("1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1", + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false }); + + test_seq_csi_param("1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1", + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, false }); + +} + +static void +test_seq_csi_clear(void) +{ + /* Check that parameters are cleared from when a sequence was aborted. */ + + vte_seq_builder b0{VTE_SEQ_CSI, 'm'}; + b0.set_param_intro(VTE_SEQ_PARAMETER_CHAR_WHAT); + for (unsigned int i = 0; i < VTE_PARSER_ARG_MAX; ++i) + b0.append_param(127 * i + 17); + + std::u32string str0; + b0.to_string(str0); + + parser.reset(); + for (size_t len0 = 1; len0 <= str0.size(); ++len0) { + for (unsigned int n_args = 0; n_args < VTE_PARSER_ARG_MAX; ++n_args) { + feed_parser(str0.substr(0, len0)); + + vte_seq_builder b1{VTE_SEQ_CSI, 'n'}; + b1.set_param_intro(VTE_SEQ_PARAMETER_CHAR_GT); + for (unsigned int i = 0; i < n_args; ++i) + b1.append_param(257 * i + 31); + + std::u32string str1; + b1.to_string(str1); + + auto rv = feed_parser(str1); + g_assert_cmpint(rv, ==, VTE_SEQ_CSI); + b1.assert_equal_full(seq); + for (unsigned int n = seq.size(); n < VTE_PARSER_ARG_MAX; n++) + g_assert_true(seq.param_default(n)); + } + } +} + +static void +test_seq_csi_max(std::u32string const& start, + std::u32string const& more, + int expected_rv = VTE_SEQ_NONE) +{ + parser.reset(); + feed_parser(start); + feed_parser(more); + auto rv = feed_parser(U"m"s); /* final character */ + g_assert_cmpint(rv, ==, expected_rv); +} + +static void +test_seq_csi_max(void) +{ + /* Check that an excessive number of parameters causes the + * sequence to be ignored. + * + * Since SequenceBuilder is limited in the same number of + * parameters as the parser, can't use it directly to + * produce a sequence with too may parameters. + */ + + vte_seq_builder b{VTE_SEQ_CSI, 'm'}; + b.set_param_intro(VTE_SEQ_PARAMETER_CHAR_WHAT); + for (unsigned int i = 0; i < VTE_PARSER_ARG_MAX; ++i) + b.append_param(i); + + std::u32string str; + b.to_string(str); + + /* The sequence with VTE_PARSER_ARG_MAX args must be parsed */ + auto rv = feed_parser(str); + g_assert_cmpint(rv, ==, VTE_SEQ_CSI); + + /* Now test that adding one more parameter (whether with an + * explicit value, or default, causes the sequence to be ignored. + */ + str.pop_back(); /* erase final character */ + test_seq_csi_max(str, U":"s); + test_seq_csi_max(str, U";"s); + test_seq_csi_max(str, U":12345"s); + test_seq_csi_max(str, U";12345"s); + test_seq_csi_max(str, U":12345;"s); + test_seq_csi_max(str, U";12345:"s); + test_seq_csi_max(str, U":12345;"s); + test_seq_csi_max(str, U":12345:"s); +} + +static void +test_seq_glue_arg(char const* str, + unsigned int n_args, + unsigned int n_final_args) +{ + test_seq_parse(str); + + auto raw_seq = *seq.seq_ptr(); + g_assert_cmpuint(seq.size(), ==, n_args); + g_assert_cmpuint(raw_seq->n_args, ==, n_args); + g_assert_cmpuint(seq.size_final(), ==, n_final_args); + g_assert_cmpuint(raw_seq->n_final_args, ==, n_final_args); + + g_assert_cmpuint(seq.type(), ==, raw_seq->type); + g_assert_cmpuint(seq.command(), ==, raw_seq->command); + g_assert_cmpuint(seq.terminator(), ==, raw_seq->terminator); + + for (unsigned int i = 0; i < raw_seq->n_args; i++) + g_assert_cmpuint(seq.param(i), ==, vte_seq_arg_value(raw_seq->args[i])); +} + +static void +test_seq_glue_arg(void) +{ + test_seq_glue_arg(":0:1000;2;3;4;:;", 9, 6); + g_assert_cmpuint(seq.cbegin(), ==, 0); + g_assert_cmpuint(seq.cend(), ==, 9); + + auto it = seq.cbegin(); + g_assert_cmpuint(it, ==, 0); + it = seq.next(it); + g_assert_cmpuint(it, ==, 3); + it = seq.next(it); + g_assert_cmpuint(it, ==, 4); + it = seq.next(it); + g_assert_cmpuint(it, ==, 5); + it = seq.next(it); + g_assert_cmpuint(it, ==, 6); + it = seq.next(it); + g_assert_cmpuint(it, ==, 8); + it = seq.next(it); + g_assert_cmpuint(it, ==, 9); + + it = seq.cbegin(); + g_assert_cmpint(seq.param(it++), ==, -1); + g_assert_cmpint(seq.param(it++), ==, 0); + g_assert_cmpint(seq.param(it++), ==, 1000); + g_assert_cmpint(seq.param(it++), ==, 2); + g_assert_cmpint(seq.param(it++), ==, 3); + g_assert_cmpint(seq.param(it++), ==, 4); + g_assert_cmpint(seq.param(it++), ==, -1); + g_assert_cmpint(seq.param(it++), ==, -1); + g_assert_cmpint(seq.param(it++), ==, -1); + g_assert_cmpint(it, ==, seq.cend()); + + it = seq.cbegin(); + g_assert_cmpint(seq.param(it, -2), ==, -2); + g_assert_cmpint(seq.param(it, -2, 0, 100), ==, 0); + it++; it++; + g_assert_cmpint(seq.param(it, -2), ==, seq.param(it)); + g_assert_cmpint(seq.param(it, -2, 20, 100), ==, 100); + g_assert_cmpint(seq.param(it, -2, 200, 2000), ==, 1000); + g_assert_cmpint(seq.param(it, -2, 2000, 4000), ==, 2000); + + int a, b, c,d ; + it = seq.cbegin(); + g_assert_false(seq.collect(it, {&a, &b, &c})); + g_assert_true(seq.collect_subparams(it, {&a})); + g_assert_true(seq.collect_subparams(it, {&a, &b})); + g_assert_true(seq.collect_subparams(it, {&a, &b, &c})); + g_assert_cmpint(a, ==, -1); + g_assert_cmpint(b, ==, 0); + g_assert_cmpint(c, ==, 1000); + g_assert_false(seq.collect_subparams(it, {&a, &b, &c, &d})); + + it = seq.next(it); + g_assert_true(seq.collect(it, {&a})); + g_assert_true(seq.collect(it, {&a, &b})); + g_assert_true(seq.collect(it, {&a, &b, &c})); + g_assert_cmpint(a, ==, 2); + g_assert_cmpint(b, ==, 3); + g_assert_cmpint(c, ==, 4); + g_assert_false(seq.collect(it, {&a, &b, &c, &d})); + + it = seq.next(it); + it = seq.next(it); + it = seq.next(it); + g_assert_false(seq.collect(it, {&a})); + g_assert_true(seq.collect_subparams(it, {&a})); + g_assert_true(seq.collect_subparams(it, {&a, &b})); + g_assert_cmpint(a, ==, -1); + g_assert_cmpint(b, ==, -1); + g_assert_false(seq.collect_subparams(it, {&a, &b, &c})); + it = seq.next(it); + g_assert_true(seq.collect(it, {&a})); + g_assert_cmpint(a, ==, -1); + g_assert_true(seq.collect(it, {&a, &b})); /* past-the-end params are final and default */ + g_assert_cmpint(a, ==, -1); + g_assert_cmpint(b, ==, -1); + g_assert_true(seq.collect(it, {&a, &b, &c})); /* past-the-end params are final and default */ + g_assert_cmpint(a, ==, -1); + g_assert_cmpint(b, ==, -1); + g_assert_cmpint(c, ==, -1); + + it = seq.cbegin(); + g_assert_cmpint(seq.collect1(it, -2), ==, -2); + it = seq.next(it); + g_assert_cmpint(seq.collect1(it), ==, 2); + g_assert_cmpint(seq.collect1(it), ==, 2); + it = seq.next(it); + g_assert_cmpint(seq.collect1(it), ==, 3); + it = seq.next(it); + g_assert_cmpint(seq.collect1(it), ==, 4); + it = seq.next(it); + g_assert_cmpint(seq.collect1(it, -3), ==, -3); + it = seq.next(it); + g_assert_cmpint(seq.collect1(it), ==, -1); + g_assert_cmpint(seq.collect1(it, 42), ==, 42); + g_assert_cmpint(seq.collect1(it, -1, 0, 100), ==, 0); + g_assert_cmpint(seq.collect1(it, 42, 0, 100), ==, 42); + g_assert_cmpint(seq.collect1(it, 42, 0, 10), ==, 10); + g_assert_cmpint(seq.collect1(it, 42, 100, 200), ==, 100); +} + +static int +feed_parser_st(vte_seq_builder& b, + bool c1 = false, + ssize_t max_arg_str_len = -1, + u32SequenceBuilder::Introducer introducer = u32SequenceBuilder::Introducer::DEFAULT, + u32SequenceBuilder::ST st = u32SequenceBuilder::ST::DEFAULT) +{ + std::u32string s; + b.to_string(s, c1, max_arg_str_len, introducer, st); + + auto rv = feed_parser(s); + if (rv != VTE_SEQ_OSC) + return rv; + + switch (st) { + case u32SequenceBuilder::ST::NONE: + g_assert_cmpuint(seq.terminator(), ==, 0); + break; + case u32SequenceBuilder::ST::DEFAULT: + g_assert_cmpuint(seq.terminator(), ==, c1 ? 0x9c /* ST */ : 0x5c /* BACKSLASH */); + break; + case u32SequenceBuilder::ST::C0: + g_assert_cmpuint(seq.terminator(), ==, 0x5c /* BACKSLASH */); + break; + case u32SequenceBuilder::ST::C1: + g_assert_cmpuint(seq.terminator(), ==, 0x9c /* ST */); + break; + case u32SequenceBuilder::ST::BEL: + g_assert_cmpuint(seq.terminator(), ==, 0x7 /* BEL */); + break; + } + + return rv; +} + +static void +test_seq_osc(std::u32string const& str, + int expected_rv = VTE_SEQ_OSC, + bool c1 = true, + ssize_t max_arg_str_len = -1, + u32SequenceBuilder::Introducer introducer = u32SequenceBuilder::Introducer::DEFAULT, + u32SequenceBuilder::ST st = u32SequenceBuilder::ST::DEFAULT) +{ + vte_seq_builder b{VTE_SEQ_OSC, str}; + + parser.reset(); + auto rv = feed_parser_st(b, c1, max_arg_str_len, introducer, st); + g_assert_cmpint(rv, ==, expected_rv); + #if 0 + if (rv != VTE_SEQ_NONE) + b.assert_equal(seq); + #endif + + if (expected_rv != VTE_SEQ_OSC) + return; + + if (max_arg_str_len < 0 || size_t(max_arg_str_len) == str.size()) + g_assert_true(seq.string() == str); + else + g_assert_true(seq.string() == str.substr(0, max_arg_str_len)); +} + +static int +controls_match(bool c1, + u32SequenceBuilder::Introducer introducer, + u32SequenceBuilder::ST st, + bool allow_bel, + int expected_rv) +{ + if (introducer == u32SequenceBuilder::Introducer::DEFAULT) + introducer = c1 ? u32SequenceBuilder::Introducer::C1 : u32SequenceBuilder::Introducer::C0; + if (st == u32SequenceBuilder::ST::DEFAULT) + st = c1 ? u32SequenceBuilder::ST::C1 : u32SequenceBuilder::ST::C0; + if ((introducer == u32SequenceBuilder::Introducer::C0 && + (st == u32SequenceBuilder::ST::C0 || (allow_bel && st == u32SequenceBuilder::ST::BEL))) || + (introducer == u32SequenceBuilder::Introducer::C1 && + st == u32SequenceBuilder::ST::C1)) + return expected_rv; + return VTE_SEQ_IGNORE; +} + +static void +test_seq_osc(void) +{ + /* Simple */ + test_seq_osc(U""s); + test_seq_osc(U"TEST"s); + + /* String of any supported length */ + for (unsigned int len = 0; len < VTE_SEQ_STRING_MAX_CAPACITY; ++len) + test_seq_osc(std::u32string(len, 0x10000+len)); + + /* Length exceeded */ + test_seq_osc(std::u32string(VTE_SEQ_STRING_MAX_CAPACITY + 1, 0x100000), VTE_SEQ_IGNORE); + + /* Test all introducer/ST combinations */ + for (auto introducer : { u32SequenceBuilder::Introducer::DEFAULT, + u32SequenceBuilder::Introducer::C0, + u32SequenceBuilder::Introducer::C1 }) { + for (auto st : {u32SequenceBuilder::ST::DEFAULT, + u32SequenceBuilder::ST::C0, + u32SequenceBuilder::ST::C1, + u32SequenceBuilder::ST::BEL }) { + for (auto c1 : { false, true }) { + int expected_rv = controls_match(c1, introducer, st, true, VTE_SEQ_OSC); + test_seq_osc(U"TEST"s, expected_rv, c1, -1, introducer, st); + } + } + } +} + +static void +test_seq_glue_string(void) +{ + std::u32string str{U"TEST"s}; + test_seq_osc(str); + + g_assert_true(seq.string() == str); +} + +static void +test_seq_glue_string_tokeniser(void) +{ + std::string str{"a;1b:17:test::b:;3;5;def;17 a;ghi;"s}; + + StringTokeniser tokeniser{str, ';'}; + + auto start = tokeniser.cbegin(); + auto end = tokeniser.cend(); + + auto pit = start; + for (auto it : {"a"s, "1b:17:test::b:"s, "3"s, "5"s, "def"s, "17 a"s, "ghi"s, ""s}) { + g_assert_true(it == *pit); + + /* Use std::find to see if the InputIterator implementation + * is complete and correct. + */ + auto fit = std::find(start, end, it); + g_assert_true(fit == pit); + + ++pit; + } + g_assert_true(pit == end); + + auto len = str.size(); + size_t pos = 0; + pit = start; + for (auto it : {1, 14, 1, 1, 3, 4, 3, 0}) { + g_assert_cmpuint(it, ==, pit.size()); + g_assert_cmpuint(len, ==, pit.size_remaining()); + + g_assert_true(pit.string_remaining() == str.substr(pos, std::string::npos)); + + len -= it + 1; + pos += it + 1; + + ++pit; + } + g_assert_cmpuint(len + 1, ==, 0); + g_assert_cmpuint(pos, ==, str.size() + 1); + + pit = start; + for (auto it : {-2, -2, 3, 5, -2, -2, -2, -1}) { + int num; + bool v = pit.number(num); + if (it == -2) + g_assert_false(v); + else + g_assert_cmpint(it, ==, num); + + ++pit; + } + + /* Test range for */ + for (auto it : tokeniser) + ; + + /* Test different separator */ + pit = start; + ++pit; + + auto substr = *pit; + StringTokeniser subtokeniser{substr, ':'}; + + auto subpit = subtokeniser.cbegin(); + for (auto it : {"1b"s, "17"s, "test"s, ""s, "b"s, ""s}) { + g_assert_true(it == *subpit); + + ++subpit; + } + g_assert_true(subpit == subtokeniser.cend()); + + /* Test another string, one that doesn't end with an empty token */ + std::string str2{"abc;defghi"s}; + StringTokeniser tokeniser2{str2, ';'}; + + g_assert_cmpint(std::distance(tokeniser2.cbegin(), tokeniser2.cend()), ==, 2); + auto pit2 = tokeniser2.cbegin(); + g_assert_true(*pit2 == "abc"s); + ++pit2; + g_assert_true(*pit2 == "defghi"s); + ++pit2; + g_assert_true(pit2 == tokeniser2.cend()); + + /* Test another string, one that starts with an empty token */ + std::string str3{";abc"s}; + StringTokeniser tokeniser3{str3, ';'}; + + g_assert_cmpint(std::distance(tokeniser3.cbegin(), tokeniser3.cend()), ==, 2); + auto pit3 = tokeniser3.cbegin(); + g_assert_true(*pit3 == ""s); + ++pit3; + g_assert_true(*pit3 == "abc"s); + ++pit3; + g_assert_true(pit3 == tokeniser3.cend()); + + /* And try an empty string, which should split into one empty token */ + std::string str4{""s}; + StringTokeniser tokeniser4{str4, ';'}; + + g_assert_cmpint(std::distance(tokeniser4.cbegin(), tokeniser4.cend()), ==, 1); + auto pit4 = tokeniser4.cbegin(); + g_assert_true(*pit4 == ""s); + ++pit4; + g_assert_true(pit4 == tokeniser4.cend()); +} + +static void +test_seq_glue_sequence_builder(void) +{ + /* This is sufficiently tested by being used in all the other tests, + * but if there's anything remaining to be tested, do it here. + */ +} + +static void +test_seq_glue_reply_builder(void) +{ + /* Nothing to test here; ReplyBuilder is just a constructor for + * SequenceBuilder. + */ +} + +int +main(int argc, + char* argv[]) +{ + g_test_init(&argc, &argv, nullptr); + + g_test_add_func("/vte/parser/sequences/arg", test_seq_arg); + g_test_add_func("/vte/parser/sequences/string", test_seq_string); + g_test_add_func("/vte/parser/sequences/glue/arg", test_seq_glue_arg); + g_test_add_func("/vte/parser/sequences/glue/string", test_seq_glue_string); + g_test_add_func("/vte/parser/sequences/glue/string-tokeniser", test_seq_glue_string_tokeniser); + g_test_add_func("/vte/parser/sequences/glue/sequence-builder", test_seq_glue_sequence_builder); + g_test_add_func("/vte/parser/sequences/glue/reply-builder", test_seq_glue_reply_builder); + g_test_add_func("/vte/parser/sequences/control", test_seq_control); + g_test_add_func("/vte/parser/sequences/escape/invalid", test_seq_esc_invalid); + g_test_add_func("/vte/parser/sequences/escape/charset/94", test_seq_esc_charset_94); + g_test_add_func("/vte/parser/sequences/escape/charset/96", test_seq_esc_charset_96); + g_test_add_func("/vte/parser/sequences/escape/charset/94^n", test_seq_esc_charset_94_n); + g_test_add_func("/vte/parser/sequences/escape/charset/96^n", test_seq_esc_charset_96_n); + g_test_add_func("/vte/parser/sequences/escape/charset/control", test_seq_esc_charset_control); + g_test_add_func("/vte/parser/sequences/escape/charset/other", test_seq_esc_charset_other); + g_test_add_func("/vte/parser/sequences/escape/nF", test_seq_esc_nF); + g_test_add_func("/vte/parser/sequences/escape/F[pes]", test_seq_esc_Fpes); + g_test_add_func("/vte/parser/sequences/escape/known", test_seq_esc_known); + g_test_add_func("/vte/parser/sequences/csi", test_seq_csi); + g_test_add_func("/vte/parser/sequences/csi/known", test_seq_csi_known); + g_test_add_func("/vte/parser/sequences/csi/parameters", test_seq_csi_param); + g_test_add_func("/vte/parser/sequences/csi/clear", test_seq_csi_clear); + g_test_add_func("/vte/parser/sequences/csi/max", test_seq_csi_max); + g_test_add_func("/vte/parser/sequences/sci", test_seq_sci); + g_test_add_func("/vte/parser/sequences/dcs", test_seq_dcs); + g_test_add_func("/vte/parser/sequences/dcs/known", test_seq_dcs_known); + g_test_add_func("/vte/parser/sequences/osc", test_seq_osc); + + return g_test_run(); +} diff -Nru vte2.91-0.52.2/src/refptr.hh vte2.91-0.54.0/src/refptr.hh --- vte2.91-0.52.2/src/refptr.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/refptr.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +namespace vte { + +namespace glib { + +template +class RefPtr : public std::unique_ptr +{ +private: + using base_type = std::unique_ptr; + +public: + RefPtr(T* obj = nullptr) : base_type{obj, &g_object_unref} { } +}; + +} // namespace glib +} // namespace vte diff -Nru vte2.91-0.52.2/src/refptr-test.cc vte2.91-0.54.0/src/refptr-test.cc --- vte2.91-0.52.2/src/refptr-test.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/refptr-test.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,135 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "refptr.hh" + +/* Test object */ + +typedef struct _TestObject TestObject; +typedef struct _TestObjectClass TestObjectClass; + +struct _TestObject { + GObject parent_instance; +}; + +struct _TestObjectClass{ + GObjectClass parent_class; +}; + +static GType test_object_get_type(void); + +G_DEFINE_TYPE(TestObject, test_object, G_TYPE_OBJECT) + +static void +test_object_init(TestObject* object) +{ +} + +static void +test_object_finalize(GObject *object) +{ + G_OBJECT_CLASS(test_object_parent_class)->finalize(object); +} + +static void +test_object_class_init(TestObjectClass* klass) +{ + GObjectClass* gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = test_object_finalize; +} + +static TestObject* +test_object_new(void) +{ + return reinterpret_cast(g_object_new(test_object_get_type(), + nullptr)); +} + +/* Tests */ + +typedef union { + TestObject* obj; + void* ptr; +} obj_t; + +static void +test_glib_refptr(void) +{ + obj_t obj1; + obj1.obj = test_object_new(); + g_object_add_weak_pointer(G_OBJECT(obj1.obj), &obj1.ptr); + vte::glib::RefPtr ptr1 = obj1.obj; + g_assert_true(ptr1.get() == obj1.obj); + + auto ptr2 = std::move(ptr1); + g_assert_true(ptr1.get() == nullptr); + g_assert_true(ptr2.get() == obj1.obj); + + obj_t obj2; + obj2.obj = test_object_new(); + g_object_add_weak_pointer(G_OBJECT(obj2.obj), &obj2.ptr); + g_assert_nonnull(obj2.ptr); + ptr2 = obj2.obj; + g_assert_null(obj1.ptr); + g_assert_true(ptr2.get() == obj2.obj); + g_assert_nonnull(obj2.ptr); + + ptr2 = nullptr; + g_assert_null(obj2.ptr); + + obj_t obj3; + obj3.obj = test_object_new(); + g_object_add_weak_pointer(G_OBJECT(obj3.obj), &obj3.ptr); + g_assert_nonnull(obj3.ptr); + vte::glib::RefPtr ptr3 = obj3.obj; + TestObject* obj4 = ptr3.release(); + g_assert_null(ptr3.get()); + g_assert_nonnull(obj4); + g_object_unref(obj4); + g_assert_null(obj3.ptr); + + obj_t obj5; + obj5.obj = test_object_new(); + g_object_add_weak_pointer(G_OBJECT(obj5.obj), &obj5.ptr); + g_assert_nonnull(obj5.ptr); + vte::glib::RefPtr ptr5{obj5.obj}; + + obj_t obj6; + obj6.obj = test_object_new(); + g_object_add_weak_pointer(G_OBJECT(obj6.obj), &obj6.ptr); + g_assert_nonnull(obj6.ptr); + + ptr5.reset(obj6.obj); + g_assert_null(obj5.ptr); + + ptr5.reset(); + g_assert_null(obj6.ptr); + g_assert_null(ptr5.get()); +} + +int +main(int argc, + char* argv[]) +{ + g_test_init(&argc, &argv, nullptr); + + g_test_add_func("/vte/glib/refptr", test_glib_refptr); + + return g_test_run(); +} diff -Nru vte2.91-0.52.2/src/ring.cc vte2.91-0.54.0/src/ring.cc --- vte2.91-0.52.2/src/ring.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/ring.cc 2018-09-02 13:20:15.000000000 +0000 @@ -18,190 +18,159 @@ * Red Hat Author(s): Nalin Dahyabhai, Behdad Esfahbod */ -#include +#include "config.h" #include "debug.h" -#include "ring.h" +#include "ring.hh" +#include "vterowdata.hh" #include /* - * VteRing: A buffer ring + * Copy the common attributes from VteCellAttr to VteStreamCellAttr or vice versa. */ +static inline void +_attrcpy (void *dst, void *src) +{ + memcpy(dst, src, VTE_CELL_ATTR_COMMON_BYTES); +} + +using namespace vte::base; -#define hyperlink_get(ring, idx) ((GString *) g_ptr_array_index((ring)->hyperlinks, (idx))) +/* + * VteRing: A buffer ring + */ #ifdef VTE_DEBUG -static void -_vte_ring_validate (VteRing * ring) +void +Ring::validate() const { - g_assert(ring != NULL); _vte_debug_print(VTE_DEBUG_RING, " Delta = %lu, Length = %lu, Next = %lu, Max = %lu, Writable = %lu.\n", - ring->start, ring->end - ring->start, ring->end, - ring->max, ring->end - ring->writable); + m_start, m_end - m_start, m_end, + m_max, m_end - m_writable); - g_assert (ring->start <= ring->writable); - g_assert (ring->writable <= ring->end); + g_assert_cmpuint(m_start, <=, m_writable); + g_assert_cmpuint(m_writable, <=, m_end); - g_assert (ring->end - ring->start <= ring->max); - g_assert (ring->end - ring->writable <= ring->mask); + g_assert_cmpuint(m_end - m_start, <=, m_max); + g_assert_cmpuint(m_end - m_writable, <=, m_mask); } #else -#define _vte_ring_validate(ring) G_STMT_START {} G_STMT_END +#define validate(...) do { } while(0) #endif - -void -_vte_ring_init (VteRing *ring, gulong max_rows, gboolean has_streams) +Ring::Ring(row_t max_rows, + bool has_streams) + : m_max{MAX(max_rows, 3)}, + m_has_streams{has_streams}, + m_last_attr{basic_cell.attr} { - GString *empty_str; - - _vte_debug_print(VTE_DEBUG_RING, "New ring %p.\n", ring); - - memset (ring, 0, sizeof (*ring)); - - ring->max = MAX (max_rows, 3); + _vte_debug_print(VTE_DEBUG_RING, "New ring %p.\n", this); - ring->mask = 31; - ring->array = (VteRowData *) g_malloc0 (sizeof (ring->array[0]) * (ring->mask + 1)); + m_array = (VteRowData* ) g_malloc0 (sizeof (m_array[0]) * (m_mask + 1)); - ring->has_streams = has_streams; if (has_streams) { - ring->attr_stream = _vte_file_stream_new (); - ring->text_stream = _vte_file_stream_new (); - ring->row_stream = _vte_file_stream_new (); + m_attr_stream = _vte_file_stream_new (); + m_text_stream = _vte_file_stream_new (); + m_row_stream = _vte_file_stream_new (); } else { - ring->attr_stream = ring->text_stream = ring->row_stream = NULL; + m_attr_stream = m_text_stream = m_row_stream = nullptr; } - ring->last_attr_text_start_offset = 0; - ring->last_attr = basic_cell.attr; - ring->utf8_buffer = g_string_sized_new (128); + m_utf8_buffer = g_string_sized_new (128); - _vte_row_data_init (&ring->cached_row); - ring->cached_row_num = (gulong) -1; + _vte_row_data_init (&m_cached_row); - ring->visible_rows = 0; + m_hyperlinks = g_ptr_array_new(); + auto empty_str = g_string_new_len("", 0); + g_ptr_array_add(m_hyperlinks, empty_str); - ring->hyperlinks = g_ptr_array_new(); - empty_str = g_string_new_len("", 0); - g_ptr_array_add(ring->hyperlinks, empty_str); - ring->hyperlink_highest_used_idx = 0; - ring->hyperlink_current_idx = 0; - ring->hyperlink_hover_idx = 0; - ring->hyperlink_maybe_gc_counter = 0; - - _vte_ring_validate(ring); + validate(); } -void -_vte_ring_fini (VteRing *ring) +Ring::~Ring() { - gulong i; - - for (i = 0; i <= ring->mask; i++) - _vte_row_data_fini (&ring->array[i]); + for (size_t i = 0; i <= m_mask; i++) + _vte_row_data_fini (&m_array[i]); - g_free (ring->array); + g_free (m_array); - if (ring->has_streams) { - g_object_unref (ring->attr_stream); - g_object_unref (ring->text_stream); - g_object_unref (ring->row_stream); + if (m_has_streams) { + g_object_unref (m_attr_stream); + g_object_unref (m_text_stream); + g_object_unref (m_row_stream); } - g_string_free (ring->utf8_buffer, TRUE); - - for (i = 0; i < ring->hyperlinks->len; i++) - g_string_free (hyperlink_get(ring, i), TRUE); - g_ptr_array_free (ring->hyperlinks, TRUE); - - _vte_row_data_fini (&ring->cached_row); -} - -typedef struct _VteRowRecord { - gsize text_start_offset; /* offset where text of this row begins */ - gsize attr_start_offset; /* offset of the first character's attributes */ - int soft_wrapped: 1; /* end of line is not '\n' */ - int is_ascii: 1; /* for rewrapping speedup: guarantees that line contains 32..126 bytes only. Can be 0 even when ascii only. */ -} VteRowRecord; - -/* Represents a cell position, see ../doc/rewrap.txt */ -typedef struct _VteCellTextOffset { - gsize text_offset; /* byte offset in text_stream (or perhaps beyond) */ - gint fragment_cells; /* extra number of cells to walk within a multicell character */ - gint eol_cells; /* -1 if over a character, >=0 if at EOL or beyond */ -} VteCellTextOffset; + g_string_free (m_utf8_buffer, TRUE); + for (size_t i = 0; i < m_hyperlinks->len; i++) + g_string_free (hyperlink_get(i), TRUE); + g_ptr_array_free (m_hyperlinks, TRUE); -static inline VteRowData * -_vte_ring_writable_index (VteRing *ring, gulong position) -{ - return &ring->array[position & ring->mask]; + _vte_row_data_fini(&m_cached_row); } - #define SET_BIT(buf, n) buf[(n) / 8] |= (1 << ((n) % 8)) #define GET_BIT(buf, n) ((buf[(n) / 8] >> ((n) % 8)) & 1) /* * Do a round of garbage collection. Hyperlinks that no longer occur in the ring are wiped out. */ -static void -_vte_ring_hyperlink_gc (VteRing *ring) +void +Ring::hyperlink_gc() { - gulong i, j; + row_t i, j; hyperlink_idx_t idx; - VteRowData *row; + VteRowData* row; char *used; _vte_debug_print (VTE_DEBUG_HYPERLINK, "hyperlink: GC starting (highest used idx is %d)\n", - ring->hyperlink_highest_used_idx); + m_hyperlink_highest_used_idx); - ring->hyperlink_maybe_gc_counter = 0; + m_hyperlink_maybe_gc_counter = 0; - if (ring->hyperlink_highest_used_idx == 0) { + if (m_hyperlink_highest_used_idx == 0) { _vte_debug_print (VTE_DEBUG_HYPERLINK, "hyperlink: GC done (no links at all, nothing to do)\n"); return; } /* One bit for each idx to see if it's used. */ - used = (char *) g_malloc0 (ring->hyperlink_highest_used_idx / 8 + 1); + used = (char *) g_malloc0 (m_hyperlink_highest_used_idx / 8 + 1); /* A few special values not to be garbage collected. */ - SET_BIT(used, ring->hyperlink_current_idx); - SET_BIT(used, ring->hyperlink_hover_idx); - SET_BIT(used, ring->last_attr.hyperlink_idx); + SET_BIT(used, m_hyperlink_current_idx); + SET_BIT(used, m_hyperlink_hover_idx); + SET_BIT(used, m_last_attr.hyperlink_idx); - for (i = ring->writable; i < ring->end; i++) { - row = _vte_ring_writable_index (ring, i); + for (i = m_writable; i < m_end; i++) { + row = get_writable_index(i); for (j = 0; j < row->len; j++) { idx = row->cells[j].attr.hyperlink_idx; SET_BIT(used, idx); } } - for (idx = 1; idx <= ring->hyperlink_highest_used_idx; idx++) { - if (!GET_BIT(used, idx) && hyperlink_get(ring, idx)->len != 0) { + for (idx = 1; idx <= m_hyperlink_highest_used_idx; idx++) { + if (!GET_BIT(used, idx) && hyperlink_get(idx)->len != 0) { _vte_debug_print (VTE_DEBUG_HYPERLINK, "hyperlink: GC purging link %d to id;uri=\"%s\"\n", - idx, hyperlink_get(ring, idx)->str); + idx, hyperlink_get(idx)->str); /* Wipe out the ID and URI itself so it doesn't linger on in the memory for a long time */ - memset(hyperlink_get(ring, idx)->str, 0, hyperlink_get(ring, idx)->len); - g_string_truncate (hyperlink_get(ring, idx), 0); + memset(hyperlink_get(idx)->str, 0, hyperlink_get(idx)->len); + g_string_truncate (hyperlink_get(idx), 0); } } - while (ring->hyperlink_highest_used_idx >= 1 && hyperlink_get(ring, ring->hyperlink_highest_used_idx)->len == 0) { - ring->hyperlink_highest_used_idx--; + while (m_hyperlink_highest_used_idx >= 1 && hyperlink_get(m_hyperlink_highest_used_idx)->len == 0) { + m_hyperlink_highest_used_idx--; } _vte_debug_print (VTE_DEBUG_HYPERLINK, "hyperlink: GC done (highest used idx is now %d)\n", - ring->hyperlink_highest_used_idx); + m_hyperlink_highest_used_idx); g_free (used); } @@ -210,16 +179,16 @@ * Cumulate the given value, and do a GC when 65536 is reached. */ void -_vte_ring_hyperlink_maybe_gc (VteRing *ring, gulong increment) +Ring::hyperlink_maybe_gc(row_t increment) { - ring->hyperlink_maybe_gc_counter += increment; + m_hyperlink_maybe_gc_counter += increment; _vte_debug_print (VTE_DEBUG_HYPERLINK, "hyperlink: maybe GC, counter at %ld\n", - ring->hyperlink_maybe_gc_counter); + m_hyperlink_maybe_gc_counter); - if (ring->hyperlink_maybe_gc_counter >= 65536) - _vte_ring_hyperlink_gc (ring); + if (m_hyperlink_maybe_gc_counter >= 65536) + hyperlink_gc(); } /* @@ -231,8 +200,8 @@ * * FIXME do something more effective than a linear search */ -static hyperlink_idx_t -_vte_ring_get_hyperlink_idx_no_update_current (VteRing *ring, const char *hyperlink) +Ring::hyperlink_idx_t +Ring::get_hyperlink_idx_no_update_current(char const* hyperlink) { hyperlink_idx_t idx; gsize len; @@ -244,8 +213,9 @@ len = strlen(hyperlink); /* Linear search for this particular URI */ - for (idx = 1; idx <= ring->hyperlink_highest_used_idx; idx++) { - if (strcmp(hyperlink_get(ring, idx)->str, hyperlink) == 0) { + auto const last_idx = m_hyperlink_highest_used_idx + 1; + for (idx = 1; idx < last_idx; ++idx) { + if (strcmp(hyperlink_get(idx)->str, hyperlink) == 0) { _vte_debug_print (VTE_DEBUG_HYPERLINK, "get_hyperlink_idx: already existing idx %d for id;uri=\"%s\"\n", idx, hyperlink); @@ -253,42 +223,42 @@ } } - /* FIXME it's the second time we're GCing if coming from _vte_ring_get_hyperlink_idx */ - _vte_ring_hyperlink_gc(ring); + /* FIXME it's the second time we're GCing if coming from get_hyperlink_idx */ + hyperlink_gc(); /* Another linear search for an empty slot where a GString is already allocated */ - for (idx = 1; idx < ring->hyperlinks->len; idx++) { - if (hyperlink_get(ring, idx)->len == 0) { + for (idx = 1; idx < m_hyperlinks->len; idx++) { + if (hyperlink_get(idx)->len == 0) { _vte_debug_print (VTE_DEBUG_HYPERLINK, "get_hyperlink_idx: reassigning old idx %d for id;uri=\"%s\"\n", idx, hyperlink); /* Grow size if required, however, never shrink to avoid long-term memory fragmentation. */ - g_string_append_len (hyperlink_get(ring, idx), hyperlink, len); - ring->hyperlink_highest_used_idx = MAX (ring->hyperlink_highest_used_idx, idx); + g_string_append_len (hyperlink_get(idx), hyperlink, len); + m_hyperlink_highest_used_idx = MAX (m_hyperlink_highest_used_idx, idx); return idx; } } /* All allocated slots are in use. Gotta allocate a new one */ - g_assert_cmpuint(ring->hyperlink_highest_used_idx + 1, ==, ring->hyperlinks->len); + g_assert_cmpuint(m_hyperlink_highest_used_idx + 1, ==, m_hyperlinks->len); /* VTE_HYPERLINK_COUNT_MAX should be big enough for this not to happen under normal circumstances. Anyway, it's cheap to protect against extreme ones. */ - if (ring->hyperlink_highest_used_idx == VTE_HYPERLINK_COUNT_MAX) { + if (m_hyperlink_highest_used_idx == VTE_HYPERLINK_COUNT_MAX) { _vte_debug_print (VTE_DEBUG_HYPERLINK, "get_hyperlink_idx: idx 0 (ran out of available idxs) for id;uri=\"%s\"\n", hyperlink); return 0; } - idx = ++ring->hyperlink_highest_used_idx; + idx = ++m_hyperlink_highest_used_idx; _vte_debug_print (VTE_DEBUG_HYPERLINK, "get_hyperlink_idx: brand new idx %d for id;uri=\"%s\"\n", idx, hyperlink); str = g_string_new_len (hyperlink, len); - g_ptr_array_add(ring->hyperlinks, str); + g_ptr_array_add(m_hyperlinks, str); - g_assert_cmpuint(ring->hyperlink_highest_used_idx + 1, ==, ring->hyperlinks->len); + g_assert_cmpuint(m_hyperlink_highest_used_idx + 1, ==, m_hyperlinks->len); return idx; } @@ -302,47 +272,36 @@ * * The current idx is also updated, in order not to be garbage collected. */ -guint -_vte_ring_get_hyperlink_idx (VteRing *ring, const char *hyperlink) +Ring::hyperlink_idx_t +Ring::get_hyperlink_idx(char const* hyperlink) { /* Release current idx and do a round of GC to possibly purge its hyperlink, - * even if new hyperlink is NULL or empty. */ - ring->hyperlink_current_idx = 0; - _vte_ring_hyperlink_gc(ring); - - ring->hyperlink_current_idx = _vte_ring_get_hyperlink_idx_no_update_current(ring, hyperlink); - return ring->hyperlink_current_idx; -} + * even if new hyperlink is nullptr or empty. */ + m_hyperlink_current_idx = 0; + hyperlink_gc(); -static gboolean -_vte_ring_read_row_record (VteRing *ring, VteRowRecord *record, gulong position) -{ - return _vte_stream_read (ring->row_stream, position * sizeof (*record), (char *) record, sizeof (*record)); + m_hyperlink_current_idx = get_hyperlink_idx_no_update_current(hyperlink); + return m_hyperlink_current_idx; } -static void -_vte_ring_append_row_record (VteRing *ring, const VteRowRecord *record, gulong position) -{ - _vte_stream_append (ring->row_stream, (const char *) record, sizeof (*record)); -} - -static void -_vte_ring_freeze_row (VteRing *ring, gulong position, const VteRowData *row) +void +Ring::freeze_row(row_t position, + VteRowData const* row) { - VteRowRecord record; VteCell *cell; - GString *buffer = ring->utf8_buffer; + GString *buffer = m_utf8_buffer; GString *hyperlink; int i; gboolean froze_hyperlink = FALSE; _vte_debug_print (VTE_DEBUG_RING, "Freezing row %lu.\n", position); - g_assert(ring->has_streams); + g_assert(m_has_streams); - memset(&record, 0, sizeof (record)); - record.text_start_offset = _vte_stream_head (ring->text_stream); - record.attr_start_offset = _vte_stream_head (ring->attr_stream); + RowRecord record; + memset(&record, 0, sizeof(record)); + record.text_start_offset = _vte_stream_head(m_text_stream); + record.attr_start_offset = _vte_stream_head(m_attr_stream); record.is_ascii = 1; g_string_set_size (buffer, 0); @@ -363,48 +322,48 @@ */ attr = cell->attr; if (G_LIKELY (!attr.fragment())) { - VteCellAttrChange attr_change; + CellAttrChange attr_change; guint16 hyperlink_length; - if (memcmp(&ring->last_attr, &attr, sizeof (VteCellAttr)) != 0) { - ring->last_attr_text_start_offset = record.text_start_offset + buffer->len; + if (memcmp(&m_last_attr, &attr, sizeof (VteCellAttr)) != 0) { + m_last_attr_text_start_offset = record.text_start_offset + buffer->len; memset(&attr_change, 0, sizeof (attr_change)); - attr_change.text_end_offset = ring->last_attr_text_start_offset; - _attrcpy(&attr_change.attr, &ring->last_attr); - hyperlink = hyperlink_get(ring, ring->last_attr.hyperlink_idx); + attr_change.text_end_offset = m_last_attr_text_start_offset; + _attrcpy(&attr_change.attr, &m_last_attr); + hyperlink = hyperlink_get(m_last_attr.hyperlink_idx); attr_change.attr.hyperlink_length = hyperlink->len; - _vte_stream_append (ring->attr_stream, (const char *) &attr_change, sizeof (attr_change)); + _vte_stream_append (m_attr_stream, (char const* ) &attr_change, sizeof (attr_change)); if (G_UNLIKELY (hyperlink->len != 0)) { - _vte_stream_append (ring->attr_stream, hyperlink->str, hyperlink->len); + _vte_stream_append (m_attr_stream, hyperlink->str, hyperlink->len); froze_hyperlink = TRUE; } hyperlink_length = attr_change.attr.hyperlink_length; - _vte_stream_append (ring->attr_stream, (const char *) &hyperlink_length, 2); + _vte_stream_append (m_attr_stream, (char const* ) &hyperlink_length, 2); if (!buffer->len) /* This row doesn't use last_attr, adjust */ record.attr_start_offset += sizeof (attr_change) + hyperlink_length + 2; - ring->last_attr = attr; + m_last_attr = attr; } num_chars = _vte_unistr_strlen (cell->c); if (num_chars > 1) { /* Combining chars */ attr.set_columns(0); - ring->last_attr_text_start_offset = record.text_start_offset + buffer->len - + g_unichar_to_utf8 (_vte_unistr_get_base (cell->c), NULL); + m_last_attr_text_start_offset = record.text_start_offset + buffer->len + + g_unichar_to_utf8 (_vte_unistr_get_base (cell->c), nullptr); memset(&attr_change, 0, sizeof (attr_change)); - attr_change.text_end_offset = ring->last_attr_text_start_offset; - _attrcpy(&attr_change.attr, &ring->last_attr); - hyperlink = hyperlink_get(ring, ring->last_attr.hyperlink_idx); + attr_change.text_end_offset = m_last_attr_text_start_offset; + _attrcpy(&attr_change.attr, &m_last_attr); + hyperlink = hyperlink_get(m_last_attr.hyperlink_idx); attr_change.attr.hyperlink_length = hyperlink->len; - _vte_stream_append (ring->attr_stream, (const char *) &attr_change, sizeof (attr_change)); + _vte_stream_append (m_attr_stream, (char const* ) &attr_change, sizeof (attr_change)); if (G_UNLIKELY (hyperlink->len != 0)) { - _vte_stream_append (ring->attr_stream, hyperlink->str, hyperlink->len); + _vte_stream_append (m_attr_stream, hyperlink->str, hyperlink->len); froze_hyperlink = TRUE; } hyperlink_length = attr_change.attr.hyperlink_length; - _vte_stream_append (ring->attr_stream, (const char *) &hyperlink_length, 2); - ring->last_attr = attr; + _vte_stream_append (m_attr_stream, (char const* ) &hyperlink_length, 2); + m_last_attr = attr; } if (cell->c < 32 || cell->c > 126) record.is_ascii = 0; @@ -415,12 +374,12 @@ g_string_append_c (buffer, '\n'); record.soft_wrapped = row->attr.soft_wrapped; - _vte_stream_append (ring->text_stream, buffer->str, buffer->len); - _vte_ring_append_row_record (ring, &record, position); + _vte_stream_append(m_text_stream, buffer->str, buffer->len); + append_row_record(&record, position); /* After freezing some hyperlinks, do a hyperlink GC. The constant is totally arbitrary, feel free to fine tune. */ if (froze_hyperlink) - _vte_ring_hyperlink_maybe_gc(ring, 1024); + hyperlink_maybe_gc(1024); } /* If do_truncate (data is placed back from the stream to the ring), real new hyperlink idxs are looked up or allocated. @@ -429,42 +388,45 @@ * except for the hyperlink_hover_idx which gets this real idx. This is important for hover underlining. * * Optionally updates the hyperlink parameter to point to the ring-owned hyperlink target. */ -static void -_vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do_truncate, - int hyperlink_column, const char **hyperlink) +void +Ring::thaw_row(row_t position, + VteRowData* row, + bool do_truncate, + int hyperlink_column, + char const** hyperlink) { - VteRowRecord records[2], record; + RowRecord records[2], record; VteCellAttr attr; - VteCellAttrChange attr_change; + CellAttrChange attr_change; VteCell cell; - const char *p, *q, *end; - GString *buffer = ring->utf8_buffer; + char const* p, *q, *end; + GString *buffer = m_utf8_buffer; char hyperlink_readbuf[VTE_HYPERLINK_TOTAL_LENGTH_MAX + 1]; hyperlink_readbuf[0] = '\0'; if (hyperlink) { - ring->hyperlink_buf[0] = '\0'; - *hyperlink = ring->hyperlink_buf; + m_hyperlink_buf[0] = '\0'; + *hyperlink = m_hyperlink_buf; } _vte_debug_print (VTE_DEBUG_RING, "Thawing row %lu.\n", position); - g_assert(ring->has_streams); + g_assert(m_has_streams); _vte_row_data_clear (row); attr_change.text_end_offset = 0; - if (!_vte_ring_read_row_record (ring, &records[0], position)) + if (!read_row_record(&records[0], position)) return; - if ((position + 1) * sizeof (records[0]) < _vte_stream_head (ring->row_stream)) { - if (!_vte_ring_read_row_record (ring, &records[1], position + 1)) + if ((position + 1) * sizeof (records[0]) < _vte_stream_head (m_row_stream)) { + if (!read_row_record(&records[1], position + 1)) return; } else - records[1].text_start_offset = _vte_stream_head (ring->text_stream); + records[1].text_start_offset = _vte_stream_head (m_text_stream); g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset); - if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len)) + if (!_vte_stream_read (m_text_stream, records[0].text_start_offset, buffer->str, buffer->len)) return; record = records[0]; @@ -477,16 +439,16 @@ p = buffer->str; end = p + buffer->len; while (p < end) { - if (record.text_start_offset >= ring->last_attr_text_start_offset) { - attr = ring->last_attr; - strcpy(hyperlink_readbuf, hyperlink_get(ring, attr.hyperlink_idx)->str); + if (record.text_start_offset >= m_last_attr_text_start_offset) { + attr = m_last_attr; + strcpy(hyperlink_readbuf, hyperlink_get(attr.hyperlink_idx)->str); } else { if (record.text_start_offset >= attr_change.text_end_offset) { - if (!_vte_stream_read (ring->attr_stream, record.attr_start_offset, (char *) &attr_change, sizeof (attr_change))) + if (!_vte_stream_read (m_attr_stream, record.attr_start_offset, (char *) &attr_change, sizeof (attr_change))) return; record.attr_start_offset += sizeof (attr_change); g_assert_cmpuint (attr_change.attr.hyperlink_length, <=, VTE_HYPERLINK_TOTAL_LENGTH_MAX); - if (attr_change.attr.hyperlink_length && !_vte_stream_read (ring->attr_stream, record.attr_start_offset, hyperlink_readbuf, attr_change.attr.hyperlink_length)) + if (attr_change.attr.hyperlink_length && !_vte_stream_read (m_attr_stream, record.attr_start_offset, hyperlink_readbuf, attr_change.attr.hyperlink_length)) return; hyperlink_readbuf[attr_change.attr.hyperlink_length] = '\0'; record.attr_start_offset += attr_change.attr.hyperlink_length + 2; @@ -497,13 +459,13 @@ if (do_truncate) { /* Find the existing idx or allocate a new one, just as when receiving an OSC 8 escape sequence. * Do not update the current idx though. */ - attr.hyperlink_idx = _vte_ring_get_hyperlink_idx_no_update_current (ring, hyperlink_readbuf); + attr.hyperlink_idx = get_hyperlink_idx_no_update_current(hyperlink_readbuf); } else { /* Use a special hyperlink idx, except if to be underlined because the hyperlink is the same as the hovered cell's. */ attr.hyperlink_idx = VTE_HYPERLINK_IDX_TARGET_IN_STREAM; - if (ring->hyperlink_hover_idx != 0 && strcmp(hyperlink_readbuf, hyperlink_get(ring, ring->hyperlink_hover_idx)->str) == 0) { - /* FIXME here we're calling the expensive strcmp() above and _vte_ring_get_hyperlink_idx_no_update_current() way too many times. */ - attr.hyperlink_idx = _vte_ring_get_hyperlink_idx_no_update_current(ring, hyperlink_readbuf); + if (m_hyperlink_hover_idx != 0 && strcmp(hyperlink_readbuf, hyperlink_get(m_hyperlink_hover_idx)->str) == 0) { + /* FIXME here we're calling the expensive strcmp() above and get_hyperlink_idx_no_update_current() way too many times. */ + attr.hyperlink_idx = get_hyperlink_idx_no_update_current(hyperlink_readbuf); } } } @@ -529,13 +491,13 @@ row->cells[row->len - 1].c = _vte_unistr_append_unichar (row->cells[row->len - 1].c, cell.c); } else { cell.attr.set_columns(1); - if (row->len == hyperlink_column && hyperlink != NULL) - *hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf); + if (row->len == hyperlink_column && hyperlink != nullptr) + *hyperlink = strcpy(m_hyperlink_buf, hyperlink_readbuf); _vte_row_data_append (row, &cell); } } else { - if (row->len == hyperlink_column && hyperlink != NULL) - *hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf); + if (row->len == hyperlink_column && hyperlink != nullptr) + *hyperlink = strcpy(m_hyperlink_buf, hyperlink_readbuf); _vte_row_data_append (row, &cell); if (cell.attr.columns() > 1) { /* Add the fragments */ @@ -543,8 +505,8 @@ cell.attr.set_fragment(true); cell.attr.set_columns(1); for (i = 1; i < columns; i++) { - if (row->len == hyperlink_column && hyperlink != NULL) - *hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf); + if (row->len == hyperlink_column && hyperlink != nullptr) + *hyperlink = strcpy(m_hyperlink_buf, hyperlink_readbuf); _vte_row_data_append (row, &cell); } } @@ -557,12 +519,12 @@ if (do_truncate) { gsize attr_stream_truncate_at = records[0].attr_start_offset; _vte_debug_print (VTE_DEBUG_RING, "Truncating\n"); - if (records[0].text_start_offset <= ring->last_attr_text_start_offset) { + if (records[0].text_start_offset <= m_last_attr_text_start_offset) { /* Check the previous attr record. If its text ends where truncating, this attr record also needs to be removed. */ guint16 hyperlink_length; - if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - 2, (char *) &hyperlink_length, 2)) { + if (_vte_stream_read (m_attr_stream, attr_stream_truncate_at - 2, (char *) &hyperlink_length, 2)) { g_assert_cmpuint (hyperlink_length, <=, VTE_HYPERLINK_TOTAL_LENGTH_MAX); - if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - 2 - hyperlink_length - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) { + if (_vte_stream_read (m_attr_stream, attr_stream_truncate_at - 2 - hyperlink_length - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) { if (records[0].text_start_offset == attr_change.text_end_offset) { _vte_debug_print (VTE_DEBUG_RING, "... at attribute change\n"); attr_stream_truncate_at -= sizeof (attr_change) + hyperlink_length + 2; @@ -571,74 +533,74 @@ } /* Reconstruct last_attr from the first record of attr_stream that we cut off, last_attr_text_start_offset from the last record that we keep. */ - if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at, (char *) &attr_change, sizeof (attr_change))) { - _attrcpy(&ring->last_attr, &attr_change.attr); - ring->last_attr.hyperlink_idx = 0; - if (attr_change.attr.hyperlink_length && _vte_stream_read (ring->attr_stream, attr_stream_truncate_at + sizeof (attr_change), (char *) &hyperlink_readbuf, attr_change.attr.hyperlink_length)) { + if (_vte_stream_read (m_attr_stream, attr_stream_truncate_at, (char *) &attr_change, sizeof (attr_change))) { + _attrcpy(&m_last_attr, &attr_change.attr); + m_last_attr.hyperlink_idx = 0; + if (attr_change.attr.hyperlink_length && _vte_stream_read (m_attr_stream, attr_stream_truncate_at + sizeof (attr_change), (char *) &hyperlink_readbuf, attr_change.attr.hyperlink_length)) { hyperlink_readbuf[attr_change.attr.hyperlink_length] = '\0'; - ring->last_attr.hyperlink_idx = _vte_ring_get_hyperlink_idx (ring, hyperlink_readbuf); + m_last_attr.hyperlink_idx = get_hyperlink_idx(hyperlink_readbuf); } - if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - 2, (char *) &hyperlink_length, 2)) { + if (_vte_stream_read (m_attr_stream, attr_stream_truncate_at - 2, (char *) &hyperlink_length, 2)) { g_assert_cmpuint (hyperlink_length, <=, VTE_HYPERLINK_TOTAL_LENGTH_MAX); - if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - 2 - hyperlink_length - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) { - ring->last_attr_text_start_offset = attr_change.text_end_offset; + if (_vte_stream_read (m_attr_stream, attr_stream_truncate_at - 2 - hyperlink_length - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) { + m_last_attr_text_start_offset = attr_change.text_end_offset; } else { - ring->last_attr_text_start_offset = 0; + m_last_attr_text_start_offset = 0; } } else { - ring->last_attr_text_start_offset = 0; + m_last_attr_text_start_offset = 0; } } else { - ring->last_attr_text_start_offset = 0; - ring->last_attr = basic_cell.attr; + m_last_attr_text_start_offset = 0; + m_last_attr = basic_cell.attr; } } - _vte_stream_truncate (ring->row_stream, position * sizeof (record)); - _vte_stream_truncate (ring->attr_stream, attr_stream_truncate_at); - _vte_stream_truncate (ring->text_stream, records[0].text_start_offset); + _vte_stream_truncate (m_row_stream, position * sizeof (record)); + _vte_stream_truncate (m_attr_stream, attr_stream_truncate_at); + _vte_stream_truncate (m_text_stream, records[0].text_start_offset); } } -static void -_vte_ring_reset_streams (VteRing *ring, gulong position) +void +Ring::reset_streams(row_t position) { _vte_debug_print (VTE_DEBUG_RING, "Reseting streams to %lu.\n", position); - if (ring->has_streams) { - _vte_stream_reset (ring->row_stream, position * sizeof (VteRowRecord)); - _vte_stream_reset (ring->text_stream, _vte_stream_head (ring->text_stream)); - _vte_stream_reset (ring->attr_stream, _vte_stream_head (ring->attr_stream)); + if (m_has_streams) { + _vte_stream_reset(m_row_stream, position * sizeof(RowRecord)); + _vte_stream_reset(m_text_stream, _vte_stream_head(m_text_stream)); + _vte_stream_reset(m_attr_stream, _vte_stream_head(m_attr_stream)); } - ring->last_attr_text_start_offset = 0; - ring->last_attr = basic_cell.attr; + m_last_attr_text_start_offset = 0; + m_last_attr = basic_cell.attr; } -long -_vte_ring_reset (VteRing *ring) +Ring::row_t +Ring::reset() { - _vte_debug_print (VTE_DEBUG_RING, "Reseting the ring at %lu.\n", ring->end); + _vte_debug_print (VTE_DEBUG_RING, "Reseting the ring at %lu.\n", m_end); - _vte_ring_reset_streams (ring, ring->end); - ring->start = ring->writable = ring->end; - ring->cached_row_num = (gulong) -1; + reset_streams(m_end); + m_start = m_writable = m_end; + m_cached_row_num = (row_t)-1; - return ring->end; + return m_end; } -const VteRowData * -_vte_ring_index (VteRing *ring, gulong position) +VteRowData const* +Ring::index(row_t position) { - if (G_LIKELY (position >= ring->writable)) - return _vte_ring_writable_index (ring, position); + if (G_LIKELY (position >= m_writable)) + return get_writable_index(position); - if (ring->cached_row_num != position) { + if (m_cached_row_num != position) { _vte_debug_print(VTE_DEBUG_RING, "Caching row %lu.\n", position); - _vte_ring_thaw_row (ring, position, &ring->cached_row, FALSE, -1, NULL); - ring->cached_row_num = position; + thaw_row(position, &m_cached_row, false, -1, nullptr); + m_cached_row_num = position; } - return &ring->cached_row; + return &m_cached_row; } /* @@ -654,219 +616,222 @@ * * Otherwise cells from the stream might get the pseudo idx VTE_HYPERLINK_IDX_TARGET_IN_STREAM. */ -hyperlink_idx_t -_vte_ring_get_hyperlink_at_position (VteRing *ring, gulong position, int col, bool update_hover_idx, const char **hyperlink) +Ring::hyperlink_idx_t +Ring::get_hyperlink_at_position(row_t position, + column_t col, + bool update_hover_idx, + char const** hyperlink) { hyperlink_idx_t idx; - const char *hp; + char const* hp; - if (hyperlink == NULL) + if (hyperlink == nullptr) hyperlink = &hp; - *hyperlink = NULL; + *hyperlink = nullptr; if (update_hover_idx) { /* Invalidate the cache because new hover idx might result in new idxs to report. */ - ring->cached_row_num = (gulong) -1; + m_cached_row_num = (row_t)-1; } - if (G_UNLIKELY (!_vte_ring_contains(ring, position) || col == -1)) { + if (G_UNLIKELY (!contains(position) || col < 0)) { if (update_hover_idx) - ring->hyperlink_hover_idx = 0; + m_hyperlink_hover_idx = 0; return 0; } - if (G_LIKELY (position >= ring->writable)) { - VteRowData *row = _vte_ring_writable_index (ring, position); + if (G_LIKELY (position >= m_writable)) { + VteRowData* row = get_writable_index(position); if (col >= _vte_row_data_length(row)) { if (update_hover_idx) - ring->hyperlink_hover_idx = 0; + m_hyperlink_hover_idx = 0; return 0; } - *hyperlink = hyperlink_get(ring, row->cells[col].attr.hyperlink_idx)->str; + *hyperlink = hyperlink_get(row->cells[col].attr.hyperlink_idx)->str; idx = row->cells[col].attr.hyperlink_idx; } else { - _vte_ring_thaw_row (ring, position, &ring->cached_row, FALSE, col, hyperlink); + thaw_row(position, &m_cached_row, false, col, hyperlink); /* Note: Intentionally don't set cached_row_num. We're about to update - * ring->hyperlink_hover_idx which makes some idxs no longer valid. */ - idx = _vte_ring_get_hyperlink_idx_no_update_current(ring, *hyperlink); + * m_hyperlink_hover_idx which makes some idxs no longer valid. */ + idx = get_hyperlink_idx_no_update_current(*hyperlink); } if (**hyperlink == '\0') - *hyperlink = NULL; + *hyperlink = nullptr; if (update_hover_idx) - ring->hyperlink_hover_idx = idx; + m_hyperlink_hover_idx = idx; return idx; } -static void _vte_ring_ensure_writable (VteRing *ring, gulong position); -static void _vte_ring_ensure_writable_room (VteRing *ring); - -VteRowData * -_vte_ring_index_writable (VteRing *ring, gulong position) +VteRowData* +Ring::index_writable(row_t position) { - _vte_ring_ensure_writable (ring, position); - return _vte_ring_writable_index (ring, position); + ensure_writable(position); + return get_writable_index(position); } -static void -_vte_ring_freeze_one_row (VteRing *ring) +void +Ring::freeze_one_row() { - VteRowData *row; + VteRowData* row; - if (G_UNLIKELY (ring->writable == ring->start)) - _vte_ring_reset_streams (ring, ring->writable); + if (G_UNLIKELY (m_writable == m_start)) + reset_streams(m_writable); - row = _vte_ring_writable_index (ring, ring->writable); - _vte_ring_freeze_row (ring, ring->writable, row); + row = get_writable_index(m_writable); + freeze_row(m_writable, row); - ring->writable++; + m_writable++; } -static void -_vte_ring_thaw_one_row (VteRing *ring) +void +Ring::thaw_one_row() { - VteRowData *row; - - g_assert (ring->start < ring->writable); + VteRowData* row; - _vte_ring_ensure_writable_room (ring); + g_assert_cmpuint(m_start, <, m_writable); - ring->writable--; + ensure_writable_room(); - if (ring->writable == ring->cached_row_num) - ring->cached_row_num = (gulong) -1; /* Invalidate cached row */ + m_writable--; - row = _vte_ring_writable_index (ring, ring->writable); + if (m_writable == m_cached_row_num) + m_cached_row_num = (row_t)-1; /* Invalidate cached row */ - _vte_ring_thaw_row (ring, ring->writable, row, TRUE, -1, NULL); + row = get_writable_index(m_writable); + thaw_row(m_writable, row, true, -1, nullptr); } -static void -_vte_ring_discard_one_row (VteRing *ring) +void +Ring::discard_one_row() { - ring->start++; - if (G_UNLIKELY (ring->start == ring->writable)) { - _vte_ring_reset_streams (ring, ring->writable); - } else if (ring->start < ring->writable) { - VteRowRecord record; - _vte_stream_advance_tail (ring->row_stream, ring->start * sizeof (record)); - if (G_LIKELY (_vte_ring_read_row_record (ring, &record, ring->start))) { - _vte_stream_advance_tail (ring->text_stream, record.text_start_offset); - _vte_stream_advance_tail (ring->attr_stream, record.attr_start_offset); + m_start++; + if (G_UNLIKELY(m_start == m_writable)) { + reset_streams(m_writable); + } else if (m_start < m_writable) { + RowRecord record; + _vte_stream_advance_tail(m_row_stream, m_start * sizeof (record)); + if (G_LIKELY(read_row_record(&record, m_start))) { + _vte_stream_advance_tail(m_text_stream, record.text_start_offset); + _vte_stream_advance_tail(m_attr_stream, record.attr_start_offset); } } else { - ring->writable = ring->start; + m_writable = m_start; } } -static void -_vte_ring_maybe_freeze_one_row (VteRing *ring) +void +Ring::maybe_freeze_one_row() { - if (G_LIKELY (ring->mask >= ring->visible_rows && ring->writable + ring->mask + 1 == ring->end)) - _vte_ring_freeze_one_row (ring); + if (G_LIKELY(m_mask >= m_visible_rows && + m_writable + m_mask + 1 == m_end)) + freeze_one_row(); else - _vte_ring_ensure_writable_room (ring); + ensure_writable_room(); } -static void -_vte_ring_maybe_discard_one_row (VteRing *ring) +//FIXMEchpe maybe inline this one +void +Ring::maybe_discard_one_row() { - if ((gulong) _vte_ring_length (ring) == ring->max) - _vte_ring_discard_one_row (ring); + if (length() == m_max) + discard_one_row(); } -static void -_vte_ring_ensure_writable_room (VteRing *ring) +void +Ring::ensure_writable_room() { - gulong new_mask, old_mask, i, end; - VteRowData *old_array, *new_array;; + row_t new_mask, old_mask, i, end; + VteRowData* old_array, *new_array;; - if (G_LIKELY (ring->mask >= ring->visible_rows && ring->writable + ring->mask + 1 > ring->end)) + if (G_LIKELY(m_mask >= m_visible_rows && + m_writable + m_mask + 1 > m_end)) return; - old_mask = ring->mask; - old_array = ring->array; + old_mask = m_mask; + old_array = m_array; do { - ring->mask = (ring->mask << 1) + 1; - } while (ring->mask < ring->visible_rows || ring->writable + ring->mask + 1 <= ring->end); + m_mask = (m_mask << 1) + 1; + } while (m_mask < m_visible_rows || m_writable + m_mask + 1 <= m_end); - _vte_debug_print(VTE_DEBUG_RING, "Enlarging writable array from %lu to %lu\n", old_mask, ring->mask); + _vte_debug_print(VTE_DEBUG_RING, "Enlarging writable array from %lu to %lu\n", old_mask, m_mask); - ring->array = (VteRowData *) g_malloc0 (sizeof (ring->array[0]) * (ring->mask + 1)); + m_array = (VteRowData* ) g_malloc0(sizeof (m_array[0]) * (m_mask + 1)); - new_mask = ring->mask; - new_array = ring->array; + new_mask = m_mask; + new_array = m_array; - end = ring->writable + old_mask + 1; - for (i = ring->writable; i < end; i++) + end = m_writable + old_mask + 1; + for (i = m_writable; i < end; i++) new_array[i & new_mask] = old_array[i & old_mask]; g_free (old_array); } -static void -_vte_ring_ensure_writable (VteRing *ring, gulong position) +void +Ring::ensure_writable(row_t position) { - if (G_LIKELY (position >= ring->writable)) + if (G_LIKELY(position >= m_writable)) return; _vte_debug_print(VTE_DEBUG_RING, "Ensure writable %lu.\n", position); - while (position < ring->writable) - _vte_ring_thaw_one_row (ring); + //FIXMEchpe surely this can be optimised + while (position < m_writable) + thaw_one_row(); } /** - * _vte_ring_resize: - * @ring: a #VteRing + * Ring::resize: * @max_rows: new maximum numbers of rows in the ring * * Changes the number of lines the ring can contain. */ void -_vte_ring_resize (VteRing *ring, gulong max_rows) +Ring::resize(row_t max_rows) { _vte_debug_print(VTE_DEBUG_RING, "Resizing to %lu.\n", max_rows); - _vte_ring_validate(ring); + + validate(); /* Adjust the start of tail chunk now */ - if ((gulong) _vte_ring_length (ring) > max_rows) { - ring->start = ring->end - max_rows; - if (ring->start >= ring->writable) { - _vte_ring_reset_streams (ring, ring->writable); - ring->writable = ring->start; + if (length() > max_rows) { + m_start = m_end - max_rows; + if (m_start >= m_writable) { + reset_streams(m_writable); + m_writable = m_start; } } - ring->max = max_rows; + m_max = max_rows; } void -_vte_ring_shrink (VteRing *ring, gulong max_len) +Ring::shrink(row_t max_len) { - if ((gulong) _vte_ring_length (ring) <= max_len) + if (length() <= max_len) return; _vte_debug_print(VTE_DEBUG_RING, "Shrinking to %lu.\n", max_len); - _vte_ring_validate(ring); - if (ring->writable - ring->start <= max_len) - ring->end = ring->start + max_len; + validate(); + + if (m_writable - m_start <= max_len) + m_end = m_start + max_len; else { - while (ring->writable - ring->start > max_len) { - _vte_ring_ensure_writable (ring, ring->writable - 1); - ring->end = ring->writable; + while (m_writable - m_start > max_len) { + ensure_writable(m_writable - 1); + m_end = m_writable; } } - /* TODO May want to shrink down ring->array */ + /* TODO May want to shrink down m_array */ - _vte_ring_validate(ring); + validate(); } /** - * _vte_ring_insert_internal: - * @ring: a #VteRing + * Ring::insert: * @position: an index * * Inserts a new, empty, row into @ring at the @position'th offset. @@ -874,89 +839,87 @@ * * Return: the newly added row. */ -VteRowData * -_vte_ring_insert (VteRing *ring, gulong position) +VteRowData* +Ring::insert(row_t position) { - gulong i; - VteRowData *row, tmp; + row_t i; + VteRowData* row, tmp; _vte_debug_print(VTE_DEBUG_RING, "Inserting at position %lu.\n", position); - _vte_ring_validate(ring); + validate(); - _vte_ring_maybe_discard_one_row (ring); + maybe_discard_one_row(); + ensure_writable(position); + ensure_writable_room(); + + g_assert_cmpuint (position, >=, m_writable); + g_assert_cmpuint (position, <=, m_end); + + //FIXMEchpe WTF use better data structures! + tmp = *get_writable_index(m_end); + for (i = m_end; i > position; i--) + *get_writable_index(i) = *get_writable_index(i - 1); + *get_writable_index(position) = tmp; - _vte_ring_ensure_writable (ring, position); - _vte_ring_ensure_writable_room (ring); - - g_assert (position >= ring->writable && position <= ring->end); - - tmp = *_vte_ring_writable_index (ring, ring->end); - for (i = ring->end; i > position; i--) - *_vte_ring_writable_index (ring, i) = *_vte_ring_writable_index (ring, i - 1); - *_vte_ring_writable_index (ring, position) = tmp; - - row = _vte_ring_writable_index (ring, position); + row = get_writable_index(position); _vte_row_data_clear (row); - ring->end++; + m_end++; - _vte_ring_maybe_freeze_one_row (ring); - - _vte_ring_validate(ring); + maybe_freeze_one_row(); + validate(); return row; } /** - * _vte_ring_remove: - * @ring: a #VteRing + * Ring::remove: * @position: an index * * Removes the @position'th item from @ring. */ void -_vte_ring_remove (VteRing * ring, gulong position) +Ring::remove(row_t position) { - gulong i; + row_t i; VteRowData tmp; _vte_debug_print(VTE_DEBUG_RING, "Removing item at position %lu.\n", position); - _vte_ring_validate(ring); + validate(); - if (G_UNLIKELY (!_vte_ring_contains (ring, position))) + if (G_UNLIKELY(!contains(position))) return; - _vte_ring_ensure_writable (ring, position); + ensure_writable(position); - tmp = *_vte_ring_writable_index (ring, position); - for (i = position; i < ring->end - 1; i++) - *_vte_ring_writable_index (ring, i) = *_vte_ring_writable_index (ring, i + 1); - *_vte_ring_writable_index (ring, ring->end - 1) = tmp; + //FIXMEchpe WTF as above + tmp = *get_writable_index(position); + for (i = position; i < m_end - 1; i++) + *get_writable_index(i) = *get_writable_index(i + 1); + *get_writable_index(m_end - 1) = tmp; - if (ring->end > ring->writable) - ring->end--; + if (m_end > m_writable) + m_end--; - _vte_ring_validate(ring); + validate(); } /** - * _vte_ring_append: - * @ring: a #VteRing + * Ring::append: * @data: the new item * * Appends a new item to the ring. * * Return: the newly added row. */ -VteRowData * -_vte_ring_append (VteRing * ring) +VteRowData* +Ring::append() { - return _vte_ring_insert (ring, _vte_ring_next (ring)); + return insert(next()); } /** - * _vte_ring_drop_scrollback: - * @ring: a #VteRing + * Ring::drop_scrollback: * @position: drop contents up to this point, which must be in the writable region. * * Drop the scrollback (offscreen contents). @@ -964,77 +927,75 @@ * TODOegmont: We wouldn't need the position argument after addressing 708213#c29. */ void -_vte_ring_drop_scrollback (VteRing * ring, gulong position) +Ring::drop_scrollback(row_t position) { - _vte_ring_ensure_writable (ring, position); + ensure_writable(position); - ring->start = ring->writable = position; - _vte_ring_reset_streams (ring, position); + m_start = m_writable = position; + reset_streams(position); } - /** - * _vte_ring_set_visible_rows: - * @ring: a #VteRing + * Ring::set_visible_rows: + * @rows: the number of visible rows * * Set the number of visible rows. * It's required to be set correctly for the alternate screen so that it * never hits the streams. It's also required for clearing the scrollback. */ void -_vte_ring_set_visible_rows (VteRing *ring, gulong rows) +Ring::set_visible_rows(row_t rows) { - ring->visible_rows = rows; + m_visible_rows = rows; } -/* Convert a (row,col) into a VteCellTextOffset. +/* Convert a (row,col) into a CellTextOffset. * Requires the row to be frozen, or be outsize the range covered by the ring. */ -static gboolean -_vte_frozen_row_column_to_text_offset (VteRing *ring, - gulong position, - gulong column, - VteCellTextOffset *offset) +bool +Ring::frozen_row_column_to_text_offset(row_t position, + column_t column, + CellTextOffset* offset) { - VteRowRecord records[2]; + RowRecord records[2]; VteCell *cell; - GString *buffer = ring->utf8_buffer; - const VteRowData *row; + GString *buffer = m_utf8_buffer; + VteRowData const* row; unsigned int i, num_chars, off; - if (position >= ring->end) { - offset->text_offset = _vte_stream_head (ring->text_stream) + position - ring->end; + if (position >= m_end) { + offset->text_offset = _vte_stream_head(m_text_stream) + position - m_end; offset->fragment_cells = 0; offset->eol_cells = column; - return TRUE; + return true; } - if (G_UNLIKELY (position < ring->start)) { + if (G_UNLIKELY (position < m_start)) { /* This happens when the marker (saved cursor position) is scrolled off at the top of the scrollback buffer. */ - position = ring->start; + position = m_start; column = 0; /* go on */ } - g_assert(position < ring->writable); - if (!_vte_ring_read_row_record (ring, &records[0], position)) - return FALSE; - if ((position + 1) * sizeof (records[0]) < _vte_stream_head (ring->row_stream)) { - if (!_vte_ring_read_row_record (ring, &records[1], position + 1)) - return FALSE; + g_assert_cmpuint(position, <, m_writable); + if (!read_row_record(&records[0], position)) + return false; + if ((position + 1) * sizeof (records[0]) < _vte_stream_head(m_row_stream)) { + if (!read_row_record(&records[1], position + 1)) + return false; } else - records[1].text_start_offset = _vte_stream_head (ring->text_stream); + records[1].text_start_offset = _vte_stream_head(m_text_stream); g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset); - if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len)) - return FALSE; + if (!_vte_stream_read(m_text_stream, records[0].text_start_offset, buffer->str, buffer->len)) + return false; if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n')) buffer->len--; - row = _vte_ring_index(ring, position); + row = index(position); /* row and buffer now contain the same text, in different representation */ @@ -1062,57 +1023,57 @@ if ((buffer->str[off] & 0xC0) != 0x80) num_chars--; } offset->text_offset = records[0].text_start_offset + off; - return TRUE; + return true; } -/* Given a row number and a VteCellTextOffset, compute the column within that row. - It's the caller's responsibility to ensure that VteCellTextOffset really falls into that row. +/* Given a row number and a CellTextOffset, compute the column within that row. + It's the caller's responsibility to ensure that CellTextOffset really falls into that row. Requires the row to be frozen, or be outsize the range covered by the ring. */ -static gboolean -_vte_frozen_row_text_offset_to_column (VteRing *ring, - gulong position, - const VteCellTextOffset *offset, - long *column) +bool +Ring::frozen_row_text_offset_to_column(row_t position, + CellTextOffset const* offset, + column_t* column) { - VteRowRecord records[2]; + RowRecord records[2]; VteCell *cell; - GString *buffer = ring->utf8_buffer; - const VteRowData *row; + GString *buffer = m_utf8_buffer; + VteRowData const* row; unsigned int i, off, num_chars, nc; - if (position >= ring->end) { + if (position >= m_end) { *column = offset->eol_cells; - return TRUE; + return true; } - if (G_UNLIKELY (position < ring->start)) { + if (G_UNLIKELY (position < m_start)) { /* This happens when the marker (saved cursor position) is scrolled off at the top of the scrollback buffer. */ *column = 0; - return TRUE; + return true; } - g_assert_cmpuint(position, <, ring->writable); - if (!_vte_ring_read_row_record (ring, &records[0], position)) - return FALSE; - if ((position + 1) * sizeof (records[0]) < _vte_stream_head (ring->row_stream)) { - if (!_vte_ring_read_row_record (ring, &records[1], position + 1)) - return FALSE; + g_assert_cmpuint(position, <, m_writable); + if (!read_row_record(&records[0], position)) + return false; + if ((position + 1) * sizeof (records[0]) < _vte_stream_head(m_row_stream)) { + if (!read_row_record(&records[1], position + 1)) + return false; } else - records[1].text_start_offset = _vte_stream_head (ring->text_stream); + records[1].text_start_offset = _vte_stream_head (m_text_stream); - g_assert(offset->text_offset >= records[0].text_start_offset && offset->text_offset < records[1].text_start_offset); + g_assert_cmpuint(offset->text_offset, >=, records[0].text_start_offset); + g_assert_cmpuint(offset->text_offset, <, records[1].text_start_offset); g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset); - if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len)) - return FALSE; + if (!_vte_stream_read(m_text_stream, records[0].text_start_offset, buffer->str, buffer->len)) + return false; if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n')) buffer->len--; - row = _vte_ring_index(ring, position); + row = index(position); /* row and buffer now contain the same text, in different representation */ @@ -1138,15 +1099,14 @@ if (G_UNLIKELY (offset->eol_cells >= 0 && i == row->len)) i += offset->eol_cells; *column = i; - return TRUE; + return true; } /** - * _vte_ring_rewrap: - * @ring: a #VteRing + * Ring::rewrap: * @columns: new number of columns - * @markers: NULL-terminated array of #VteVisualPosition + * @markers: 0-terminated array of #VteVisualPosition * * Reflow the @ring to match the new number of @columns. * For all @markers, find the cell at that position and update them to @@ -1154,17 +1114,16 @@ */ /* See ../doc/rewrap.txt for design and implementation details. */ void -_vte_ring_rewrap (VteRing *ring, - glong columns, - VteVisualPosition **markers) +Ring::rewrap(column_t columns, + VteVisualPosition** markers) { - gulong old_row_index, new_row_index; + row_t old_row_index, new_row_index; int i; int num_markers = 0; - VteCellTextOffset *marker_text_offsets; + CellTextOffset *marker_text_offsets; VteVisualPosition *new_markers; - VteRowRecord old_record; - VteCellAttrChange attr_change; + RowRecord old_record; + CellAttrChange attr_change; VteStream *new_row_stream; gsize paragraph_start_text_offset; gsize paragraph_end_text_offset; @@ -1172,26 +1131,26 @@ gsize attr_offset; gsize old_ring_end; - if (_vte_ring_length(ring) == 0) + if (G_UNLIKELY(length() == 0)) return; _vte_debug_print(VTE_DEBUG_RING, "Ring before rewrapping:\n"); - _vte_ring_validate(ring); - new_row_stream = _vte_file_stream_new (); + validate(); + new_row_stream = _vte_file_stream_new(); /* Freeze everything, because rewrapping is really complicated and we don't want to duplicate the code for frozen and thawed rows. */ - while (ring->writable < ring->end) - _vte_ring_freeze_one_row(ring); + while (m_writable < m_end) + freeze_one_row(); /* For markers given as (row,col) pairs find their offsets in the text stream. This code requires that the rows are already frozen. */ - while (markers[num_markers] != NULL) + while (markers[num_markers] != nullptr) num_markers++; - marker_text_offsets = (VteCellTextOffset *) g_malloc(num_markers * sizeof (marker_text_offsets[0])); + marker_text_offsets = (CellTextOffset *) g_malloc(num_markers * sizeof (marker_text_offsets[0])); new_markers = (VteVisualPosition *) g_malloc(num_markers * sizeof (new_markers[0])); for (i = 0; i < num_markers; i++) { /* Convert visual column into byte offset */ - if (!_vte_frozen_row_column_to_text_offset(ring, markers[i]->row, markers[i]->col, &marker_text_offsets[i])) + if (!frozen_row_column_to_text_offset(markers[i]->row, markers[i]->col, &marker_text_offsets[i])) goto err; new_markers[i].row = new_markers[i].col = -1; _vte_debug_print(VTE_DEBUG_RING, @@ -1201,41 +1160,42 @@ } /* Prepare for rewrapping */ - if (!_vte_ring_read_row_record(ring, &old_record, ring->start)) + if (!read_row_record(&old_record, m_start)) goto err; paragraph_start_text_offset = old_record.text_start_offset; - paragraph_end_text_offset = _vte_stream_head (ring->text_stream); /* initialized to silence gcc */ + paragraph_end_text_offset = _vte_stream_head(m_text_stream); /* initialized to silence gcc */ new_row_index = 0; attr_offset = old_record.attr_start_offset; - if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { - _attrcpy(&attr_change.attr, &ring->last_attr); - attr_change.attr.hyperlink_length = hyperlink_get(ring, ring->last_attr.hyperlink_idx)->len; - attr_change.text_end_offset = _vte_stream_head (ring->text_stream); + if (!_vte_stream_read(m_attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { + _attrcpy(&attr_change.attr, &m_last_attr); + attr_change.attr.hyperlink_length = hyperlink_get(m_last_attr.hyperlink_idx)->len; + attr_change.text_end_offset = _vte_stream_head(m_text_stream); } - old_row_index = ring->start + 1; - while (paragraph_start_text_offset < _vte_stream_head (ring->text_stream)) { + old_row_index = m_start + 1; + while (paragraph_start_text_offset < _vte_stream_head(m_text_stream)) { /* Find the boundaries of the next paragraph */ gboolean prev_record_was_soft_wrapped = FALSE; gboolean paragraph_is_ascii = TRUE; gsize paragraph_start_row = old_row_index - 1; gsize paragraph_end_row; /* points to beyond the end */ gsize text_offset = paragraph_start_text_offset; - VteRowRecord new_record; - glong col = 0; + RowRecord new_record; + column_t col = 0; + _vte_debug_print(VTE_DEBUG_RING, " Old paragraph: row %" G_GSIZE_FORMAT " (text_offset %" G_GSIZE_FORMAT ") up to (exclusive) ", /* no '\n' */ paragraph_start_row, paragraph_start_text_offset); - while (old_row_index <= ring->end) { + while (old_row_index <= m_end) { prev_record_was_soft_wrapped = old_record.soft_wrapped; paragraph_is_ascii = paragraph_is_ascii && old_record.is_ascii; - if (G_LIKELY (old_row_index < ring->end)) { - if (!_vte_ring_read_row_record(ring, &old_record, old_row_index)) + if (G_LIKELY (old_row_index < m_end)) { + if (!read_row_record(&old_record, old_row_index)) goto err; paragraph_end_text_offset = old_record.text_start_offset; } else { - paragraph_end_text_offset = _vte_stream_head (ring->text_stream); + paragraph_end_text_offset = _vte_stream_head (m_text_stream); } old_row_index++; if (!prev_record_was_soft_wrapped) @@ -1255,10 +1215,10 @@ if (attr_change.text_end_offset <= text_offset) { /* Attr change at paragraph boundary, advance to next attr. */ attr_offset += sizeof (attr_change) + attr_change.attr.hyperlink_length + 2; - if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { - _attrcpy(&attr_change.attr, &ring->last_attr); - attr_change.attr.hyperlink_length = hyperlink_get(ring, ring->last_attr.hyperlink_idx)->len; - attr_change.text_end_offset = _vte_stream_head (ring->text_stream); + if (!_vte_stream_read(m_attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { + _attrcpy(&attr_change.attr, &m_last_attr); + attr_change.attr.hyperlink_length = hyperlink_get(m_last_attr.hyperlink_idx)->len; + attr_change.text_end_offset = _vte_stream_head(m_text_stream); } } memset(&new_record, 0, sizeof (new_record)); @@ -1272,10 +1232,10 @@ if (attr_change.text_end_offset <= text_offset) { /* Attr change at line boundary, advance to next attr. */ attr_offset += sizeof (attr_change) + attr_change.attr.hyperlink_length + 2; - if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { - _attrcpy(&attr_change.attr, &ring->last_attr); - attr_change.attr.hyperlink_length = hyperlink_get(ring, ring->last_attr.hyperlink_idx)->len; - attr_change.text_end_offset = _vte_stream_head (ring->text_stream); + if (!_vte_stream_read(m_attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) { + _attrcpy(&attr_change.attr, &m_last_attr); + attr_change.attr.hyperlink_length = hyperlink_get(m_last_attr.hyperlink_idx)->len; + attr_change.text_end_offset = _vte_stream_head(m_text_stream); } } runlength = MIN(paragraph_len, attr_change.text_end_offset - text_offset); @@ -1289,7 +1249,7 @@ if (col >= columns - attr_change.attr.columns() + 1) { /* Wrap now, write the soft wrapped row's record */ new_record.soft_wrapped = 1; - _vte_stream_append(new_row_stream, (const char *) &new_record, sizeof (new_record)); + _vte_stream_append(new_row_stream, (char const* ) &new_record, sizeof (new_record)); _vte_debug_print(VTE_DEBUG_RING, " New row %ld text_offset %" G_GSIZE_FORMAT " attr_offset %" G_GSIZE_FORMAT " soft_wrapped\n", new_row_index, @@ -1323,7 +1283,7 @@ /* Find beginning of next UTF-8 character */ text_offset++; paragraph_len--; runlength--; textbuf_len = MIN(runlength, sizeof (textbuf)); - if (!_vte_stream_read(ring->text_stream, text_offset, textbuf, textbuf_len)) + if (!_vte_stream_read(m_text_stream, text_offset, textbuf, textbuf_len)) goto err; for (i = 0; i < textbuf_len && (textbuf[i] & 0xC0) == 0x80; i++) { text_offset++; paragraph_len--; runlength--; @@ -1336,7 +1296,7 @@ /* Write the record of the paragraph's last row. */ /* Hard wrapped, except maybe at the end of the very last paragraph */ new_record.soft_wrapped = prev_record_was_soft_wrapped; - _vte_stream_append(new_row_stream, (const char *) &new_record, sizeof (new_record)); + _vte_stream_append(new_row_stream, (char const* ) &new_record, sizeof (new_record)); _vte_debug_print(VTE_DEBUG_RING, " New row %ld text_offset %" G_GSIZE_FORMAT " attr_offset %" G_GSIZE_FORMAT "\n", new_row_index, @@ -1354,22 +1314,22 @@ } /* Update the ring. */ - old_ring_end = ring->end; - g_object_unref(ring->row_stream); - ring->row_stream = new_row_stream; - ring->writable = ring->end = new_row_index; - ring->start = 0; - if (ring->end > ring->max) - ring->start = ring->end - ring->max; - ring->cached_row_num = (gulong) -1; + old_ring_end = m_end; + g_object_unref(m_row_stream); + m_row_stream = new_row_stream; + m_writable = m_end = new_row_index; + m_start = 0; + if (m_end > m_max) + m_start = m_end - m_max; + m_cached_row_num = (row_t) -1; /* Find the markers. This requires that the ring is already updated. */ for (i = 0; i < num_markers; i++) { /* Compute the row for markers beyond the ring */ if (new_markers[i].row == -1) - new_markers[i].row = markers[i]->row - old_ring_end + ring->end; + new_markers[i].row = markers[i]->row - old_ring_end + m_end; /* Convert byte offset into visual column */ - if (!_vte_frozen_row_text_offset_to_column(ring, new_markers[i].row, &marker_text_offsets[i], &new_markers[i].col)) + if (!frozen_row_text_offset_to_column(new_markers[i].row, &marker_text_offsets[i], &new_markers[i].col)) goto err; _vte_debug_print(VTE_DEBUG_RING, "Marker #%d new coords: text_offset %" G_GSIZE_FORMAT " fragment_cells %d eol_cells %d -> row %ld col %ld\n", @@ -1382,7 +1342,7 @@ g_free(new_markers); _vte_debug_print(VTE_DEBUG_RING, "Ring after rewrapping:\n"); - _vte_ring_validate(ring); + validate(); return; err: @@ -1397,20 +1357,19 @@ } -static gboolean -_vte_ring_write_row (VteRing *ring, - GOutputStream *stream, - VteRowData *row, - VteWriteFlags flags, - GCancellable *cancellable, - GError **error) +bool +Ring::write_row(GOutputStream* stream, + VteRowData* row, + VteWriteFlags flags, + GCancellable* cancellable, + GError** error) { VteCell *cell; - GString *buffer = ring->utf8_buffer; + GString *buffer = m_utf8_buffer; int i; gsize bytes_written; - /* Simple version of the loop in _vte_ring_freeze_row(). + /* Simple version of the loop in freeze_row(). * TODO Should unify one day */ g_string_set_size (buffer, 0); for (i = 0, cell = row->cells; i < row->len; i++, cell++) { @@ -1424,36 +1383,34 @@ } /** - * _vte_ring_write_contents: - * @ring: a #VteRing + * Ring::write_contents: * @stream: a #GOutputStream to write to * @flags: a set of #VteWriteFlags - * @cancellable: optional #GCancellable object, %NULL to ignore - * @error: a #GError location to store the error occuring, or %NULL to ignore + * @cancellable: optional #GCancellable object, %nullptr to ignore + * @error: a #GError location to store the error occuring, or %nullptr to ignore * * Write entire ring contents to @stream according to @flags. * * Return: %TRUE on success, %FALSE if there was an error */ -gboolean -_vte_ring_write_contents (VteRing *ring, - GOutputStream *stream, - VteWriteFlags flags, - GCancellable *cancellable, - GError **error) +bool +Ring::write_contents(GOutputStream* stream, + VteWriteFlags flags, + GCancellable* cancellable, + GError** error) { - gulong i; + row_t i; _vte_debug_print(VTE_DEBUG_RING, "Writing contents to GOutputStream.\n"); - if (ring->start < ring->writable) + if (m_start < m_writable) { - VteRowRecord record; + RowRecord record; - if (_vte_ring_read_row_record (ring, &record, ring->start)) + if (read_row_record(&record, m_start)) { gsize start_offset = record.text_start_offset; - gsize end_offset = _vte_stream_head (ring->text_stream); + gsize end_offset = _vte_stream_head(m_text_stream); char buf[4096]; while (start_offset < end_offset) { @@ -1461,28 +1418,29 @@ len = MIN (G_N_ELEMENTS (buf), end_offset - start_offset); - if (!_vte_stream_read (ring->text_stream, start_offset, + if (!_vte_stream_read (m_text_stream, start_offset, buf, len)) - return FALSE; + return false; if (!g_output_stream_write_all (stream, buf, len, &bytes_written, cancellable, error)) - return FALSE; + return false; start_offset += len; } } else - return FALSE; + //FIXMEchpe g_set_error!! + return false; } - for (i = ring->writable; i < ring->end; i++) { - if (!_vte_ring_write_row (ring, stream, - _vte_ring_writable_index (ring, i), - flags, cancellable, error)) - return FALSE; + for (i = m_writable; i < m_end; i++) { + if (!write_row(stream, + get_writable_index(i), + flags, cancellable, error)) + return false; } - return TRUE; + return true; } diff -Nru vte2.91-0.52.2/src/ring.h vte2.91-0.54.0/src/ring.h --- vte2.91-0.52.2/src/ring.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/ring.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2002,2009,2010 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Red Hat Author(s): Behdad Esfahbod - */ - -/* The interfaces in this file are subject to change at any time. */ - -#ifndef vte_ring_h_included -#define vte_ring_h_included - -#include -#include - -#include "vterowdata.h" -#include "vtestream.h" - -G_BEGIN_DECLS - - -typedef guint32 hyperlink_idx_t; - -typedef struct _VteVisualPosition { - long row, col; -} VteVisualPosition; - -typedef struct _VteCellAttrChange { - gsize text_end_offset; /* offset of first character no longer using this attr */ - VteStreamCellAttr attr; -} VteCellAttrChange; - - -/* - * VteRing: A scrollback buffer ring - */ - -typedef struct _VteRing VteRing; -struct _VteRing { - gulong max; - - gulong start, end; - - /* Writable */ - gulong writable, mask; - VteRowData *array; - - /* Storage: - * - * row_stream contains records of VteRowRecord for each physical row. - * (This stream is regenerated when the contents rewrap on resize.) - * - * text_stream is the text in UTF-8. - * - * attr_stream contains entries that consist of: - * - a VteCellAttrChange. - * - a string of attr.hyperlink_length length containing the (typically empty) hyperlink data. - * As far as the ring is concerned, this hyperlink data is opaque. Only the caller cares that - * if nonempty, it actually contains the ID and URI separated with a semicolon. Not NUL terminated. - * - 2 bytes repeating attr.hyperlink_length so that we can walk backwards. - */ - VteStream *attr_stream, *text_stream, *row_stream; - gsize last_attr_text_start_offset; - VteCellAttr last_attr; - GString *utf8_buffer; - - VteRowData cached_row; - gulong cached_row_num; - - gboolean has_streams; - gulong visible_rows; /* to keep at least a screenful of lines in memory, bug 646098 comment 12 */ - - GPtrArray *hyperlinks; /* The hyperlink pool. Contains GString* items. - [0] points to an empty GString, [1] to [VTE_HYPERLINK_COUNT_MAX] contain the id;uri pairs. */ - char hyperlink_buf[VTE_HYPERLINK_TOTAL_LENGTH_MAX + 1]; /* One more hyperlink buffer to get the value if it's not placed in the pool. */ - hyperlink_idx_t hyperlink_highest_used_idx; /* 0 if no hyperlinks at all in the pool. */ - hyperlink_idx_t hyperlink_current_idx; /* The hyperlink idx used for newly created cells. - Must not be GC'd even if doesn't occur onscreen. */ - hyperlink_idx_t hyperlink_hover_idx; /* The hyperlink idx of the hovered cell. - An idx is allocated on hover even if the cell is scrolled out to the streams. */ - gulong hyperlink_maybe_gc_counter; /* Do a GC when it reaches 65536. */ -}; - -#define _vte_ring_contains(__ring, __position) \ - (((gulong) (__position) >= (__ring)->start) && \ - ((gulong) (__position) < (__ring)->end)) -#define _vte_ring_delta(__ring) ((glong) (__ring)->start) -#define _vte_ring_length(__ring) ((glong) ((__ring)->end - (__ring)->start)) -#define _vte_ring_next(__ring) ((glong) (__ring)->end) - -const VteRowData *_vte_ring_index (VteRing *ring, gulong position); -VteRowData *_vte_ring_index_writable (VteRing *ring, gulong position); - -void _vte_ring_init (VteRing *ring, gulong max_rows, gboolean has_streams); -void _vte_ring_fini (VteRing *ring); -void _vte_ring_hyperlink_maybe_gc (VteRing *ring, gulong increment); -hyperlink_idx_t _vte_ring_get_hyperlink_idx (VteRing *ring, const char *hyperlink); -hyperlink_idx_t _vte_ring_get_hyperlink_at_position (VteRing *ring, gulong position, int col, bool update_hover_idx, const char **hyperlink); -long _vte_ring_reset (VteRing *ring); -void _vte_ring_resize (VteRing *ring, gulong max_rows); -void _vte_ring_shrink (VteRing *ring, gulong max_len); -VteRowData *_vte_ring_insert (VteRing *ring, gulong position); -VteRowData *_vte_ring_append (VteRing *ring); -void _vte_ring_remove (VteRing *ring, gulong position); -void _vte_ring_drop_scrollback (VteRing *ring, gulong position); -void _vte_ring_set_visible_rows (VteRing *ring, gulong rows); -void _vte_ring_rewrap (VteRing *ring, glong columns, VteVisualPosition **markers); -gboolean _vte_ring_write_contents (VteRing *ring, - GOutputStream *stream, - VteWriteFlags flags, - GCancellable *cancellable, - GError **error); - -G_END_DECLS - -#endif diff -Nru vte2.91-0.52.2/src/ring.hh vte2.91-0.54.0/src/ring.hh --- vte2.91-0.52.2/src/ring.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/ring.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,263 @@ +/* + * Copyright (C) 2002,2009,2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Red Hat Author(s): Behdad Esfahbod + */ + +/* The interfaces in this file are subject to change at any time. */ + +#pragma once + +#include +#include + +#include "vterowdata.hh" +#include "vtestream.h" + +#include + +typedef struct _VteVisualPosition { + long row, col; +} VteVisualPosition; + +namespace vte { + +namespace base { + +/** + * ring: A scrollback buffer ring + */ +class Ring { +public: + typedef guint32 hyperlink_idx_t; + // FIXME make this size_t (or off_t?) + typedef gulong row_t; + typedef glong column_t; + + static const row_t kDefaultMaxRows = VTE_SCROLLBACK_INIT; + + Ring(row_t max_rows = kDefaultMaxRows, + bool has_streams = false); + ~Ring(); + + // prevent accidents + Ring(Ring& o) = delete; + Ring(Ring const& o) = delete; + Ring(Ring&& o) = delete; + Ring& operator= (Ring& o) = delete; + Ring& operator= (Ring const& o) = delete; + Ring& operator= (Ring&& o) = delete; + + inline bool contains(row_t position) const { + return (position >= m_start && position < m_end); + } + + inline row_t delta() const { return m_start; } + inline row_t length() const { return m_end - m_start; } + inline row_t next() const { return m_end; } + + //FIXMEchpe rename this to at() + //FIXMEchpe use references not pointers + VteRowData const* index(row_t position); /* const? */ + VteRowData* index_writable(row_t position); + + void hyperlink_maybe_gc(row_t increment); + hyperlink_idx_t get_hyperlink_idx(char const* hyperlink); + hyperlink_idx_t get_hyperlink_at_position(row_t position, + column_t col, + bool update_hover_idx, + char const** hyperlink); + + row_t reset(); + void resize(row_t max_rows = kDefaultMaxRows); + void shrink(row_t max_len = kDefaultMaxRows); + VteRowData* insert(row_t position); + VteRowData* append(); + void remove(row_t position); + void drop_scrollback(row_t position); + void set_visible_rows(row_t rows); + void rewrap(column_t columns, + VteVisualPosition** markers); + bool write_contents(GOutputStream* stream, + VteWriteFlags flags, + GCancellable* cancellable, + GError** error); + +private: + + #ifdef VTE_DEBUG + void validate() const; + #endif + + inline GString* hyperlink_get(hyperlink_idx_t idx) const { return (GString*)g_ptr_array_index(m_hyperlinks, idx); } + + inline VteRowData* get_writable_index(row_t position) const { return &m_array[position & m_mask]; } + + void hyperlink_gc(); + hyperlink_idx_t get_hyperlink_idx_no_update_current(char const* hyperlink); + + typedef struct _CellAttrChange { + gsize text_end_offset; /* offset of first character no longer using this attr */ + VteStreamCellAttr attr; + } CellAttrChange; + + typedef struct _RowRecord { + size_t text_start_offset; /* offset where text of this row begins */ + size_t attr_start_offset; /* offset of the first character's attributes */ + int soft_wrapped: 1; /* end of line is not '\n' */ + int is_ascii: 1; /* for rewrapping speedup: guarantees that line contains 32..126 bytes only. Can be 0 even when ascii only. */ + } RowRecord; + + static_assert(std::is_pod::value, "Ring::RowRecord is not POD"); + + /* Represents a cell position, see ../doc/rewrap.txt */ + typedef struct _CellTextOffset { + size_t text_offset; /* byte offset in text_stream (or perhaps beyond) */ + int fragment_cells; /* extra number of cells to walk within a multicell character */ + int eol_cells; /* -1 if over a character, >=0 if at EOL or beyond */ + } CellTextOffset; + + static_assert(std::is_pod::value, "Ring::CellTextOffset is not POD"); + + inline bool read_row_record(RowRecord* record /* out */, + row_t position) + { + return _vte_stream_read(m_row_stream, + position * sizeof(*record), + (char*)record, + sizeof(*record)); + } + + inline void append_row_record(RowRecord const* record, + row_t position) + { + _vte_stream_append(m_row_stream, + (char const*)record, + sizeof(*record)); + } + + bool frozen_row_column_to_text_offset(row_t position, + column_t column, + CellTextOffset* offset); + bool frozen_row_text_offset_to_column(row_t position, + CellTextOffset const* offset, + column_t* column); + + bool write_row(GOutputStream* stream, + VteRowData* row, + VteWriteFlags flags, + GCancellable* cancellable, + GError** error); + + void ensure_writable(row_t position); + void ensure_writable_room(); + + void freeze_one_row(); + void maybe_freeze_one_row(); + void thaw_one_row(); + void discard_one_row(); + void maybe_discard_one_row(); + + void freeze_row(row_t position, + VteRowData const* row); + void thaw_row(row_t position, + VteRowData* row, + bool do_truncate, + int hyperlink_column, + char const** hyperlink); + void reset_streams(row_t position); + + row_t m_max; + row_t m_start{0}; + row_t m_end{0}; + + /* Writable */ + row_t m_writable{0}; + row_t m_mask{31}; + VteRowData *m_array; + + /* Storage: + * + * row_stream contains records of VteRowRecord for each physical row. + * (This stream is regenerated when the contents rewrap on resize.) + * + * text_stream is the text in UTF-8. + * + * attr_stream contains entries that consist of: + * - a VteCellAttrChange. + * - a string of attr.hyperlink_length length containing the (typically empty) hyperlink data. + * As far as the ring is concerned, this hyperlink data is opaque. Only the caller cares that + * if nonempty, it actually contains the ID and URI separated with a semicolon. Not NUL terminated. + * - 2 bytes repeating attr.hyperlink_length so that we can walk backwards. + */ + bool m_has_streams; + VteStream *m_attr_stream, *m_text_stream, *m_row_stream; + size_t m_last_attr_text_start_offset{0}; + VteCellAttr m_last_attr; + GString *m_utf8_buffer; + + VteRowData m_cached_row; + row_t m_cached_row_num{(row_t)-1}; + + row_t m_visible_rows{0}; /* to keep at least a screenful of lines in memory, bug 646098 comment 12 */ + + GPtrArray *m_hyperlinks; /* The hyperlink pool. Contains GString* items. + [0] points to an empty GString, [1] to [VTE_HYPERLINK_COUNT_MAX] contain the id;uri pairs. */ + char m_hyperlink_buf[VTE_HYPERLINK_TOTAL_LENGTH_MAX + 1]; /* One more hyperlink buffer to get the value if it's not placed in the pool. */ + hyperlink_idx_t m_hyperlink_highest_used_idx{0}; /* 0 if no hyperlinks at all in the pool. */ + hyperlink_idx_t m_hyperlink_current_idx{0}; /* The hyperlink idx used for newly created cells. + Must not be GC'd even if doesn't occur onscreen. */ + hyperlink_idx_t m_hyperlink_hover_idx{0}; /* The hyperlink idx of the hovered cell. + An idx is allocated on hover even if the cell is scrolled out to the streams. */ + row_t m_hyperlink_maybe_gc_counter{0}; /* Do a GC when it reaches 65536. */ +}; + +}; /* namespace base */ + +}; /* namespace vte */ + +G_BEGIN_DECLS + +/* temp compat API */ + +typedef vte::base::Ring VteRing; + +static inline bool _vte_ring_contains(VteRing *ring, gulong position) { return ring->contains(position); } +static inline glong _vte_ring_delta(VteRing *ring) { return ring->delta(); } +static inline glong _vte_ring_length(VteRing *ring) { return ring->length(); } +static inline glong _vte_ring_next(VteRing *ring) { return ring->next(); } +static inline const VteRowData *_vte_ring_index (VteRing *ring, gulong position) { return ring->index(position); } +static inline VteRowData *_vte_ring_index_writable (VteRing *ring, gulong position) { return ring->index_writable(position); } +static inline void _vte_ring_hyperlink_maybe_gc (VteRing *ring, gulong increment) { ring->hyperlink_maybe_gc(increment); } +static inline auto _vte_ring_get_hyperlink_idx (VteRing *ring, const char *hyperlink) { return ring->get_hyperlink_idx(hyperlink); } +static inline auto _vte_ring_get_hyperlink_at_position (VteRing *ring, gulong position, int col, bool update_hover_idx, const char **hyperlink) { return ring->get_hyperlink_at_position(position, col, update_hover_idx, hyperlink); } +static inline long _vte_ring_reset (VteRing *ring) { return ring->reset(); } +static inline void _vte_ring_resize (VteRing *ring, gulong max_rows) { ring->resize(max_rows); } +static inline void _vte_ring_shrink (VteRing *ring, gulong max_len) { ring->shrink(max_len); } +static inline VteRowData *_vte_ring_insert (VteRing *ring, gulong position) { return ring->insert(position); } +static inline VteRowData *_vte_ring_append (VteRing *ring) { return ring->append(); } +static inline void _vte_ring_remove (VteRing *ring, gulong position) { ring->remove(position); } +static inline void _vte_ring_drop_scrollback (VteRing *ring, gulong position) { ring->drop_scrollback(position); } +static inline void _vte_ring_set_visible_rows (VteRing *ring, gulong rows) { ring->set_visible_rows(rows); } +static inline void _vte_ring_rewrap (VteRing *ring, glong columns, VteVisualPosition **markers) { ring->rewrap(columns, markers); } +static inline gboolean _vte_ring_write_contents (VteRing *ring, + GOutputStream *stream, + VteWriteFlags flags, + GCancellable *cancellable, + GError **error) { return ring->write_contents(stream, flags, cancellable, error); } + +G_END_DECLS diff -Nru vte2.91-0.52.2/src/table.cc vte2.91-0.54.0/src/table.cc --- vte2.91-0.52.2/src/table.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/table.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,761 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" -#include "iso2022.h" -#include "table.hh" - -/* Table info. */ -#define VTE_TABLE_MAX_LITERAL (128 + 32) -#define _vte_table_map_literal(__c) \ - (((__c) < (VTE_TABLE_MAX_LITERAL)) ? (__c) : 0) -#define _vte_table_is_numeric(__c) \ - (((__c) >= '0') && ((__c) <= '9')) -#define _vte_table_is_numeric_list(__c) \ - ((((__c) >= '0') && ((__c) <= '9')) || (__c) == ';' || (__c) == ':') - -struct _vte_table { - struct _vte_matcher_impl impl; - sequence_handler_t handler; - unsigned char *original; - gssize original_length; - struct _vte_table *table_string; - struct _vte_table *table_number; - struct _vte_table *table_number_list; - struct _vte_table **table; -}; - -/* Argument info. */ -enum _vte_table_argtype { - _vte_table_arg_number=0, - _vte_table_arg_string, - _vte_table_arg_char -}; -struct _vte_table_arginfo { - const gunichar *start; - struct _vte_table_arginfo *next; - guint type:2; - guint length:30; -}; -#define MAX_STACK 16 -struct _vte_table_arginfo_head { - guint stack_allocated; - struct _vte_table_arginfo *list; - struct _vte_table_arginfo stack[MAX_STACK]; -}; - -static void -_vte_table_arginfo_head_init(struct _vte_table_arginfo_head *head) -{ - head->list = NULL; - head->stack_allocated = 0; -} -static inline struct _vte_table_arginfo* -_vte_table_arginfo_alloc(struct _vte_table_arginfo_head *head) -{ - struct _vte_table_arginfo *info; - if (G_LIKELY (head->stack_allocated < G_N_ELEMENTS(head->stack))) { - info = &head->stack[head->stack_allocated++]; - } else { - info = g_slice_new (struct _vte_table_arginfo); - } - info->next = head->list; - head->list = info; - return info; -} -static void -_vte_table_arginfo_head_revert(struct _vte_table_arginfo_head *head, struct _vte_table_arginfo *last) -{ - struct _vte_table_arginfo *info; - info = head->list; - head->list = last->next; - if (last >= &head->stack[0] && - last < &head->stack[G_N_ELEMENTS(head->stack)]){ - head->stack_allocated = last - &head->stack[0]; - } - do { - struct _vte_table_arginfo *next = info->next; - if (info >= &head->stack[0] && - info < &head->stack[G_N_ELEMENTS(head->stack)]){ - break; - } - g_slice_free(struct _vte_table_arginfo, info); - if (info == last) { - break; - } - info = next; - }while (TRUE); -} -static struct _vte_table_arginfo * -_vte_table_arginfo_head_reverse(struct _vte_table_arginfo_head *head) -{ - struct _vte_table_arginfo *prev = NULL; - while (head->list) { - struct _vte_table_arginfo *next = head->list->next; - - head->list->next = prev; - - prev = head->list; - head->list = next; - } - return prev; -} -static void -_vte_table_arginfo_head_finalize(struct _vte_table_arginfo_head *head) -{ - struct _vte_table_arginfo *info, *next; - for (info = head->list; info != NULL; info = next) { - next = info->next; - if (info >= &head->stack[0] && - info < &head->stack[G_N_ELEMENTS(head->stack)]){ - continue; - } - g_slice_free(struct _vte_table_arginfo, info); - } -} - -/* Create an empty, one-level table. */ -struct _vte_table * -_vte_table_new(void) -{ - struct _vte_table * ret; - ret = g_slice_new0(struct _vte_table); - ret->impl.klass = &_vte_matcher_table; - return ret; -} - -static struct _vte_table ** -_vte_table_literal_new(void) -{ - return g_new0(struct _vte_table *, VTE_TABLE_MAX_LITERAL); -} - -/* Free a table. */ -void -_vte_table_free(struct _vte_table *table) -{ - unsigned int i; - if (table->table != NULL) { - for (i = 0; i < VTE_TABLE_MAX_LITERAL; i++) { - if (table->table[i] != NULL) { - _vte_table_free(table->table[i]); - } - } - g_free(table->table); - } - if (table->table_string != NULL) { - _vte_table_free(table->table_string); - } - if (table->table_number != NULL) { - _vte_table_free(table->table_number); - } - if (table->table_number_list != NULL) { - _vte_table_free(table->table_number_list); - } - if (table->original_length == 0) { - g_assert(table->original == NULL); - } else { - g_assert(table->original != NULL); - } - if (table->original != NULL) { - g_free(table->original); - } - g_slice_free(struct _vte_table, table); -} - -static void -_vte_table_addi(struct _vte_table *table, - const unsigned char *original, - gssize original_length, - const char *pattern, - gssize length, - sequence_handler_t handler) -{ - int i; - guint8 check; - struct _vte_table *subtable; - - if (original_length == -1) { - original_length = strlen((char *) original); - } - if (length == -1) { - length = strlen(pattern); - } - - /* If this is the terminal node, set the result. */ - if (length == 0) { - if (table->handler) - _VTE_DEBUG_IF (VTE_DEBUG_PARSE) { - g_printerr ("'%s'", - _vte_debug_sequence_to_string ((const char *)table->original, - table->original_length)); - g_printerr (" and '%s' are indistinguishable.\n", - _vte_debug_sequence_to_string ((const char *)original, - original_length)); - } - - table->handler = handler; - g_free(table->original); - table->original = (unsigned char *) g_memdup(original, original_length); - table->original_length = original_length; - return; - } - - /* All of the interesting arguments begin with '%'. */ - if (pattern[0] == '%') { - /* Handle numeric parameters. */ - if (pattern[1] == 'd') { - /* Create a new subtable. */ - if (table->table_number == NULL) { - subtable = _vte_table_new(); - table->table_number = subtable; - } else { - subtable = table->table_number; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 2, length - 2, - handler); - return; - } - - /* Handle variable-length parameters. */ - if (pattern[1] == 'm') { - /* Build the "new" original using the initial portion - * of the original string and what's left after this - * specifier. */ - { - int initial; - GByteArray *b; - - initial = original_length - length; - b = g_byte_array_new(); - g_byte_array_set_size(b, 0); - g_byte_array_append(b, original, initial); - g_byte_array_append(b, (const guint8*)pattern + 2, length - 2); - _vte_table_addi(table, b->data, b->len, - (const char *)b->data + initial, - b->len - initial, - handler); - g_byte_array_free(b, TRUE); - } - /* Create a new subtable. */ - if (table->table_number_list == NULL) { - subtable = _vte_table_new(); - table->table_number_list = subtable; - } else { - subtable = table->table_number_list; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 2, length - 2, - handler); - return; - } - - /* Handle string parameters. */ - if (pattern[1] == 's') { - /* It must have a terminator. */ - g_assert(length >= 3); - /* Create a new subtable. */ - if (table->table_string == NULL) { - subtable = _vte_table_new(); - table->table_string = subtable; - } else { - subtable = table->table_string; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 2, length - 2, - handler); - return; - } - - /* Handle an escaped '%'. */ - if (pattern[1] == '%') { - /* Create a new subtable. */ - if (table->table == NULL) { - table->table = _vte_table_literal_new(); - subtable = _vte_table_new(); - table->table['%'] = subtable; - } else - if (table->table['%'] == NULL) { - subtable = _vte_table_new(); - table->table['%'] = subtable; - } else { - subtable = table->table['%']; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 2, length - 2, - handler); - return; - } - - /* Handle a parameter character. */ - if (pattern[1] == '+') { - /* It must have an addend. */ - g_assert(length >= 3); - /* Fill in all of the table entries above the given - * character value. */ - for (i = pattern[2]; i < VTE_TABLE_MAX_LITERAL; i++) { - /* Create a new subtable. */ - if (table->table == NULL) { - table->table = _vte_table_literal_new(); - subtable = _vte_table_new(); - table->table[i] = subtable; - } else - if (table->table[i] == NULL) { - subtable = _vte_table_new(); - table->table[i] = subtable; - } else { - subtable = table->table[i]; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, - original, original_length, - pattern + 3, length - 3, - handler); - } - /* Also add a subtable for higher characters. */ - if (table->table == NULL) { - table->table = _vte_table_literal_new(); - subtable = _vte_table_new(); - table->table[0] = subtable; - } else - if (table->table[0] == NULL) { - subtable = _vte_table_new(); - table->table[0] = subtable; - } else { - subtable = table->table[0]; - } - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 3, length - 3, - handler); - return; - } - } - - /* A literal (or an unescaped '%', which is also a literal). */ - check = (guint8) pattern[0]; - g_assert(check < VTE_TABLE_MAX_LITERAL); - if (table->table == NULL) { - table->table = _vte_table_literal_new(); - subtable = _vte_table_new(); - table->table[check] = subtable; - } else - if (table->table[check] == NULL) { - subtable = _vte_table_new(); - table->table[check] = subtable; - } else { - subtable = table->table[check]; - } - - /* Add the rest of the string to the subtable. */ - _vte_table_addi(subtable, original, original_length, - pattern + 1, length - 1, - handler); -} - -/* Add a string to the matching tree. */ -void -_vte_table_add(struct _vte_table *table, - const char *pattern, - gssize length, - sequence_handler_t handler) -{ - _vte_table_addi(table, - (const unsigned char *) pattern, length, - pattern, length, - handler); -} - -/* Match a string in a subtree. */ -static vte_matcher_result_t -_vte_table_matchi(struct _vte_table *table, - const gunichar *candidate, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - unsigned char **original, - gssize *original_length, - struct _vte_table_arginfo_head *params) -{ - int i = 0; - struct _vte_table *subtable = NULL; - struct _vte_table_arginfo *arginfo; - - /* Check if this is a result node. */ - if (table->handler) { - *consumed = candidate; - *original = table->original; - *original_length = table->original_length; - *handler = table->handler; - return VTE_MATCHER_RESULT_MATCH; - } - - /* If we're out of data, but we still have children, return the empty - * string. */ - if (G_UNLIKELY (length == 0)) { - *consumed = candidate; - *handler = nullptr; - return VTE_MATCHER_RESULT_PARTIAL; - } - - /* Check if this node has a string disposition. */ - if (table->table_string != NULL) { - /* Iterate over all non-terminator values. */ - subtable = table->table_string; - for (i = 0; i < length; i++) { - if ((subtable->table != NULL) && - (subtable->table[_vte_table_map_literal(candidate[i])] != NULL)) { - break; - } - } - /* Save the parameter info. */ - arginfo = _vte_table_arginfo_alloc(params); - arginfo->type = _vte_table_arg_string; - arginfo->start = candidate; - arginfo->length = i; - /* Continue. */ - return _vte_table_matchi(subtable, candidate + i, length - i, - handler, consumed, - original, original_length, params); - } - - /* Check if this could be a list. */ - if ((_vte_table_is_numeric_list(candidate[0])) && - (table->table_number_list != NULL)) { - - subtable = table->table_number_list; - /* Iterate over all numeric characters, ';' and ':'. */ - for (i = 1; i < length; i++) { - if (!_vte_table_is_numeric_list(candidate[i])) { - break; - } - } - /* Save the parameter info. */ - arginfo = _vte_table_arginfo_alloc(params); - arginfo->type = _vte_table_arg_number; - arginfo->start = candidate; - arginfo->length = i; - - /* Try and continue. */ - auto local_result = _vte_table_matchi(subtable, - candidate + i, length - i, - handler, consumed, - original, original_length, - params); - if (local_result != VTE_MATCHER_RESULT_NO_MATCH) { - return local_result; - } - _vte_table_arginfo_head_revert (params, arginfo); - - /* try again */ - } - - /* Check if this could be a number. */ - if ((_vte_table_is_numeric(candidate[0])) && - (table->table_number != NULL)) { - subtable = table->table_number; - /* Iterate over all numeric characters. */ - for (i = 1; i < length; i++) { - if (!_vte_table_is_numeric(candidate[i])) { - break; - } - } - /* Save the parameter info. */ - arginfo = _vte_table_arginfo_alloc(params); - arginfo->type = _vte_table_arg_number; - arginfo->start = candidate; - arginfo->length = i; - /* Continue. */ - return _vte_table_matchi(subtable, candidate + i, length - i, - handler, consumed, - original, original_length, params); - } - - /* Check for an exact match. */ - if ((table->table != NULL) && - (table->table[_vte_table_map_literal(candidate[0])] != NULL)) { - subtable = table->table[_vte_table_map_literal(candidate[0])]; - /* Save the parameter info. */ - arginfo = _vte_table_arginfo_alloc(params); - arginfo->type = _vte_table_arg_char; - arginfo->start = candidate; - arginfo->length = 1; - /* Continue. */ - return _vte_table_matchi(subtable, candidate + 1, length - 1, - handler, consumed, - original, original_length, params); - } - - /* If there's nothing else to do, then we can't go on. Keep track of - * where we are. */ - *consumed = candidate; - *handler = nullptr; - return VTE_MATCHER_RESULT_NO_MATCH; -} - -static void -_vte_table_extract_numbers(GValueArray **array, - struct _vte_table_arginfo *arginfo) -{ - if (G_UNLIKELY (*array == NULL)) { - *array = g_value_array_new(1); - } - - GValue value = {0,}; - g_value_init(&value, G_TYPE_LONG); - gssize i = 0; - GValueArray *subarray = nullptr; - do { - long total = 0; - for (; i < arginfo->length && arginfo->start[i] != ';' && arginfo->start[i] != ':'; i++) { - gint v = g_unichar_digit_value (arginfo->start[i]); - total *= 10; - total += v == -1 ? 0 : v; - } - g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT)); - if (i < arginfo->length && arginfo->start[i] == ':') { - if (subarray == NULL) { - subarray = g_value_array_new(2); - } - g_value_array_append(subarray, &value); - } else { - if (subarray == NULL) { - g_value_array_append(*array, &value); - } else { - g_value_array_append(subarray, &value); - - GValue subvalue = {0,}; - g_value_init(&subvalue, G_TYPE_VALUE_ARRAY); - g_value_take_boxed(&subvalue, subarray); - g_value_array_append(*array, &subvalue); - g_value_unset(&subvalue); - - subarray = NULL; - } - } - } while (i++ < arginfo->length); - g_value_unset(&value); - if (subarray != nullptr) - g_value_array_free(subarray); -} - -static void -_vte_table_extract_string(GValueArray **array, - struct _vte_table_arginfo *arginfo) -{ - GValue value = {0,}; - gunichar *ptr; - - ptr = g_new(gunichar, arginfo->length + 1); - memcpy(ptr, arginfo->start, sizeof(gunichar) * arginfo->length); - ptr[arginfo->length] = '\0'; - g_value_init(&value, G_TYPE_POINTER); - g_value_set_pointer(&value, ptr); - - if (G_UNLIKELY (*array == NULL)) { - *array = g_value_array_new(1); - } - g_value_array_append(*array, &value); - g_value_unset(&value); -} - -/* Check if a string matches something in the tree. */ -vte_matcher_result_t -_vte_table_match(struct _vte_table *table, - const gunichar *candidate, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - GValueArray **array) -{ - struct _vte_table *head; - unsigned char *original, *p; - gssize original_length; - int i; - struct _vte_table_arginfo_head params; - struct _vte_table_arginfo *arginfo; - - g_assert_nonnull(handler); - g_assert_nonnull(consumed); - *consumed = candidate; - - /* Provide a fast path for the usual "not a sequence" cases. */ - if (G_LIKELY (length == 0 || candidate == NULL)) { - *handler = nullptr; - return VTE_MATCHER_RESULT_NO_MATCH; - } - - /* If there's no literal path, and no generic path, and the numeric - * path isn't available, then it's not a sequence, either. */ - if (table->table == NULL || - table->table[_vte_table_map_literal(candidate[0])] == NULL) { - if (table->table_string == NULL) { - if (table->table_number == NULL || - !_vte_table_is_numeric(candidate[0])){ - if (table->table_number_list == NULL || - !_vte_table_is_numeric_list(candidate[0])){ - /* No match. */ - *handler = nullptr; - return VTE_MATCHER_RESULT_NO_MATCH; - } - } - } - } - - /* Check for a literal match. */ - for (i = 0, head = table; i < length && head != NULL; i++) { - if (head->table == NULL) { - head = NULL; - } else { - head = head->table[_vte_table_map_literal(candidate[i])]; - } - } - if (head != NULL && head->handler) { - /* Got a literal match. */ - *consumed = candidate + i; - *handler = head->handler; - return VTE_MATCHER_RESULT_MATCH; - } - - _vte_table_arginfo_head_init (¶ms); - - /* Check for a pattern match. */ - auto ret = _vte_table_matchi(table, candidate, length, - handler, consumed, - &original, &original_length, - ¶ms); - - /* If we got a match, extract the parameters. */ - if (ret == VTE_MATCHER_RESULT_MATCH && array != nullptr) { - g_assert_nonnull(original); - p = original; - arginfo = _vte_table_arginfo_head_reverse (¶ms); - do { - /* All of the interesting arguments begin with '%'. */ - if (p[0] == '%') { - /* Handle an escaped '%'. */ - if (p[1] == '%') { - p++; - } - /* Handle numeric parameters. */ - else if ((p[1] == 'd') || (p[1] == 'm')) { - _vte_table_extract_numbers(array, - arginfo); - p++; - } - /* Handle string parameters. */ - else if (p[1] == 's') { - _vte_table_extract_string(array, - arginfo); - p++; - } else { - _vte_debug_print (VTE_DEBUG_PARSE, - "Invalid sequence %s\n", - original); - } - } /* else Literal. */ - arginfo = arginfo->next; - } while (++p < original + original_length && arginfo); - } - - /* Clean up extracted parameters. */ - _vte_table_arginfo_head_finalize (¶ms); - - return ret; -} - -static void -_vte_table_printi(struct _vte_table *table, const char *lead, int *count) -{ - unsigned int i; - char *newlead = NULL; - - (*count)++; - - /* Result? */ - if (table->handler) { - g_printerr("%s => result\n", _vte_debug_sequence_to_string(lead, -1)); - } - - /* Literal? */ - for (i = 1; i < VTE_TABLE_MAX_LITERAL; i++) { - if ((table->table != NULL) && (table->table[i] != NULL)) { - if (i < 32) { - newlead = g_strdup_printf("%s^%c", - _vte_debug_sequence_to_string(lead, -1), - i + 64); - } else { - newlead = g_strdup_printf("%s%c", - _vte_debug_sequence_to_string(lead, -1), - i); - } - _vte_table_printi(table->table[i], newlead, count); - g_free(newlead); - } - } - - /* String? */ - if (table->table_string != NULL) { - newlead = g_strdup_printf("%s{string}", - _vte_debug_sequence_to_string(lead, -1)); - _vte_table_printi(table->table_string, - newlead, count); - g_free(newlead); - } - - /* Number(+)? */ - if (table->table_number != NULL) { - newlead = g_strdup_printf("%s{number}", - _vte_debug_sequence_to_string(lead, -1)); - _vte_table_printi(table->table_number, - newlead, count); - g_free(newlead); - } -} - -/* Dump out the contents of a tree. */ -void -_vte_table_print(struct _vte_table *table) -{ - int count = 0; - _vte_table_printi(table, "", &count); - g_printerr("%d nodes = %ld bytes.\n", - count, (long) count * sizeof(struct _vte_table)); -} - -const struct _vte_matcher_class _vte_matcher_table = { - (_vte_matcher_create_func)_vte_table_new, - (_vte_matcher_add_func)_vte_table_add, - (_vte_matcher_print_func)_vte_table_print, - (_vte_matcher_match_func)_vte_table_match, - (_vte_matcher_destroy_func)_vte_table_free -}; diff -Nru vte2.91-0.52.2/src/table.hh vte2.91-0.54.0/src/table.hh --- vte2.91-0.52.2/src/table.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/table.hh 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#pragma once - -#include - -struct _vte_table; - -class VteTerminalPrivate; -namespace vte { namespace parser { struct Params; } } - -typedef void (VteTerminalPrivate::* sequence_handler_t)(vte::parser::Params const&); - -/* Create an empty, one-level table. */ -struct _vte_table *_vte_table_new(void); - -/* Free a table tree. */ -void _vte_table_free(struct _vte_table *table); - -/* Add a string to the matching tree. */ -void _vte_table_add(struct _vte_table *table, - const char *pattern, - gssize length, - sequence_handler_t handler); - -/* Check if a string matches something in the tree. */ -vte_matcher_result_t _vte_table_match(struct _vte_table *table, - const gunichar *pattern, - gssize length, - sequence_handler_t *handler, - const gunichar **consumed, - GValueArray **array); -/* Dump out the contents of a tree. */ -void _vte_table_print(struct _vte_table *table); - -extern const struct _vte_matcher_class _vte_matcher_table; diff -Nru vte2.91-0.52.2/src/tabstops.hh vte2.91-0.54.0/src/tabstops.hh --- vte2.91-0.52.2/src/tabstops.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/tabstops.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,222 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +#include +#include + +#include "vtedefines.hh" + +namespace vte { + +namespace terminal { + +class Tabstops { +public: + using position_t = unsigned int; + using signed_position_t = int; + + static position_t const npos = position_t(signed_position_t(-1)); + +private: + typedef unsigned long storage_t; + + /* Number of bits used in storage */ + position_t m_size{0}; + /* Number of blocks in m_storage */ + position_t m_capacity{0}; + /* Bit storage */ + storage_t* m_storage{nullptr}; + + inline position_t bits() const noexcept + { + return 8 * sizeof(storage_t); + } + + inline position_t block(position_t position) const noexcept + { + return position / bits(); + } + + inline position_t block_first(position_t position) const noexcept + { + return position & ~(bits() - 1); + } + + /* Mask with exactly the position's bit set */ + inline storage_t mask(position_t position) const noexcept + { + return storage_t(1) << (position & (bits() - 1)); + } + + /* Mask with all bits set from position (excl.) up to the MSB */ + inline storage_t mask_lower(position_t position) const noexcept + { + return ~(mask(position) | (mask(position) - 1)); + } + + /* Mask with all bits set from 0 to position (excl.) */ + inline storage_t mask_upper(position_t position) const noexcept + { + return mask(position) - 1; + } + + inline position_t next_position(position_t position) const noexcept + { + auto b = block(position); + auto v = m_storage[b] & mask_lower(position); + if (v != 0) + return b * bits() + __builtin_ctzl(v); + + while (++b < m_capacity) { + v = m_storage[b]; + if (v != 0) + return b * bits() + __builtin_ctzl(v); + } + + return npos; + } + + inline position_t previous_position(position_t position) const noexcept + { + auto b = block(position); + auto v = m_storage[b] & mask_upper(position); + if (v != 0) + return (b + 1) * bits() - __builtin_clzl(v) - 1; + + while (b > 0) { + v = m_storage[--b]; + if (v != 0) + return (b + 1) * bits() - __builtin_clzl(v) - 1; + } + + return npos; + } + +public: + Tabstops(position_t size = VTE_COLUMNS, + bool set_default = true, + position_t tab_width = VTE_TAB_WIDTH) noexcept + { + resize(size, set_default, tab_width); + } + + Tabstops(Tabstops const&) = delete; + Tabstops(Tabstops&&) = delete; + + ~Tabstops() + { + free(m_storage); + }; + + Tabstops& operator=(Tabstops const&) = delete; + Tabstops& operator=(Tabstops&&) = delete; + + inline position_t size() const noexcept + { + return m_size; + } + + void resize(position_t size, + bool set_default = true, + position_t tab_width = VTE_TAB_WIDTH) noexcept + { + /* We want an even number of blocks */ + auto const new_capacity = ((size + 8 * sizeof(storage_t) - 1) / (8 * sizeof(storage_t)) + 1) & ~1; + g_assert_cmpuint(new_capacity % 2, ==, 0); + g_assert_cmpuint(new_capacity * 8 * sizeof(storage_t), >=, size); + + if (new_capacity > m_capacity) { + auto const new_capacity_bytes = new_capacity * sizeof(storage_t); + m_storage = reinterpret_cast(realloc(m_storage, new_capacity_bytes)); + } + + if (size > m_size) { + /* Clear storage */ + auto b = block(m_size); + m_storage[b] &= mask_upper(m_size); + while (++b < new_capacity) + m_storage[b] = 0; + } + + auto const old_size = m_size; + m_size = size; + m_capacity = new_capacity; + + if (set_default) { + auto const r = old_size % tab_width; + position_t start = r ? old_size + tab_width - r : old_size; + for (position_t i = start; i < m_size; i += tab_width) + set(i); + } + } + + inline void clear() noexcept + { + memset(m_storage, 0, m_capacity * sizeof(m_storage[0])); + } + + inline void reset(position_t tab_width = VTE_TAB_WIDTH) noexcept + { + clear(); + for (position_t i = 0; i < m_size; i += tab_width) + set(i); + } + + inline void set(position_t position) noexcept + { + assert(position < m_size); + m_storage[block(position)] |= mask(position); + } + + inline void unset(position_t position) noexcept + { + assert(position < m_size); + m_storage[block(position)] &= ~mask(position); + } + + inline bool get(position_t position) const noexcept + { + return (m_storage[block(position)] & mask(position)) != 0; + } + + inline position_t get_next(position_t position, + int count = 1, + position_t endpos = npos) const noexcept + { + while (count-- && position < m_size) + position = next_position(position); + return position < m_size ? position : endpos; + } + + inline position_t get_previous(position_t position, + int count = 1, + position_t endpos = npos) const noexcept + { + while (count-- && position != npos) + position = previous_position(position); + return position != npos ? position : endpos; + } +}; + +} // namespace terminal + +} // namespace vte diff -Nru vte2.91-0.52.2/src/tabstops-test.cc vte2.91-0.54.0/src/tabstops-test.cc --- vte2.91-0.52.2/src/tabstops-test.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/tabstops-test.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,234 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include + +#include + +#include "tabstops.hh" +#include "vtedefines.hh" + +using namespace vte::terminal; + +static void +tabstops_set(Tabstops& t, + std::initializer_list l) +{ + for (auto i : l) + t.set(i); +} + +static void +assert_tabstops_default(Tabstops const& t, + Tabstops::position_t start = 0, + Tabstops::position_t end = Tabstops::position_t(-1), + Tabstops::position_t tab_width = VTE_TAB_WIDTH) +{ + if (end == t.npos) + end = t.size(); + + for (auto i = start; i < end; i++) { + if (i % tab_width) + g_assert_false(t.get(i)); + else + g_assert_true(t.get(i)); + } +} + +static void +assert_tabstops_clear(Tabstops const& t, + Tabstops::position_t start = 0, + Tabstops::position_t end = Tabstops::position_t(-1)) +{ + if (end == t.npos) + end = t.size(); + + for (auto i = start; i < end; i++) + g_assert_false(t.get(i)); +} + +static void +assert_tabstops(Tabstops const& t, + std::initializer_list l, + Tabstops::position_t start = 0, + Tabstops::position_t end = Tabstops::position_t(-1)) +{ + if (end == t.npos) + end = t.size(); + + auto it = l.begin(); + for (auto i = start; i < end; i++) { + if (it != l.end() && i == *it) { + g_assert_true(t.get(i)); + ++it; + } else + g_assert_false(t.get(i)); + + } + g_assert_true(it == l.end()); +} + +static void +assert_tabstops_previous(Tabstops const& t, + std::initializer_list> l, + int count = 1) +{ + for (auto p : l) { + g_assert_cmpuint(t.get_previous(p.first, count), ==, p.second); + } +} + +static void +assert_tabstops_next(Tabstops const& t, + std::initializer_list> l, + int count = 1) +{ + for (auto p : l) { + g_assert_cmpuint(t.get_next(p.first, count), ==, p.second); + } +} + +static void +test_tabstops_default(void) +{ + Tabstops t{}; + g_assert_cmpuint(t.size(), ==, VTE_COLUMNS); + + assert_tabstops_default(t); +} + +static void +test_tabstops_get_set(void) +{ + Tabstops t{256, false}; + + tabstops_set(t, {42, 200}); + assert_tabstops(t, {42, 200}); +} + +static void +test_tabstops_clear(void) +{ + Tabstops t{128, true}; + t.clear(); + assert_tabstops_clear(t); +} + +static void +test_tabstops_reset(void) +{ + unsigned int const tab_width = 7; + + Tabstops t{80, true, tab_width}; + assert_tabstops_default(t, 0, t.npos, tab_width); + + t.resize(80); + t.resize(160, false, tab_width); + assert_tabstops_default(t, 0, 80, tab_width); + assert_tabstops_clear(t, 80, t.npos); + + t.resize(80); + t.clear(); + t.resize(160, true, tab_width); + assert_tabstops_clear(t, 0, 80); + assert_tabstops_default(t, 80, t.npos, tab_width); + + t.resize(256); + t.reset(tab_width); + assert_tabstops_default(t, 0, t.npos, tab_width); + t.resize(1024, true, tab_width); + assert_tabstops_default(t, 0, t.npos, tab_width); + t.resize(4096, true, tab_width); + assert_tabstops_default(t, 0, t.npos, tab_width); +} + +static void +test_tabstops_resize(void) +{ + Tabstops t; + t.resize(80); + + t.reset(); + assert_tabstops_default(t); + t.resize(161, false); + assert_tabstops_default(t, 0, 80); + assert_tabstops_clear(t, 80, t.npos); +} + +static void +test_tabstops_previous(void) +{ + Tabstops t{512, false}; + tabstops_set(t, {0, 31, 32, 63, 64, 255, 256}); + assert_tabstops_previous(t, {{511, 256}, {256, 255}, {255, 64}, {64, 63}, {63, 32}, {32, 31}, {31, 0}}); + + assert_tabstops_previous(t, {{511, 255}, {257, 255}, {254, 63}, {64, 32}, {33, 31}, {32, 0}, {31, t.npos}, {0, t.npos}}, 2); + + t.clear(); + tabstops_set(t, {127, 256}); + assert_tabstops_previous(t, {{511, 256}, {256, 127}, {127, t.npos}}); + assert_tabstops_previous(t, {{384, 256}, {192, 127}, {92, t.npos}}); + + unsigned int const tab_width = 3; + t.reset(tab_width); + + for (unsigned int p = 1 ; p < t.size(); ++p) { + g_assert_cmpuint(t.get_previous(p), ==, (p - 1) / tab_width * tab_width); + } + g_assert_cmpuint(t.get_previous(0), ==, t.npos); +} + +static void +test_tabstops_next(void) +{ + Tabstops t{512, false}; + tabstops_set(t, {0, 31, 32, 63, 64, 255, 256}); + assert_tabstops_next(t, {{0, 31}, {31, 32}, {32, 63}, {63, 64}, {64, 255}, {255, 256}, {256, t.npos}}); + assert_tabstops_next(t, {{0, 32}, {2, 32}, {31, 63}, {48, 64}, {128, 256}, {255, t.npos}}, 2); + + t.clear(); + tabstops_set(t, {127, 256}); + assert_tabstops_next(t, {{0, 127}, {127, 256}, {256, t.npos}}); + assert_tabstops_next(t, {{1, 127}, {192, 256}, {384, t.npos}}); + + unsigned int const tab_width = 3; + t.reset(tab_width); + + for (unsigned int p = 0; p < t.size() - tab_width; ++p) { + g_assert_cmpuint(t.get_next(p), ==, (p / tab_width + 1) * tab_width); + } + g_assert_cmpuint(t.get_next(t.size() - 1), ==, t.npos); +} + +int +main(int argc, + char* argv[]) +{ + g_test_init(&argc, &argv, nullptr); + + g_test_add_func("/vte/tabstops/default", test_tabstops_default); + g_test_add_func("/vte/tabstops/get-set", test_tabstops_get_set); + g_test_add_func("/vte/tabstops/clear", test_tabstops_clear); + g_test_add_func("/vte/tabstops/reset", test_tabstops_reset); + g_test_add_func("/vte/tabstops/resize", test_tabstops_resize); + g_test_add_func("/vte/tabstops/previous", test_tabstops_previous); + g_test_add_func("/vte/tabstops/next", test_tabstops_next); + + return g_test_run(); +} diff -Nru vte2.91-0.52.2/src/utf8.cc vte2.91-0.54.0/src/utf8.cc --- vte2.91-0.52.2/src/utf8.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/utf8.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright © 2008-2009 Bjoern Hoehrmann + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "utf8.hh" + +uint8_t const vte::base::UTF8Decoder::kTable[] = { + // The first part of the table maps bytes to character classes that + // to reduce the size of the transition table and create bitmasks. + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, + + // The second part is a transition table that maps a combination + // of a state of the automaton and a character class to a state. + 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, + 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, + 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, + 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, + 12,36,12,12,12,12,12,12,12,12,12,12, +}; diff -Nru vte2.91-0.52.2/src/utf8.hh vte2.91-0.54.0/src/utf8.hh --- vte2.91-0.52.2/src/utf8.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/utf8.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright © 2008-2009 Bjoern Hoehrmann + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +#include + +namespace vte { + +namespace base { + +/* See https://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for more + * information on this branchless UTF-8 decoder. + */ +class UTF8Decoder { +public: + enum { + ACCEPT = 0, + REJECT = 12 + }; + + UTF8Decoder() noexcept = default; + UTF8Decoder(UTF8Decoder const&) noexcept = default; + UTF8Decoder(UTF8Decoder&&) noexcept = default; + ~UTF8Decoder() noexcept = default; + + UTF8Decoder& operator= (UTF8Decoder const&) = delete; + UTF8Decoder& operator= (UTF8Decoder&&) = delete; + + inline constexpr uint32_t codepoint() const noexcept { return m_codepoint; } + + inline uint32_t decode(uint32_t byte) noexcept { + uint32_t type = kTable[byte]; + m_codepoint = (m_state != ACCEPT) ? + (byte & 0x3fu) | (m_codepoint << 6) : + (0xff >> type) & (byte); + + m_state = kTable[256 + m_state + type]; + return m_state; + } + + inline void reset() noexcept { + m_state = ACCEPT; + m_codepoint = 0xfffdU; + } + + inline bool is_start_byte(uint32_t byte) const noexcept { + return kTable[256 + 0 /* start state */ + kTable[byte]] != REJECT; + } + +private: + uint32_t m_state{ACCEPT}; + uint32_t m_codepoint{0}; + + static uint8_t const kTable[]; + +}; // class UTF8Decoder + +} // namespace base + +} // namespace vte diff -Nru vte2.91-0.52.2/src/utf8-test.cc vte2.91-0.54.0/src/utf8-test.cc --- vte2.91-0.52.2/src/utf8-test.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/utf8-test.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,349 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "utf8.hh" + +#include +#include + +#include + +using namespace std::literals; +using namespace vte::base; + +UTF8Decoder decoder{}; + +static void +test_utf8_decoder_decode(void) +{ + decoder.reset(); + + uint8_t buf[7]; + uint32_t state = UTF8Decoder::ACCEPT; + for (uint32_t cp = 0; cp < 0x110000u; ++cp) { + if ((cp & 0xfffff800) == 0xd800u) + continue; // surrogate + + int len = g_unichar_to_utf8(cp, (char*)buf); + for (int i = 0; i < len; ++i) + state = decoder.decode(buf[i]); + g_assert_cmpint(state, ==, UTF8Decoder::ACCEPT); + g_assert_cmpuint(decoder.codepoint(), ==, cp); + } +} + +static constexpr bool +is_utf8_start_byte(uint32_t c) +{ + return (c < 0x80u || (c >= 0xc2u && c <= 0xf4u)); +} + +static void +test_utf8_decoder_start(void) +{ + decoder.reset(); + for (uint32_t c = 0; c < 0x100u; ++c) { + g_assert_cmpint(decoder.is_start_byte(c), ==, is_utf8_start_byte(c)); + } +} + +static void +decode(uint8_t const* in, + size_t len, + std::u32string& out) +{ + decoder.reset(); + + auto const iend = in + len; + uint32_t state = UTF8Decoder::ACCEPT; + for (auto iptr = in; iptr < iend; ++iptr) { + switch ((state = decoder.decode(*iptr))) { + case vte::base::UTF8Decoder::REJECT: + decoder.reset(); + state = UTF8Decoder::ACCEPT; + + /* If a start byte occurred in the middle of a sequence, + * rewind the stream so we try to start a new character + * with it. + * Note that this will never lead to a loop, since in the + * next round this byte *will* be consumed. + */ + if (decoder.is_start_byte(*iptr)) + --iptr; + + /* Fall through to insert the U+FFFD replacement character. */ + /* [[fallthrough]]; */ + case vte::base::UTF8Decoder::ACCEPT: + out.push_back(decoder.codepoint()); + break; + default: + break; + } + } + + /* If we get EOS without having just accepted a character, + * we need to insert a replacement character since we're + * aborting a sequence mid-way. + */ + if (state != UTF8Decoder::ACCEPT) { + out.push_back(0xfffdu); + } +} + +static void +assert_u32streq(std::u32string const& str1, + std::u32string const& str2) +{ + g_assert_cmpuint(str1.size(), ==, str2.size()); + g_assert_true(str1 == str2); +} + +static void +assert_decode(char const* in, + ssize_t len, + std::u32string const& expected) +{ + std::u32string converted; + decode((uint8_t const*)in, len != -1 ? size_t(len) : strlen(in), converted); + assert_u32streq(converted, expected); +} + +static void +test_utf8_decoder_replacement(void) +{ + /* The following test vectors are copied from rust encoding_rs/src/utf8.rs: + * + * Copyright 2015-2016 Mozilla Foundation + * + * Permission is hereby granted, free of charge, to any + * person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the + * Software without restriction, including without + * limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software + * is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice + * shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + // Empty + assert_decode("", -1, U""s); + // NUL + assert_decode("\0", 1, U"\0"s); + // ASCII + assert_decode("ab", -1, U"ab"s); + // Low BMP + assert_decode("a\xC3\xA4Z", -1, U"a\u00E4Z"s); + // High BMP + assert_decode("a\xE2\x98\x83Z", -1, U"a\u2603Z"s); + // Astral + assert_decode("a\xF0\x9F\x92\xa9Z", -1, U"a\U0001F4A9Z"s); + // Low BMP with last byte missing + assert_decode("a\xC3Z", -1, U"a\uFFFDZ"s); + assert_decode("a\xC3", -1, U"a\uFFFD"s); + // High BMP with last byte missing + assert_decode("a\xE2\x98Z", -1, U"a\uFFFDZ"s); + assert_decode("a\xE2\x98", -1, U"a\uFFFD"s); + // Astral with last byte missing + assert_decode("a\xF0\x9F\x92Z", -1, U"a\uFFFDZ"s); + assert_decode("a\xF0\x9F\x92", -1, U"a\uFFFD"s); + // Lone highest continuation + assert_decode("a\xBFZ", -1, U"a\uFFFDZ"s); + assert_decode("a\xBF", -1, U"a\uFFFD"s); + // Two lone highest continuations + assert_decode("a\xBF\xBFZ", -1, U"a\uFFFD\uFFFDZ"s); + assert_decode("a\xBF\xBF", -1, U"a\uFFFD\uFFFD"s); + // Low BMP followed by lowest lone continuation + assert_decode("a\xC3\xA4\x80Z", -1, U"a\u00E4\uFFFDZ"s); + assert_decode("a\xC3\xA4\x80", -1, U"a\u00E4\uFFFD"s); + // Low BMP followed by highest lone continuation + assert_decode("a\xC3\xA4\xBFZ", -1, U"a\u00E4\uFFFDZ"s); + assert_decode("a\xC3\xA4\xBF", -1, U"a\u00E4\uFFFD"s); + // High BMP followed by lowest lone continuation + assert_decode("a\xE2\x98\x83\x80Z", -1, U"a\u2603\uFFFDZ"s); + assert_decode("a\xE2\x98\x83\x80", -1, U"a\u2603\uFFFD"s); + // High BMP followed by highest lone continuation + assert_decode("a\xE2\x98\x83\xBFZ", -1, U"a\u2603\uFFFDZ"s); + assert_decode("a\xE2\x98\x83\xBF", -1, U"a\u2603\uFFFD"s); + // Astral followed by lowest lone continuation + assert_decode("a\xF0\x9F\x92\xA9\x80Z", -1, U"a\U0001F4A9\uFFFDZ"s); + assert_decode("a\xF0\x9F\x92\xA9\x80", -1, U"a\U0001F4A9\uFFFD"s); + // Astral followed by highest lone continuation + assert_decode("a\xF0\x9F\x92\xA9\xBFZ", -1, U"a\U0001F4A9\uFFFDZ"s); + assert_decode("a\xF0\x9F\x92\xA9\xBF", -1, U"a\U0001F4A9\uFFFD"s); + + // Boundary conditions + // Lowest single-byte + assert_decode("Z\x00", 2, U"Z\0"s); + assert_decode("Z\x00Z", 3, U"Z\0Z"s); + // Lowest single-byte as two-byte overlong sequence + assert_decode("a\xC0\x80", -1, U"a\uFFFD\uFFFD"s); + assert_decode("a\xC0\x80Z", -1, U"a\uFFFD\uFFFDZ"s); + // Lowest single-byte as three-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xE0\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xE0\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // Lowest single-byte as four-byte overlong sequence + assert_decode("a\xF0\x80\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x80\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // One below lowest single-byte + assert_decode("a\xFF", -1, U"a\uFFFD"s); + assert_decode("a\xFFZ", -1, U"a\uFFFDZ"s); + // Highest single-byte + assert_decode("a\x7F", -1, U"a\u007F"s); + assert_decode("a\x7FZ", -1, U"a\u007FZ"s); + // Highest single-byte as two-byte overlong sequence + assert_decode("a\xC1\xBF", -1, U"a\uFFFD\uFFFD"s); + assert_decode("a\xC1\xBFZ", -1, U"a\uFFFD\uFFFDZ"s); + // Highest single-byte as three-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xE0\x81\xBF", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xE0\x81\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // Highest single-byte as four-byte overlong sequence + assert_decode("a\xF0\x80\x81\xBF", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x80\x81\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // One past highest single byte (also lone continuation) + assert_decode("a\x80Z", -1, U"a\uFFFDZ"s); + assert_decode("a\x80", -1, U"a\uFFFD"s); + // Two lone continuations + assert_decode("a\x80\x80Z", -1, U"a\uFFFD\uFFFDZ"s); + assert_decode("a\x80\x80", -1, U"a\uFFFD\uFFFD"s); + // Three lone continuations + assert_decode("a\x80\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + assert_decode("a\x80\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD"s); + // Four lone continuations + assert_decode("a\x80\x80\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + assert_decode("a\x80\x80\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + // Lowest two-byte + assert_decode("a\xC2\x80", -1, U"a\u0080"s); + assert_decode("a\xC2\x80Z", -1, U"a\u0080Z"s); + // Lowest two-byte as three-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xE0\x82\x80", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xE0\x82\x80Z", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // Lowest two-byte as four-byte overlong sequence + assert_decode("a\xF0\x80\x82\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x80\x82\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // Lead one below lowest two-byte + assert_decode("a\xC1\x80", -1, U"a\uFFFD\uFFFD"s); + assert_decode("a\xC1\x80Z", -1, U"a\uFFFD\uFFFDZ"s); + // Trail one below lowest two-byte + assert_decode("a\xC2\x7F", -1, U"a\uFFFD\u007F"s); + assert_decode("a\xC2\x7FZ", -1, U"a\uFFFD\u007FZ"s); + // Highest two-byte + assert_decode("a\xDF\xBF", -1, U"a\u07FF"s); + assert_decode("a\xDF\xBFZ", -1, U"a\u07FFZ"s); + // Highest two-byte as three-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xE0\x9F\xBF", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xE0\x9F\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // Highest two-byte as four-byte overlong sequence + assert_decode("a\xF0\x80\x9F\xBF", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x80\x9F\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // Lowest three-byte + assert_decode("a\xE0\xA0\x80", -1, U"a\u0800"s); + assert_decode("a\xE0\xA0\x80Z", -1, U"a\u0800Z"s); + // Lowest three-byte as four-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xF0\x80\xA0\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x80\xA0\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // Highest below surrogates + assert_decode("a\xED\x9F\xBF", -1, U"a\uD7FF"s); + assert_decode("a\xED\x9F\xBFZ", -1, U"a\uD7FFZ"s); + // Highest below surrogates as four-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xF0\x8D\x9F\xBF", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x8D\x9F\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + // First surrogate + assert_decode("a\xED\xA0\x80", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xED\xA0\x80Z", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // First surrogate as four-byte overlong sequence + assert_decode("a\xF0\x8D\xA0\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x8D\xA0\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + // Last surrogate + assert_decode("a\xED\xBF\xBF", -1, U"a\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xED\xBF\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFDZ"s); + // Last surrogate as four-byte overlong sequence + assert_decode("a\xF0\x8D\xBF\xBF", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x8D\xBF\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // Lowest above surrogates + assert_decode("a\xEE\x80\x80", -1, U"a\uE000"s); + assert_decode("a\xEE\x80\x80Z", -1, U"a\uE000Z"s); + // Lowest above surrogates as four-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xF0\x8E\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x8E\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + // Highest three-byte + assert_decode("a\xEF\xBF\xBF", -1, U"a\uFFFF"s); + assert_decode("a\xEF\xBF\xBFZ", -1, U"a\uFFFFZ"s); + // Highest three-byte as four-byte overlong sequence + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xF0\x8F\xBF\xBF", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF0\x8F\xBF\xBFZ", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + // Lowest four-byte + assert_decode("a\xF0\x90\x80\x80", -1, U"a\u10000"s); + assert_decode("a\xF0\x90\x80\x80Z", -1, U"a\u10000Z"s); + // Highest four-byte + assert_decode("a\xF4\x8F\xBF\xBF", -1, U"a\u10FFFF"s); + assert_decode("a\xF4\x8F\xBF\xBFZ", -1, U"a\u10FFFFZ"s); + // One past highest four-byte + assert_decode("a\xF4\x90\x80\x80", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFD"s); + assert_decode("a\xF4\x90\x80\x80Z", -1, U"a\uFFFD\uFFFD\uFFFD\uFFFDZ"s); + #endif + + // Highest four-byte with last byte replaced with 0xFF + #ifdef INCLUDE_KNOWN_FAIL + assert_decode("a\xF4\x8F\xBF\xFF", -1, U"a\uFFFD\uFFFD"s); + assert_decode("a\xF4\x8F\xBF\xFFZ", -1, U"a\uFFFD\uFFFDZ"s); + #endif +} + +int +main(int argc, + char* argv[]) +{ + g_test_init(&argc, &argv, nullptr); + + g_test_add_func("/vte/utf8/decoder/decode", test_utf8_decoder_decode); + g_test_add_func("/vte/utf8/decoder/start", test_utf8_decoder_start); + g_test_add_func("/vte/utf8/decoder/replacement", test_utf8_decoder_replacement); + + return g_test_run(); +} diff -Nru vte2.91-0.52.2/src/vte/vtedeprecated.h vte2.91-0.54.0/src/vte/vtedeprecated.h --- vte2.91-0.52.2/src/vte/vtedeprecated.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vte/vtedeprecated.h 2018-09-02 13:20:15.000000000 +0000 @@ -48,6 +48,12 @@ _VTE_DEPRECATED _VTE_PUBLIC +void vte_terminal_match_set_cursor_type(VteTerminal *terminal, + int tag, + GdkCursorType cursor_type) _VTE_GNUC_NONNULL(1); + +_VTE_DEPRECATED +_VTE_PUBLIC char *vte_terminal_match_check(VteTerminal *terminal, glong column, glong row, int *tag) _VTE_GNUC_NONNULL(1) G_GNUC_MALLOC; @@ -105,6 +111,21 @@ void vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal, GtkWindow *window) _VTE_GNUC_NONNULL(1) _VTE_GNUC_NONNULL(2); +_VTE_DEPRECATED +_VTE_PUBLIC +const char *vte_terminal_get_icon_title(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); + +_VTE_DEPRECATED +_VTE_PUBLIC +gboolean vte_terminal_set_encoding(VteTerminal *terminal, + const char *codeset, + GError **error) _VTE_GNUC_NONNULL(1); + +_VTE_DEPRECATED +_VTE_PUBLIC +const char *vte_terminal_get_encoding(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); + + G_END_DECLS #undef _VTE_DEPRECATED diff -Nru vte2.91-0.52.2/src/vte/vteglobals.h vte2.91-0.54.0/src/vte/vteglobals.h --- vte2.91-0.52.2/src/vte/vteglobals.h 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/src/vte/vteglobals.h 2018-09-02 13:20:15.000000000 +0000 @@ -31,6 +31,12 @@ _VTE_PUBLIC const char *vte_get_features (void); +#define VTE_TEST_FLAGS_NONE (G_GUINT64_CONSTANT(0)) +#define VTE_TEST_FLAGS_ALL (~G_GUINT64_CONSTANT(0)) + +_VTE_PUBLIC +void vte_set_test_flags(guint64 flags); + G_END_DECLS #endif /* __VTE_VTE_GLOBALS_H__ */ diff -Nru vte2.91-0.52.2/src/vte/vteterminal.h vte2.91-0.54.0/src/vte/vteterminal.h --- vte2.91-0.52.2/src/vte/vteterminal.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vte/vteterminal.h 2018-09-02 13:20:15.000000000 +0000 @@ -53,7 +53,7 @@ struct _VteTerminal { GtkWidget widget; /*< private >*/ - gpointer *_unused_padding[1]; + gpointer *_unused_padding[1]; /* FIXMEchpe: remove this field on the next ABI break */ }; /** @@ -390,10 +390,6 @@ guint32 flags) _VTE_GNUC_NONNULL(1) _VTE_GNUC_NONNULL(2); /* Set the cursor to be used when the pointer is over a given match. */ _VTE_PUBLIC -void vte_terminal_match_set_cursor_type(VteTerminal *terminal, - int tag, - GdkCursorType cursor_type) _VTE_GNUC_NONNULL(1); -_VTE_PUBLIC void vte_terminal_match_set_cursor_name(VteTerminal *terminal, int tag, const char *cursor_name) _VTE_GNUC_NONNULL(1) _VTE_GNUC_NONNULL(3); @@ -435,14 +431,6 @@ gboolean vte_terminal_search_find_next (VteTerminal *terminal) _VTE_GNUC_NONNULL(1); -/* Set the character encoding. Most of the time you won't need this. */ -_VTE_PUBLIC -gboolean vte_terminal_set_encoding(VteTerminal *terminal, - const char *codeset, - GError **error) _VTE_GNUC_NONNULL(1); -_VTE_PUBLIC -const char *vte_terminal_get_encoding(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); - /* CJK compatibility setting */ _VTE_PUBLIC void vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, @@ -468,8 +456,6 @@ _VTE_PUBLIC const char *vte_terminal_get_window_title(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); _VTE_PUBLIC -const char *vte_terminal_get_icon_title(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); -_VTE_PUBLIC const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); _VTE_PUBLIC const char *vte_terminal_get_current_file_uri(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); @@ -485,6 +471,9 @@ _VTE_PUBLIC void vte_terminal_set_clear_background(VteTerminal* terminal, gboolean setting) _VTE_GNUC_NONNULL(1); +_VTE_PUBLIC +void vte_terminal_get_color_background_for_draw(VteTerminal* terminal, + GdkRGBA* color) _VTE_GNUC_NONNULL(1) _VTE_GNUC_NONNULL(2); /* Writing contents out */ _VTE_PUBLIC diff -Nru vte2.91-0.52.2/src/vte.cc vte2.91-0.54.0/src/vte.cc --- vte2.91-0.52.2/src/vte.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vte.cc 2018-09-02 13:20:15.000000000 +0000 @@ -39,11 +39,11 @@ #include "vteinternal.hh" #include "buffer.h" #include "debug.h" -#include "vteconv.h" #include "vtedraw.hh" #include "reaper.hh" -#include "ring.h" +#include "ring.hh" #include "caps.hh" +#include "widget.hh" #ifdef HAVE_WCHAR_H #include @@ -59,10 +59,8 @@ #include #include #include -#include "iso2022.h" #include "keymap.h" #include "marshal.h" -#include "matcher.hh" #include "vteaccess.h" #include "vtepty.h" #include "vtepty-private.h" @@ -70,12 +68,6 @@ #include /* placement new */ -/* Some sanity checks */ -/* FIXMEchpe: move this to there when splitting _vte_incoming_chunk into its own file */ -static_assert(sizeof(struct _vte_incoming_chunk) <= VTE_INPUT_CHUNK_SIZE, "_vte_incoming_chunk too large"); -static_assert(offsetof(struct _vte_incoming_chunk, data) == offsetof(struct _vte_incoming_chunk, dataminusone) + 1, "_vte_incoming_chunk layout wrong"); - - #ifndef HAVE_ROUND static inline double round(double x) { if(x - floor(x) < 0.5) { @@ -90,11 +82,14 @@ #define I_(string) (g_intern_static_string(string)) +namespace vte { +namespace terminal { + static int _vte_unichar_width(gunichar c, int utf8_ambiguous_width); -static void stop_processing(VteTerminalPrivate *that); -static void add_process_timeout(VteTerminalPrivate *that); -static void add_update_timeout(VteTerminalPrivate *that); -static void remove_update_timeout(VteTerminalPrivate *that); +static void stop_processing(vte::terminal::Terminal* that); +static void add_process_timeout(vte::terminal::Terminal* that); +static void add_update_timeout(vte::terminal::Terminal* that); +static void remove_update_timeout(vte::terminal::Terminal* that); static gboolean process_timeout (gpointer data); static gboolean update_timeout (gpointer data); @@ -123,96 +118,6 @@ return 1; } -/* process incoming data without copying */ -static struct _vte_incoming_chunk *free_chunks; -static struct _vte_incoming_chunk * -get_chunk (void) -{ - struct _vte_incoming_chunk *chunk = NULL; - if (free_chunks) { - chunk = free_chunks; - free_chunks = free_chunks->next; - } - if (chunk == NULL) { - chunk = g_new (struct _vte_incoming_chunk, 1); - } - chunk->next = NULL; - chunk->len = 0; - return chunk; -} -static void -release_chunk (struct _vte_incoming_chunk *chunk) -{ - chunk->next = free_chunks; - chunk->len = free_chunks ? free_chunks->len + 1 : 0; - free_chunks = chunk; -} -static void -prune_chunks (guint len) -{ - struct _vte_incoming_chunk *chunk = NULL; - if (len && free_chunks != NULL) { - if (free_chunks->len > len) { - struct _vte_incoming_chunk *last; - chunk = free_chunks; - while (free_chunks->len > len) { - last = free_chunks; - free_chunks = free_chunks->next; - } - last->next = NULL; - } - } else { - chunk = free_chunks; - free_chunks = NULL; - } - while (chunk != NULL) { - struct _vte_incoming_chunk *next = chunk->next; - g_free (chunk); - chunk = next; - } -} -static void -_vte_incoming_chunks_release (struct _vte_incoming_chunk *chunk) -{ - while (chunk) { - struct _vte_incoming_chunk *next = chunk->next; - release_chunk (chunk); - chunk = next; - } -} -static gsize -_vte_incoming_chunks_length (struct _vte_incoming_chunk *chunk) -{ - gsize len = 0; - while (chunk) { - len += chunk->len; - chunk = chunk->next; - } - return len; -} -static gsize -_vte_incoming_chunks_count (struct _vte_incoming_chunk *chunk) -{ - gsize cnt = 0; - while (chunk) { - cnt ++; - chunk = chunk->next; - } - return cnt; -} -static struct _vte_incoming_chunk * -_vte_incoming_chunks_reverse(struct _vte_incoming_chunk *chunk) -{ - struct _vte_incoming_chunk *prev = NULL; - while (chunk) { - struct _vte_incoming_chunk *next = chunk->next; - chunk->next = prev; - prev = chunk; - chunk = next; - } - return prev; -} - static void vte_g_array_fill(GArray *array, gconstpointer item, guint final_size) { @@ -227,7 +132,7 @@ // FIXMEchpe replace this with a method on VteRing VteRowData* -VteTerminalPrivate::ring_insert(vte::grid::row_t position, +Terminal::ring_insert(vte::grid::row_t position, bool fill) { VteRowData *row; @@ -247,23 +152,23 @@ // FIXMEchpe replace this with a method on VteRing VteRowData* -VteTerminalPrivate::ring_append(bool fill) +Terminal::ring_append(bool fill) { return ring_insert(_vte_ring_next(m_screen->row_data), fill); } // FIXMEchpe replace this with a method on VteRing void -VteTerminalPrivate::ring_remove(vte::grid::row_t position) +Terminal::ring_remove(vte::grid::row_t position) { _vte_ring_remove(m_screen->row_data, position); } /* Reset defaults for character insertion. */ void -VteTerminalPrivate::reset_default_attributes(bool reset_hyperlink) +Terminal::reset_default_attributes(bool reset_hyperlink) { - hyperlink_idx_t hyperlink_idx_save = m_defaults.attr.hyperlink_idx; + auto const hyperlink_idx_save = m_defaults.attr.hyperlink_idx; m_defaults = m_color_defaults = m_fill_defaults = basic_cell; if (!reset_hyperlink) m_defaults.attr.hyperlink_idx = hyperlink_idx_save; @@ -271,45 +176,45 @@ //FIXMEchpe this function is bad inline vte::view::coord_t -VteTerminalPrivate::scroll_delta_pixel() const +Terminal::scroll_delta_pixel() const { return round(m_screen->scroll_delta * m_cell_height); } /* - * VteTerminalPrivate::pixel_to_row: + * Terminal::pixel_to_row: * @y: Y coordinate is relative to viewport, top padding excluded * * Returns: absolute row */ inline vte::grid::row_t -VteTerminalPrivate::pixel_to_row(vte::view::coord_t y) const +Terminal::pixel_to_row(vte::view::coord_t y) const { return (scroll_delta_pixel() + y) / m_cell_height; } /* - * VteTerminalPrivate::pixel_to_row: + * Terminal::pixel_to_row: * @row: absolute row * * Returns: Y coordinate relative to viewport with top padding excluded. If the row is * outside the viewport, may return any value < 0 or >= height */ inline vte::view::coord_t -VteTerminalPrivate::row_to_pixel(vte::grid::row_t row) const +Terminal::row_to_pixel(vte::grid::row_t row) const { // FIXMEchpe this is bad! return row * m_cell_height - (glong)round(m_screen->scroll_delta * m_cell_height); } inline vte::grid::row_t -VteTerminalPrivate::first_displayed_row() const +Terminal::first_displayed_row() const { return pixel_to_row(0); } inline vte::grid::row_t -VteTerminalPrivate::last_displayed_row() const +Terminal::last_displayed_row() const { /* Get the logical row number displayed at the bottom pixel position */ auto r = pixel_to_row(m_view_usable_extents.height() - 1); @@ -325,7 +230,7 @@ } void -VteTerminalPrivate::invalidate_cells(vte::grid::column_t column_start, +Terminal::invalidate_cells(vte::grid::column_t column_start, int n_columns, vte::grid::row_t row_start, int n_rows) @@ -361,8 +266,7 @@ * Always include the extra pixel border and overlap pixel. */ rect.x = column_start * m_cell_width - 1; - /* The extra + 1 is for the faux-bold overdraw */ - int xend = (column_start + n_columns) * m_cell_width + 1 + 1; + int xend = (column_start + n_columns) * m_cell_width + 1; rect.width = xend - rect.x; rect.y = row_to_pixel(row_start) - 1; @@ -391,7 +295,7 @@ } void -VteTerminalPrivate::invalidate_region(vte::grid::column_t scolumn, +Terminal::invalidate_region(vte::grid::column_t scolumn, vte::grid::column_t ecolumn, vte::grid::row_t srow, vte::grid::row_t erow, @@ -416,14 +320,14 @@ } void -VteTerminalPrivate::invalidate(vte::grid::span const& s, +Terminal::invalidate(vte::grid::span const& s, bool block) { invalidate_region(s.start_column(), s.end_column(), s.start_row(), s.end_row(), block); } void -VteTerminalPrivate::invalidate_all() +Terminal::invalidate_all() { if (G_UNLIKELY (!widget_realized())) return; @@ -461,7 +365,7 @@ /* Scroll a rectangular region up or down by a fixed number of lines, * negative = up, positive = down. */ void -VteTerminalPrivate::scroll_region (long row, +Terminal::scroll_region (long row, long count, long delta) { @@ -485,7 +389,7 @@ /* Find the row in the given position in the backscroll buffer. */ // FIXMEchpe replace this with a method on VteRing VteRowData const* -VteTerminalPrivate::find_row_data(vte::grid::row_t row) const +Terminal::find_row_data(vte::grid::row_t row) const { VteRowData const* rowdata = nullptr; @@ -498,7 +402,7 @@ /* Find the row in the given position in the backscroll buffer. */ // FIXMEchpe replace this with a method on VteRing VteRowData* -VteTerminalPrivate::find_row_data_writable(vte::grid::row_t row) const +Terminal::find_row_data_writable(vte::grid::row_t row) const { VteRowData *rowdata = nullptr; @@ -511,7 +415,7 @@ /* Find the character an the given position in the backscroll buffer. */ // FIXMEchpe replace this with a method on VteRing VteCell const* -VteTerminalPrivate::find_charcell(vte::grid::column_t col, +Terminal::find_charcell(vte::grid::column_t col, vte::grid::row_t row) const { VteRowData const* rowdata; @@ -526,7 +430,7 @@ // FIXMEchpe replace this with a method on VteRing vte::grid::column_t -VteTerminalPrivate::find_start_column(vte::grid::column_t col, +Terminal::find_start_column(vte::grid::column_t col, vte::grid::row_t row) const { VteRowData const* row_data = find_row_data(row); @@ -543,7 +447,7 @@ // FIXMEchpe replace this with a method on VteRing vte::grid::column_t -VteTerminalPrivate::find_end_column(vte::grid::column_t col, +Terminal::find_end_column(vte::grid::column_t col, vte::grid::row_t row) const { VteRowData const* row_data = find_row_data(row); @@ -568,23 +472,21 @@ // FIXMEchpe this is for the view, so use int not gssize // FIXMEchpe this is only ever called with left_only=false, so remove the param gssize -VteTerminalPrivate::get_preedit_width(bool left_only) +Terminal::get_preedit_width(bool left_only) { gssize ret = 0; - if (m_im_preedit != NULL) { - char const *preedit = m_im_preedit; - for (int i = 0; - // FIXMEchpe preddit is != NULL at the start, and next_char never returns NULL either - (preedit != NULL) && + char const *preedit = m_im_preedit.c_str(); + for (int i = 0; + // FIXMEchpe preddit is != NULL at the start, and next_char never returns NULL either + (preedit != NULL) && (preedit[0] != '\0') && (!left_only || (i < m_im_preedit_cursor)); - i++) { - gunichar c = g_utf8_get_char(preedit); - ret += _vte_unichar_width(c, m_utf8_ambiguous_width); - preedit = g_utf8_next_char(preedit); - } - } + i++) { + gunichar c = g_utf8_get_char(preedit); + ret += _vte_unichar_width(c, m_utf8_ambiguous_width); + preedit = g_utf8_next_char(preedit); + } return ret; } @@ -593,27 +495,25 @@ * to the left of the cursor, or the entire string, in gunichars. */ // FIXMEchpe this returns gssize but inside it uses int... gssize -VteTerminalPrivate::get_preedit_length(bool left_only) +Terminal::get_preedit_length(bool left_only) { - int i = 0; + ssize_t i = 0; - if (m_im_preedit != NULL) { - char const *preedit = m_im_preedit; - for (i = 0; - // FIXMEchpe useless check, see above - (preedit != NULL) && + char const *preedit = m_im_preedit.c_str(); + for (i = 0; + // FIXMEchpe useless check, see above + (preedit != NULL) && (preedit[0] != '\0') && (!left_only || (i < m_im_preedit_cursor)); - i++) { - preedit = g_utf8_next_char(preedit); - } - } + i++) { + preedit = g_utf8_next_char(preedit); + } return i; } void -VteTerminalPrivate::invalidate_cell(vte::grid::column_t col, +Terminal::invalidate_cell(vte::grid::column_t col, vte::grid::row_t row) { int columns; @@ -653,7 +553,7 @@ } void -VteTerminalPrivate::invalidate_cursor_once(bool periodic) +Terminal::invalidate_cursor_once(bool periodic) { if (G_UNLIKELY(!widget_realized())) return; @@ -668,7 +568,7 @@ } } - if (m_cursor_visible) { + if (m_modes_private.DEC_TEXT_CURSOR()) { auto preedit_width = get_preedit_width(false); auto row = m_screen->cursor.row; auto column = m_screen->cursor.col; @@ -702,14 +602,14 @@ /* Invalidate the cursor repeatedly. */ // FIXMEchpe this continually adds and removes the blink timeout. Find a better solution static gboolean -invalidate_cursor_periodic_cb(VteTerminalPrivate *that) +invalidate_cursor_periodic_cb(vte::terminal::Terminal* that) { that->invalidate_cursor_periodic(); return G_SOURCE_REMOVE; } void -VteTerminalPrivate::invalidate_cursor_periodic() +Terminal::invalidate_cursor_periodic() { m_cursor_blink_state = !m_cursor_blink_state; m_cursor_blink_time += m_cursor_blink_cycle; @@ -734,7 +634,7 @@ /* Emit a "selection_changed" signal. */ void -VteTerminalPrivate::emit_selection_changed() +Terminal::emit_selection_changed() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `selection-changed'.\n"); @@ -743,7 +643,7 @@ /* Emit a "commit" signal. */ void -VteTerminalPrivate::emit_commit(char const* text, +Terminal::emit_commit(char const* text, gssize length) { char const* result = NULL; @@ -769,7 +669,7 @@ } void -VteTerminalPrivate::queue_contents_changed() +Terminal::queue_contents_changed() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Queueing `contents-changed'.\n"); @@ -778,7 +678,7 @@ //FIXMEchpe this has only one caller void -VteTerminalPrivate::queue_cursor_moved() +Terminal::queue_cursor_moved() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Queueing `cursor-moved'.\n"); @@ -802,7 +702,7 @@ } void -VteTerminalPrivate::emit_eof() +Terminal::emit_eof() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `eof'.\n"); @@ -812,7 +712,7 @@ /* Emit a "eof" signal. */ // FIXMEchpe any particular reason not to handle this immediately? void -VteTerminalPrivate::queue_eof() +Terminal::queue_eof() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Queueing `eof'.\n"); g_idle_add_full(G_PRIORITY_HIGH, @@ -823,7 +723,7 @@ /* Emit a "char-size-changed" signal. */ void -VteTerminalPrivate::emit_char_size_changed(int width, +Terminal::emit_char_size_changed(int width, int height) { _vte_debug_print(VTE_DEBUG_SIGNALS, @@ -835,7 +735,7 @@ /* Emit an "increase-font-size" signal. */ void -VteTerminalPrivate::emit_increase_font_size() +Terminal::emit_increase_font_size() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `increase-font-size'.\n"); @@ -844,7 +744,7 @@ /* Emit a "decrease-font-size" signal. */ void -VteTerminalPrivate::emit_decrease_font_size() +Terminal::emit_decrease_font_size() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `decrease-font-size'.\n"); @@ -853,7 +753,7 @@ /* Emit a "text-inserted" signal. */ void -VteTerminalPrivate::emit_text_inserted() +Terminal::emit_text_inserted() { if (!m_accessible_emit) { return; @@ -865,7 +765,7 @@ /* Emit a "text-deleted" signal. */ void -VteTerminalPrivate::emit_text_deleted() +Terminal::emit_text_deleted() { if (!m_accessible_emit) { return; @@ -877,7 +777,7 @@ /* Emit a "text-modified" signal. */ void -VteTerminalPrivate::emit_text_modified() +Terminal::emit_text_modified() { if (!m_accessible_emit) { return; @@ -889,7 +789,7 @@ /* Emit a "text-scrolled" signal. */ void -VteTerminalPrivate::emit_text_scrolled(long delta) +Terminal::emit_text_scrolled(long delta) { if (!m_accessible_emit) { return; @@ -901,14 +801,14 @@ } void -VteTerminalPrivate::emit_copy_clipboard() +Terminal::emit_copy_clipboard() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting 'copy-clipboard'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_COPY_CLIPBOARD], 0); } void -VteTerminalPrivate::emit_paste_clipboard() +Terminal::emit_paste_clipboard() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting 'paste-clipboard'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_PASTE_CLIPBOARD], 0); @@ -916,7 +816,7 @@ /* Emit a "hyperlink_hover_uri_changed" signal. */ void -VteTerminalPrivate::emit_hyperlink_hover_uri_changed(const GdkRectangle *bbox) +Terminal::emit_hyperlink_hover_uri_changed(const GdkRectangle *bbox) { GObject *object = G_OBJECT(m_terminal); @@ -927,7 +827,7 @@ } void -VteTerminalPrivate::deselect_all() +Terminal::deselect_all() { if (m_has_selection) { gint sx, sy, ex, ey, extra; @@ -953,60 +853,9 @@ } } -// FIXMEchpe make m_tabstops a hashset - -/* Remove a tabstop. */ -void -VteTerminalPrivate::clear_tabstop(int column) -{ - if (m_tabstops) { - /* Remove a tab stop from the hash table. */ - g_hash_table_remove(m_tabstops, - GINT_TO_POINTER(2 * column + 1)); - } -} - -/* Check if we have a tabstop at a given position. */ -bool -VteTerminalPrivate::get_tabstop(int column) -{ - if (m_tabstops != NULL) { - auto hash = g_hash_table_lookup(m_tabstops, - GINT_TO_POINTER(2 * column + 1)); - return hash != nullptr; - } - - return false; -} - -/* Reset the set of tab stops to the default. */ -void -VteTerminalPrivate::set_tabstop(int column) -{ - if (m_tabstops != NULL) { - /* Just set a non-NULL pointer for this column number. */ - g_hash_table_insert(m_tabstops, - GINT_TO_POINTER(2 * column + 1), - m_terminal); - } -} - -/* Reset the set of tab stops to the default. */ -void -VteTerminalPrivate::set_default_tabstops() -{ - if (m_tabstops) { - g_hash_table_destroy(m_tabstops); - } - m_tabstops = g_hash_table_new(nullptr, nullptr); - for (int i = 0; i <= VTE_TAB_MAX; i += VTE_TAB_WIDTH) { - set_tabstop(i); - } -} - /* Clear the cache of the screen contents we keep. */ void -VteTerminalPrivate::match_contents_clear() +Terminal::match_contents_clear() { match_hilite_clear(); if (m_match_contents != nullptr) { @@ -1020,7 +869,7 @@ } void -VteTerminalPrivate::match_contents_refresh() +Terminal::match_contents_refresh() { match_contents_clear(); @@ -1073,7 +922,7 @@ } void -VteTerminalPrivate::set_cursor_from_regex_match(struct vte_match_regex *regex) +Terminal::set_cursor_from_regex_match(struct vte_match_regex *regex) { GdkCursor *gdk_cursor = nullptr; @@ -1098,14 +947,14 @@ return; } - gdk_window_set_cursor(m_event_window, gdk_cursor); + m_real_widget->set_cursor(gdk_cursor); if (gdk_cursor) g_object_unref(gdk_cursor); } void -VteTerminalPrivate::regex_match_remove_all() +Terminal::regex_match_remove_all() { struct vte_match_regex *regex; guint i; @@ -1125,7 +974,7 @@ } void -VteTerminalPrivate::regex_match_remove(int tag) +Terminal::regex_match_remove(int tag) { struct vte_match_regex *regex; @@ -1144,14 +993,8 @@ match_hilite_clear(); } -GdkCursor * -VteTerminalPrivate::widget_cursor_new(GdkCursorType cursor_type) const -{ - return gdk_cursor_new_for_display(gtk_widget_get_display(m_widget), cursor_type); -} - int -VteTerminalPrivate::regex_match_add(struct vte_match_regex *new_regex_match) +Terminal::regex_match_add(struct vte_match_regex *new_regex_match) { struct vte_match_regex *regex_match; guint ret, len; @@ -1186,7 +1029,7 @@ } struct vte_match_regex * -VteTerminalPrivate::regex_match_get(int tag) +Terminal::regex_match_get(int tag) { if ((guint)tag >= m_match_regexes->len) return nullptr; @@ -1195,7 +1038,7 @@ } void -VteTerminalPrivate::regex_match_set_cursor(int tag, +Terminal::regex_match_set_cursor(int tag, GdkCursor *gdk_cursor) { struct vte_match_regex *regex = regex_match_get(tag); @@ -1210,7 +1053,7 @@ } void -VteTerminalPrivate::regex_match_set_cursor(int tag, +Terminal::regex_match_set_cursor(int tag, GdkCursorType cursor_type) { struct vte_match_regex *regex = regex_match_get(tag); @@ -1225,7 +1068,7 @@ } void -VteTerminalPrivate::regex_match_set_cursor(int tag, +Terminal::regex_match_set_cursor(int tag, char const* cursor_name) { struct vte_match_regex *regex = regex_match_get(tag); @@ -1253,7 +1096,7 @@ * line in @sattr_ptr and @eattr_ptr. */ bool -VteTerminalPrivate::match_rowcol_to_offset(vte::grid::column_t column, +Terminal::match_rowcol_to_offset(vte::grid::column_t column, vte::grid::row_t row, gsize *offset_ptr, gsize *sattr_ptr, @@ -1370,7 +1213,7 @@ /* creates a pcre match context with appropriate limits */ pcre2_match_context_8 * -VteTerminalPrivate::create_match_context() +Terminal::create_match_context() { pcre2_match_context_8 *match_context; @@ -1382,7 +1225,7 @@ } bool -VteTerminalPrivate::match_check_pcre( +Terminal::match_check_pcre( pcre2_match_data_8 *match_data, pcre2_match_context_8 *match_context, VteRegex *regex, @@ -1501,7 +1344,7 @@ } char * -VteTerminalPrivate::match_check_internal_pcre(vte::grid::column_t column, +Terminal::match_check_internal_pcre(vte::grid::column_t column, vte::grid::row_t row, int *tag, gsize *start, @@ -1603,7 +1446,7 @@ * Returns: (transfer full): the matched string, or %NULL */ char * -VteTerminalPrivate::match_check_internal(vte::grid::column_t column, +Terminal::match_check_internal(vte::grid::column_t column, vte::grid::row_t row, int *tag, gsize *start, @@ -1625,7 +1468,7 @@ } char * -VteTerminalPrivate::regex_match_check(vte::grid::column_t column, +Terminal::regex_match_check(vte::grid::column_t column, vte::grid::row_t row, int *tag) { @@ -1658,7 +1501,7 @@ } /* - * VteTerminalPrivate::view_coords_from_event: + * Terminal::view_coords_from_event: * @event: a #GdkEvent * * Translates the event coordinates to view coordinates, by @@ -1668,19 +1511,25 @@ * at that side; use view_coords_visible() to check for that. */ vte::view::coords -VteTerminalPrivate::view_coords_from_event(GdkEvent const* event) const +Terminal::view_coords_from_event(GdkEvent const* event) const { double x, y; if (event == nullptr || - ((reinterpret_cast(event))->window != m_event_window) || + ((reinterpret_cast(event))->window != m_real_widget->event_window()) || !gdk_event_get_coords(event, &x, &y)) return vte::view::coords(-1, -1); return vte::view::coords(x - m_padding.left, y - m_padding.top); } +bool +Terminal::widget_realized() const noexcept +{ + return m_real_widget ? m_real_widget->realized() : false; +} + /* - * VteTerminalPrivate::grid_coords_from_event: + * Terminal::grid_coords_from_event: * @event: a #GdkEvent * * Translates the event coordinates to view coordinates, by @@ -1690,27 +1539,27 @@ * at that side; use grid_coords_visible() to check for that. */ vte::grid::coords -VteTerminalPrivate::grid_coords_from_event(GdkEvent const* event) const +Terminal::grid_coords_from_event(GdkEvent const* event) const { return grid_coords_from_view_coords(view_coords_from_event(event)); } /* - * VteTerminalPrivate::confined_grid_coords_from_event: + * Terminal::confined_grid_coords_from_event: * @event: a #GdkEvent * * Like grid_coords_from_event(), but also confines the coordinates * to an actual cell in the visible area. */ vte::grid::coords -VteTerminalPrivate::confined_grid_coords_from_event(GdkEvent const* event) const +Terminal::confined_grid_coords_from_event(GdkEvent const* event) const { auto pos = view_coords_from_event(event); return confined_grid_coords_from_view_coords(pos); } /* - * VteTerminalPrivate::grid_coords_from_view_coords: + * Terminal::grid_coords_from_view_coords: * @pos: the view coordinates * * Translates view coordinates to grid coordinates. If the view coordinates point to @@ -1718,7 +1567,7 @@ * < first_displayed_row() or > last_displayed_row(), resp. */ vte::grid::coords -VteTerminalPrivate::grid_coords_from_view_coords(vte::view::coords const& pos) const +Terminal::grid_coords_from_view_coords(vte::view::coords const& pos) const { vte::grid::column_t col; if (pos.x >= 0 && pos.x < m_view_usable_extents.width()) @@ -1734,21 +1583,21 @@ } /* - * VteTerminalPrivate::confined_grid_coords_from_view_coords: + * Terminal::confined_grid_coords_from_view_coords: * @pos: the view coordinates * * Like grid_coords_from_view_coords(), but also confines the coordinates * to an actual cell in the visible area. */ vte::grid::coords -VteTerminalPrivate::confined_grid_coords_from_view_coords(vte::view::coords const& pos) const +Terminal::confined_grid_coords_from_view_coords(vte::view::coords const& pos) const { auto rowcol = grid_coords_from_view_coords(pos); return confine_grid_coords(rowcol); } /* - * VteTerminalPrivate::view_coords_from_grid_coords: + * Terminal::view_coords_from_grid_coords: * @rowcol: the grid coordinates * * Translates grid coordinates to view coordinates. If the view coordinates are @@ -1757,21 +1606,21 @@ * Returns: %true if the coordinates are inside the usable area */ vte::view::coords -VteTerminalPrivate::view_coords_from_grid_coords(vte::grid::coords const& rowcol) const +Terminal::view_coords_from_grid_coords(vte::grid::coords const& rowcol) const { return vte::view::coords(rowcol.column() * m_cell_width, row_to_pixel(rowcol.row())); } bool -VteTerminalPrivate::view_coords_visible(vte::view::coords const& pos) const +Terminal::view_coords_visible(vte::view::coords const& pos) const { return pos.x >= 0 && pos.x < m_view_usable_extents.width() && pos.y >= 0 && pos.y < m_view_usable_extents.height(); } bool -VteTerminalPrivate::grid_coords_visible(vte::grid::coords const& rowcol) const +Terminal::grid_coords_visible(vte::grid::coords const& rowcol) const { return rowcol.column() >= 0 && rowcol.column() < m_column_count && @@ -1780,7 +1629,7 @@ } vte::grid::coords -VteTerminalPrivate::confine_grid_coords(vte::grid::coords const& rowcol) const +Terminal::confine_grid_coords(vte::grid::coords const& rowcol) const { /* Confine clicks to the nearest actual cell. This is especially useful for * fullscreen vte so that you can click on the very edge of the screen. @@ -1793,7 +1642,7 @@ } bool -VteTerminalPrivate::rowcol_from_event(GdkEvent *event, +Terminal::rowcol_from_event(GdkEvent *event, long *column, long *row) { @@ -1807,7 +1656,7 @@ } char * -VteTerminalPrivate::hyperlink_check(GdkEvent *event) +Terminal::hyperlink_check(GdkEvent *event) { long col, row; const char *hyperlink; @@ -1833,7 +1682,7 @@ } char * -VteTerminalPrivate::regex_match_check(GdkEvent *event, +Terminal::regex_match_check(GdkEvent *event, int *tag) { long col, row; @@ -1846,7 +1695,7 @@ } bool -VteTerminalPrivate::regex_match_check_extra(GdkEvent *event, +Terminal::regex_match_check_extra(GdkEvent *event, VteRegex **regexes, gsize n_regexes, guint32 match_flags, @@ -1905,7 +1754,7 @@ /* Emit an adjustment changed signal on our adjustment object. */ void -VteTerminalPrivate::emit_adjustment_changed() +Terminal::emit_adjustment_changed() { if (m_adjustment_changed_pending) { bool changed = false; @@ -1996,14 +1845,14 @@ /* Queue an adjustment-changed signal to be delivered when convenient. */ // FIXMEchpe this has just one caller, fold it into the call site void -VteTerminalPrivate::queue_adjustment_changed() +Terminal::queue_adjustment_changed() { m_adjustment_changed_pending = true; add_update_timeout(this); } void -VteTerminalPrivate::queue_adjustment_value_changed(double v) +Terminal::queue_adjustment_value_changed(double v) { if (!_vte_double_equal(v, m_screen->scroll_delta)) { _vte_debug_print(VTE_DEBUG_ADJ, @@ -2016,7 +1865,7 @@ } void -VteTerminalPrivate::queue_adjustment_value_changed_clamped(double v) +Terminal::queue_adjustment_value_changed_clamped(double v) { double lower = gtk_adjustment_get_lower(m_vadjustment); double upper = gtk_adjustment_get_upper(m_vadjustment); @@ -2027,7 +1876,7 @@ } void -VteTerminalPrivate::adjust_adjustments() +Terminal::adjust_adjustments() { g_assert(m_screen != nullptr); g_assert(m_screen->row_data != nullptr); @@ -2051,7 +1900,7 @@ /* Update the adjustment field of the widget. This function should be called * whenever we add rows to or remove rows from the history or switch screens. */ void -VteTerminalPrivate::adjust_adjustments_full() +Terminal::adjust_adjustments_full() { g_assert(m_screen != NULL); g_assert(m_screen->row_data != NULL); @@ -2062,7 +1911,7 @@ /* Scroll a fixed number of lines up or down in the current screen. */ void -VteTerminalPrivate::scroll_lines(long lines) +Terminal::scroll_lines(long lines) { double destination; _vte_debug_print(VTE_DEBUG_ADJ, "Scrolling %ld lines.\n", lines); @@ -2080,13 +1929,13 @@ /* Scroll so that the scroll delta is the minimum value. */ void -VteTerminalPrivate::maybe_scroll_to_top() +Terminal::maybe_scroll_to_top() { queue_adjustment_value_changed(_vte_ring_delta(m_screen->row_data)); } void -VteTerminalPrivate::maybe_scroll_to_bottom() +Terminal::maybe_scroll_to_bottom() { queue_adjustment_value_changed(m_screen->insert_delta); _vte_debug_print(VTE_DEBUG_ADJ, @@ -2094,7 +1943,7 @@ } /* - * VteTerminalPrivate::set_encoding: + * Terminal::set_encoding: * @codeset: (allow-none): a valid #GIConv target, or %NULL to use UTF-8 * * Changes the encoding the terminal will expect data from the child to @@ -2104,89 +1953,99 @@ * Returns: %true if the encoding could be changed to the specified one */ bool -VteTerminalPrivate::set_encoding(char const* codeset) +Terminal::set_encoding(char const* codeset) { - VteConv conv; - - GObject *object = G_OBJECT(m_terminal); - - if (codeset == NULL) { +#ifdef WITH_ICONV + if (codeset == nullptr) { codeset = "UTF-8"; } - if ((m_encoding != nullptr) && g_str_equal(codeset, m_encoding)) { - /* Nothing to do! */ - return true; - } - /* Open new conversions. */ - conv = _vte_conv_open(codeset, "UTF-8"); - if (conv == VTE_INVALID_CONV) - return false; - - auto old_codeset = m_encoding; - - g_object_freeze_notify(object); + bool const using_utf8 = g_str_equal(codeset, "UTF-8"); - if (m_outgoing_conv != VTE_INVALID_CONV) { - _vte_conv_close(m_outgoing_conv); - } - m_outgoing_conv = conv; - - /* Set the terminal's encoding to the new value. */ - m_encoding = g_intern_string(codeset); - - /* Convert any buffered output bytes. */ - if ((_vte_byte_array_length(m_outgoing) > 0) && - (old_codeset != nullptr)) { - char *obuf1, *obuf2; - gsize bytes_written; - - /* Convert back to UTF-8. */ - obuf1 = g_convert((char *)m_outgoing->data, - _vte_byte_array_length(m_outgoing), - "UTF-8", - old_codeset, - NULL, - &bytes_written, - NULL); - if (obuf1 != NULL) { - /* Convert to the new encoding. */ - obuf2 = g_convert(obuf1, - bytes_written, - codeset, - "UTF-8", - NULL, - &bytes_written, - NULL); - if (obuf2 != NULL) { - _vte_byte_array_clear(m_outgoing); - _vte_byte_array_append(m_outgoing, - obuf2, bytes_written); - g_free(obuf2); - } - g_free(obuf1); - } - } + if (using_utf8) { + if (m_incoming_conv != ((GIConv)-1)) + g_iconv_close(m_incoming_conv); + if (m_outgoing_conv != ((GIConv)-1)) + g_iconv_close(m_outgoing_conv); + } else { + auto outconv = g_iconv_open(codeset, "UTF-8"); + if (outconv == ((GIConv)-1)) + return false; + + auto inconv = g_iconv_open("UTF-8", codeset); + if (inconv == ((GIConv)-1)) { + g_iconv_close(outconv); + return FALSE; + } + + if (m_outgoing_conv != ((GIConv)-1)) { + g_iconv_close(m_outgoing_conv); + } + m_outgoing_conv = outconv; /* adopted */ + + if (m_incoming_conv != ((GIConv)-1)) { + g_iconv_close(m_incoming_conv); + } + m_incoming_conv = inconv; /* adopted */ + + /* Set the terminal's encoding to the new value. */ + auto old_codeset = m_encoding ? m_encoding : "UTF-8"; + m_encoding = g_intern_string(codeset); + + /* Convert any buffered output bytes. */ + if ((_vte_byte_array_length(m_outgoing) > 0) && + (old_codeset != nullptr)) { + char *obuf1, *obuf2; + gsize bytes_written; + + /* Convert back to UTF-8. */ + obuf1 = g_convert((char *)m_outgoing->data, + _vte_byte_array_length(m_outgoing), + "UTF-8", + old_codeset, + NULL, + &bytes_written, + NULL); + if (obuf1 != NULL) { + /* Convert to the new encoding. */ + obuf2 = g_convert(obuf1, + bytes_written, + codeset, + "UTF-8", + NULL, + &bytes_written, + NULL); + if (obuf2 != NULL) { + _vte_byte_array_clear(m_outgoing); + _vte_byte_array_append(m_outgoing, + obuf2, bytes_written); + g_free(obuf2); + } + g_free(obuf1); + } + } + } - /* Set the encoding for incoming text. */ - _vte_iso2022_state_set_codeset(m_iso2022, - m_encoding); + m_using_utf8 = using_utf8; _vte_debug_print(VTE_DEBUG_IO, "Set terminal encoding to `%s'.\n", m_encoding); _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `encoding-changed'.\n"); + + GObject *object = G_OBJECT(m_terminal); g_signal_emit(object, signals[SIGNAL_ENCODING_CHANGED], 0); g_object_notify_by_pspec(object, pspecs[PROP_ENCODING]); - g_object_thaw_notify(object); - return true; +#else + return false; +#endif } bool -VteTerminalPrivate::set_cjk_ambiguous_width(int width) +Terminal::set_cjk_ambiguous_width(int width) { g_assert(width == 1 || width == 2); @@ -2199,7 +2058,7 @@ // FIXMEchpe replace this with a method on VteRing VteRowData * -VteTerminalPrivate::insert_rows (guint cnt) +Terminal::insert_rows (guint cnt) { VteRowData *row; do { @@ -2211,7 +2070,7 @@ /* Make sure we have enough rows and columns to hold data at the current * cursor position. */ VteRowData * -VteTerminalPrivate::ensure_row() +Terminal::ensure_row() { VteRowData *row; @@ -2231,7 +2090,7 @@ } VteRowData * -VteTerminalPrivate::ensure_cursor() +Terminal::ensure_cursor() { VteRowData *row = ensure_row(); _vte_row_data_fill(row, &basic_cell, m_screen->cursor.col); @@ -2242,7 +2101,7 @@ /* Update the insert delta so that the screen which includes it also * includes the end of the buffer. */ void -VteTerminalPrivate::update_insert_delta() +Terminal::update_insert_delta() { /* The total number of lines. Add one to the cursor offset * because it's zero-based. */ @@ -2271,7 +2130,7 @@ /* Apply the desired mouse pointer, based on certain member variables. */ void -VteTerminalPrivate::apply_mouse_cursor() +Terminal::apply_mouse_cursor() { if (!widget_realized()) return; @@ -2285,7 +2144,7 @@ if (m_hyperlink_hover_idx != 0) { _vte_debug_print(VTE_DEBUG_CURSOR, "Setting hyperlink mouse cursor.\n"); - gdk_window_set_cursor(m_event_window, m_mouse_hyperlink_cursor); + m_real_widget->set_cursor(vte::platform::Widget::Cursor::eHyperlink); } else if ((guint)m_match_tag < m_match_regexes->len) { struct vte_match_regex *regex = &g_array_index(m_match_regexes, @@ -2295,22 +2154,22 @@ } else if (m_mouse_tracking_mode) { _vte_debug_print(VTE_DEBUG_CURSOR, "Setting mousing cursor.\n"); - gdk_window_set_cursor(m_event_window, m_mouse_mousing_cursor); + m_real_widget->set_cursor(vte::platform::Widget::Cursor::eMousing); } else { _vte_debug_print(VTE_DEBUG_CURSOR, "Setting default mouse cursor.\n"); - gdk_window_set_cursor(m_event_window, m_mouse_default_cursor); + m_real_widget->set_cursor(vte::platform::Widget::Cursor::eDefault); } } else { _vte_debug_print(VTE_DEBUG_CURSOR, "Setting to invisible cursor.\n"); - gdk_window_set_cursor(m_event_window, m_mouse_inviso_cursor); + m_real_widget->set_cursor(vte::platform::Widget::Cursor::eInvisible); } } /* Show or hide the pointer if autohiding is enabled. */ void -VteTerminalPrivate::set_pointer_autohidden(bool autohidden) +Terminal::set_pointer_autohidden(bool autohidden) { if (autohidden == m_mouse_cursor_autohidden) return; @@ -2330,7 +2189,7 @@ * VTE_CURSOR_FG, VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG. */ vte::color::rgb const* -VteTerminalPrivate::get_color(int entry) const +Terminal::get_color(int entry) const { VtePaletteColor const* palette_color = &m_palette[entry]; guint source; @@ -2342,7 +2201,7 @@ /* Set up a palette entry with a more-or-less match for the requested color. */ void -VteTerminalPrivate::set_color(int entry, +Terminal::set_color(int entry, int source, vte::color::rgb const& proposed) { @@ -2374,7 +2233,7 @@ } void -VteTerminalPrivate::reset_color(int entry, +Terminal::reset_color(int entry, int source) { g_assert(entry >= 0 && entry < VTE_PALETTE_SIZE); @@ -2403,7 +2262,7 @@ } bool -VteTerminalPrivate::set_background_alpha(double alpha) +Terminal::set_background_alpha(double alpha) { g_assert(alpha >= 0. && alpha <= 1.); @@ -2420,13 +2279,13 @@ } void -VteTerminalPrivate::set_colors_default() +Terminal::set_colors_default() { set_colors(nullptr, nullptr, nullptr, 0); } /* - * VteTerminalPrivate::set_colors: + * Terminal::set_colors: * @terminal: a #VteTerminal * @foreground: (allow-none): the new foreground color, or %NULL * @background: (allow-none): the new background color, or %NULL @@ -2444,7 +2303,7 @@ * greater than 0, the new background color is taken from @palette[0]. */ void -VteTerminalPrivate::set_colors(vte::color::rgb const* foreground, +Terminal::set_colors(vte::color::rgb const* foreground, vte::color::rgb const* background, vte::color::rgb const* new_palette, gsize palette_size) @@ -2541,14 +2400,14 @@ } /* - * VteTerminalPrivate::set_color_bold: + * Terminal::set_color_bold: * @bold: (allow-none): the new bold color or %NULL * * Sets the color used to draw bold text in the default foreground color. * If @bold is %NULL then the default color is used. */ void -VteTerminalPrivate::set_color_bold(vte::color::rgb const& color) +Terminal::set_color_bold(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "bold", @@ -2557,7 +2416,7 @@ } void -VteTerminalPrivate::reset_color_bold() +Terminal::reset_color_bold() { _vte_debug_print(VTE_DEBUG_MISC, "Reset %s color.\n", "bold"); @@ -2565,13 +2424,13 @@ } /* - * VteTerminalPrivate::set_color_foreground: + * Terminal::set_color_foreground: * @foreground: the new foreground color * * Sets the foreground color used to draw normal text. */ void -VteTerminalPrivate::set_color_foreground(vte::color::rgb const& color) +Terminal::set_color_foreground(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "foreground", @@ -2580,7 +2439,7 @@ } /* - * VteTerminalPrivate::set_color_background: + * Terminal::set_color_background: * @background: the new background color * * Sets the background color for text which does not have a specific background @@ -2588,7 +2447,7 @@ * the terminal is not transparent. */ void -VteTerminalPrivate::set_color_background(vte::color::rgb const& color) +Terminal::set_color_background(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "background", @@ -2597,7 +2456,7 @@ } /* - * VteTerminalPrivate::set_color_cursor_background: + * Terminal::set_color_cursor_background: * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL * * Sets the background color for text which is under the cursor. If %NULL, text @@ -2605,7 +2464,7 @@ * reversed. */ void -VteTerminalPrivate::set_color_cursor_background(vte::color::rgb const& color) +Terminal::set_color_cursor_background(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "cursor background", @@ -2614,7 +2473,7 @@ } void -VteTerminalPrivate::reset_color_cursor_background() +Terminal::reset_color_cursor_background() { _vte_debug_print(VTE_DEBUG_MISC, "Reset %s color.\n", "cursor background"); @@ -2622,7 +2481,7 @@ } /* - * VteTerminalPrivate::set_color_cursor_foreground: + * Terminal::set_color_cursor_foreground: * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL * * Sets the foreground color for text which is under the cursor. If %NULL, text @@ -2630,7 +2489,7 @@ * reversed. */ void -VteTerminalPrivate::set_color_cursor_foreground(vte::color::rgb const& color) +Terminal::set_color_cursor_foreground(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "cursor foreground", @@ -2639,7 +2498,7 @@ } void -VteTerminalPrivate::reset_color_cursor_foreground() +Terminal::reset_color_cursor_foreground() { _vte_debug_print(VTE_DEBUG_MISC, "Reset %s color.\n", "cursor foreground"); @@ -2647,7 +2506,7 @@ } /* - * VteTerminalPrivate::set_color_highlight_background: + * Terminal::set_color_highlight_background: * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL * * Sets the background color for text which is highlighted. If %NULL, @@ -2656,7 +2515,7 @@ * be drawn with foreground and background colors reversed. */ void -VteTerminalPrivate::set_color_highlight_background(vte::color::rgb const& color) +Terminal::set_color_highlight_background(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "highlight background", @@ -2665,7 +2524,7 @@ } void -VteTerminalPrivate::reset_color_highlight_background() +Terminal::reset_color_highlight_background() { _vte_debug_print(VTE_DEBUG_MISC, "Reset %s color.\n", "highlight background"); @@ -2673,7 +2532,7 @@ } /* - * VteTerminalPrivate::set_color_highlight_foreground: + * Terminal::set_color_highlight_foreground: * @highlight_foreground: (allow-none): the new color to use for highlighted text, or %NULL * * Sets the foreground color for text which is highlighted. If %NULL, @@ -2682,7 +2541,7 @@ * be drawn with foreground and background colors reversed. */ void -VteTerminalPrivate::set_color_highlight_foreground(vte::color::rgb const& color) +Terminal::set_color_highlight_foreground(vte::color::rgb const& color) { _vte_debug_print(VTE_DEBUG_MISC, "Set %s color to (%04x,%04x,%04x).\n", "highlight foreground", @@ -2691,7 +2550,7 @@ } void -VteTerminalPrivate::reset_color_highlight_foreground() +Terminal::reset_color_highlight_foreground() { _vte_debug_print(VTE_DEBUG_MISC, "Reset %s color.\n", "highlight foreground"); @@ -2699,7 +2558,7 @@ } /* - * VteTerminalPrivate::cleanup_fragments: + * Terminal::cleanup_fragments: * @start: the starting column, inclusive * @end: the end column, exclusive * @@ -2719,7 +2578,7 @@ * because the caller can't reasonably be expected to take care of this. */ void -VteTerminalPrivate::cleanup_fragments(long start, +Terminal::cleanup_fragments(long start, long end) { VteRowData *row = ensure_row(); @@ -2804,7 +2663,7 @@ /* Cursor down, with scrolling. */ void -VteTerminalPrivate::cursor_down(bool explicit_sequence) +Terminal::cursor_down(bool explicit_sequence) { long start, end; @@ -2871,7 +2730,7 @@ /* Drop the scrollback. */ void -VteTerminalPrivate::drop_scrollback() +Terminal::drop_scrollback() { /* Only for normal screen; alternate screen doesn't have a scrollback. */ _vte_ring_drop_scrollback (m_normal_screen.row_data, @@ -2885,17 +2744,17 @@ /* Restore cursor on a screen. */ void -VteTerminalPrivate::restore_cursor(VteScreen *screen__) +Terminal::restore_cursor(VteScreen *screen__) { screen__->cursor.col = screen__->saved.cursor.col; screen__->cursor.row = screen__->insert_delta + CLAMP(screen__->saved.cursor.row, 0, m_row_count - 1); - m_reverse_mode = screen__->saved.reverse_mode; - m_origin_mode = screen__->saved.origin_mode; - m_sendrecv_mode = screen__->saved.sendrecv_mode; - m_insert_mode = screen__->saved.insert_mode; - m_linefeed_mode = screen__->saved.linefeed_mode; + m_modes_ecma.set_modes(screen__->saved.modes_ecma); + + m_modes_private.set_DEC_REVERSE_IMAGE(screen__->saved.reverse_mode); + m_modes_private.set_DEC_ORIGIN(screen__->saved.origin_mode); + m_defaults = screen__->saved.defaults; m_color_defaults = screen__->saved.color_defaults; m_fill_defaults = screen__->saved.fill_defaults; @@ -2906,16 +2765,16 @@ /* Save cursor on a screen__. */ void -VteTerminalPrivate::save_cursor(VteScreen *screen__) +Terminal::save_cursor(VteScreen *screen__) { screen__->saved.cursor.col = screen__->cursor.col; screen__->saved.cursor.row = screen__->cursor.row - screen__->insert_delta; - screen__->saved.reverse_mode = m_reverse_mode; - screen__->saved.origin_mode = m_origin_mode; - screen__->saved.sendrecv_mode = m_sendrecv_mode; - screen__->saved.insert_mode = m_insert_mode; - screen__->saved.linefeed_mode = m_linefeed_mode; + screen__->saved.modes_ecma = m_modes_ecma.get_modes(); + + screen__->saved.reverse_mode = m_modes_private.DEC_REVERSE_IMAGE(); + screen__->saved.origin_mode = m_modes_private.DEC_ORIGIN(); + screen__->saved.defaults = m_defaults; screen__->saved.color_defaults = m_color_defaults; screen__->saved.fill_defaults = m_fill_defaults; @@ -2925,8 +2784,8 @@ } /* Insert a single character into the stored data array. */ -bool -VteTerminalPrivate::insert_char(gunichar c, +void +Terminal::insert_char(gunichar c, bool insert, bool invalidate_now) { @@ -2938,7 +2797,7 @@ gunichar c_unmapped = c; /* DEC Special Character and Line Drawing Set. VT100 and higher (per XTerm docs). */ - static gunichar line_drawing_map[31] = { + static const gunichar line_drawing_map[31] = { 0x25c6, /* ` => diamond */ 0x2592, /* a => checkerboard */ 0x2409, /* b => HT symbol */ @@ -2972,7 +2831,7 @@ 0x00b7, /* ~ => bullet */ }; - insert |= m_insert_mode; + insert |= m_modes_ecma.IRM(); invalidate_now |= insert; /* If we've enabled the special drawing set, map the characters to @@ -2991,7 +2850,7 @@ /* If we're autowrapping here, do it. */ col = m_screen->cursor.col; if (G_UNLIKELY (columns && col + columns > m_column_count)) { - if (m_autowrap) { + if (m_modes_private.DEC_AUTOWRAP()) { _vte_debug_print(VTE_DEBUG_ADJ, "Autowrapping before character\n"); /* Wrap. */ @@ -3009,13 +2868,17 @@ line_wrapped = true; } - _vte_debug_print(VTE_DEBUG_PARSE, - "Inserting %ld '%c' (colors %" G_GUINT64_FORMAT ") (%ld+%d, %ld), delta = %ld; ", - (long)c, c < 256 ? c : ' ', + _vte_debug_print(VTE_DEBUG_PARSER, + "Inserting U+%04X '%lc' (colors %" G_GUINT64_FORMAT ") (%ld+%d, %ld), delta = %ld; ", + (unsigned int)c, g_unichar_isprint(c) ? c : 0xfffd, m_color_defaults.attr.colors(), col, columns, (long)m_screen->cursor.row, (long)m_screen->insert_delta); + //FIXMEchpe + if (G_UNLIKELY(c == 0)) + goto not_inserted; + if (G_UNLIKELY (columns == 0)) { /* It's a combining mark */ @@ -3023,7 +2886,7 @@ long row_num; VteCell *cell; - _vte_debug_print(VTE_DEBUG_PARSE, "combining U+%04X", c); + _vte_debug_print(VTE_DEBUG_PARSER, "combining U+%04X", c); row_num = m_screen->cursor.row; row = NULL; @@ -3136,22 +2999,23 @@ m_text_inserted_flag = TRUE; not_inserted: - _vte_debug_print(VTE_DEBUG_ADJ|VTE_DEBUG_PARSE, + _vte_debug_print(VTE_DEBUG_ADJ|VTE_DEBUG_PARSER, "insertion delta => %ld.\n", (long)m_screen->insert_delta); - return line_wrapped; + + m_line_wrapped = line_wrapped; } static void reaper_child_exited_cb(VteReaper *reaper, int ipid, int status, - VteTerminalPrivate *that) + vte::terminal::Terminal* that) { - GPid pid = GPid(ipid); + pid_t pid = pid_t{ipid}; auto terminal = that->m_terminal; - /* keep the VteTerminalPrivate in a death grip */ + /* keep the vte::terminal::Terminal in a death grip */ g_object_ref(terminal); that->child_watch_done(pid, status); g_object_unref(terminal); @@ -3159,8 +3023,8 @@ } void -VteTerminalPrivate::child_watch_done(GPid pid, - int status) +Terminal::child_watch_done(pid_t pid, + int status) { if (pid != m_pty_pid) return; @@ -3197,15 +3061,14 @@ set_pty(nullptr); /* Tell observers what's happened. */ - _vte_debug_print(VTE_DEBUG_SIGNALS, - "Emitting `child-exited'.\n"); - g_signal_emit(object, signals[SIGNAL_CHILD_EXITED], 0, status); + if (m_real_widget) + m_real_widget->emit_child_exited(status); g_object_thaw_notify(object); } static void -mark_input_source_invalid_cb(VteTerminalPrivate *that) +mark_input_source_invalid_cb(vte::terminal::Terminal* that) { _vte_debug_print (VTE_DEBUG_IO, "removed poll of io_read_cb\n"); that->m_pty_input_source = 0; @@ -3215,13 +3078,13 @@ static gboolean io_read_cb(GIOChannel *channel, GIOCondition condition, - VteTerminalPrivate *that) + vte::terminal::Terminal* that) { return that->pty_io_read(channel, condition); } void -VteTerminalPrivate::connect_pty_read() +Terminal::connect_pty_read() { if (m_pty_channel == NULL) return; @@ -3239,7 +3102,7 @@ } static void -mark_output_source_invalid_cb(VteTerminalPrivate *that) +mark_output_source_invalid_cb(vte::terminal::Terminal* that) { _vte_debug_print (VTE_DEBUG_IO, "removed poll of io_write_cb\n"); that->m_pty_output_source = 0; @@ -3249,13 +3112,13 @@ static gboolean io_write_cb(GIOChannel *channel, GIOCondition condition, - VteTerminalPrivate *that) + vte::terminal::Terminal* that) { return that->pty_io_write(channel, condition); } void -VteTerminalPrivate::connect_pty_write() +Terminal::connect_pty_write() { g_assert(m_pty != nullptr); g_warn_if_fail(m_input_enabled); @@ -3281,7 +3144,7 @@ } void -VteTerminalPrivate::disconnect_pty_read() +Terminal::disconnect_pty_read() { if (m_pty_input_source != 0) { _vte_debug_print (VTE_DEBUG_IO, "disconnecting poll of vte_terminal_io_read\n"); @@ -3292,7 +3155,7 @@ } void -VteTerminalPrivate::disconnect_pty_write() +Terminal::disconnect_pty_write() { if (m_pty_output_source != 0) { _vte_debug_print (VTE_DEBUG_IO, "disconnecting poll of vte_terminal_io_write\n"); @@ -3303,13 +3166,13 @@ } void -VteTerminalPrivate::pty_termios_changed() +Terminal::pty_termios_changed() { _vte_debug_print(VTE_DEBUG_IO, "Termios changed\n"); } void -VteTerminalPrivate::pty_scroll_lock_changed(bool locked) +Terminal::pty_scroll_lock_changed(bool locked) { _vte_debug_print(VTE_DEBUG_IO, "Output %s (^%c)\n", locked ? "stopped" : "started", @@ -3317,8 +3180,8 @@ } /* - * VteTerminalPrivate::watch_child: - * @child_pid: a #GPid + * Terminal::watch_child: + * @child_pid: a #pid_t * * Watches @child_pid. When the process exists, the #VteTerminal::child-exited * signal will be called with the child's exit status. @@ -3335,7 +3198,7 @@ * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed. */ void -VteTerminalPrivate::watch_child (GPid child_pid) +Terminal::watch_child (pid_t child_pid) { // FIXMEchpe: support passing child_pid = -1 to remove the wathch g_assert(child_pid != -1); @@ -3371,7 +3234,7 @@ } /* - * VteTerminalPrivate::spawn_sync: + * Terminal::spawn_sync: * @pty_flags: flags from #VtePtyFlags * @working_directory: (allow-none): the name of a directory the command should start * in, or %NULL to use the current working directory @@ -3398,7 +3261,7 @@ * Returns: %TRUE on success, or %FALSE on error with @error filled in */ bool -VteTerminalPrivate::spawn_sync(VtePtyFlags pty_flags, +Terminal::spawn_sync(VtePtyFlags pty_flags, const char *working_directory, char **argv, char **envv, @@ -3452,7 +3315,7 @@ /* Handle an EOF from the client. */ void -VteTerminalPrivate::pty_channel_eof() +Terminal::pty_channel_eof() { GObject *object = G_OBJECT(m_terminal); @@ -3468,43 +3331,204 @@ /* Reset the input method context. */ void -VteTerminalPrivate::im_reset() +Terminal::im_reset() { - if (widget_realized() && m_im_context) - gtk_im_context_reset(m_im_context); + m_real_widget->im_reset(); + + m_im_preedit.clear(); + m_im_preedit.shrink_to_fit(); - if (m_im_preedit) { - g_free(m_im_preedit); - m_im_preedit = nullptr; - } if (m_im_preedit_attrs) { pango_attr_list_unref(m_im_preedit_attrs); m_im_preedit_attrs = nullptr; } } -/* Process incoming data, first converting it to unicode characters, and then - * processing control sequences. */ +#ifdef WITH_ICONV + +static size_t +_vte_conv(GIConv conv, + char **inbuf, gsize *inbytes_left, + gchar **outbuf, gsize *outbytes_left) +{ + size_t ret, tmp; + gchar *work_inbuf_start, *work_inbuf_working; + gchar *work_outbuf_start, *work_outbuf_working; + gsize work_inbytes, work_outbytes; + + g_assert(conv != (GIConv) -1); + + work_inbuf_start = work_inbuf_working = *inbuf; + work_outbuf_start = work_outbuf_working = *outbuf; + work_inbytes = *inbytes_left; + work_outbytes = *outbytes_left; + + /* Call the underlying conversion. */ + ret = 0; + do { + tmp = g_iconv(conv, + &work_inbuf_working, + &work_inbytes, + &work_outbuf_working, + &work_outbytes); + if (tmp == (size_t) -1) { + /* Check for zero bytes, which we pass right through. */ + if (errno == EILSEQ) { + if ((work_inbytes > 0) && + (work_inbuf_working[0] == '\0') && + (work_outbytes > 0)) { + work_outbuf_working[0] = '\0'; + work_outbuf_working++; + work_inbuf_working++; + work_outbytes--; + work_inbytes--; + ret++; + } else { + /* No go. */ + ret = -1; + break; + } + } else { + ret = -1; + break; + } + } else { + ret += tmp; + break; + } + } while (work_inbytes > 0); + + /* We can't handle this particular failure, and it should + * never happen. (If it does, our caller needs fixing.) */ + g_assert((ret != (size_t)-1) || (errno != E2BIG)); + + /* Pass on the output results. */ + *outbuf = work_outbuf_working; + *outbytes_left -= (work_outbuf_working - work_outbuf_start); + + /* Pass on the input results. */ + *inbuf = work_inbuf_working; + *inbytes_left -= (work_inbuf_working - work_inbuf_start); + + return ret; +} + void -VteTerminalPrivate::process_incoming() +Terminal::convert_incoming() noexcept +{ + /* This is for legacy applications, so efficiency is not + * of any concern. Flatten the chunks into one big buffer, + * process that, and put the resulting UTF-8 back into + * chunks. + */ + auto buf = _vte_byte_array_new(); + _vte_byte_array_append(buf, m_incoming_leftover->data, m_incoming_leftover->len); + _vte_byte_array_clear(m_incoming_leftover); + while (!m_incoming_queue.empty()) { + auto chunk = m_incoming_queue.front().get(); + _vte_byte_array_append(buf, chunk->data, chunk->len); + m_incoming_queue.pop(); + } + + /* Convert the data to UTF-8 */ + auto inbuf = (char*)buf->data; + size_t inbytes = buf->len; + + _VTE_DEBUG_IF(VTE_DEBUG_IO) { + _vte_debug_hexdump("Incoming buffer before conversion to UTF-8", + (uint8_t const*)inbuf, inbytes); + } + + auto unibuf = _vte_byte_array_new(); + _vte_byte_array_set_minimum_size(unibuf, VTE_UTF8_BPC * inbytes); + auto outbuf = (char*)unibuf->data; + size_t outbytes = unibuf->len; + + bool stop = false; + do { + auto converted = _vte_conv(m_incoming_conv, + &inbuf, &inbytes, + &outbuf, &outbytes); + switch (converted) { + case ((gsize)-1): + switch (errno) { + case EILSEQ: { + /* Munge the input. */ + inbuf++; + inbytes--; + auto l = g_unichar_to_utf8(0xfffdU, (char*)outbuf); + outbuf += l; + outbytes -= l; + break; + } + case EINVAL: + /* Incomplete. Save for later. */ + stop = true; + break; + case E2BIG: + /* Should never happen. */ + g_assert_not_reached(); + break; + default: + /* Should never happen. */ + g_assert_not_reached(); + break; + } + default: + break; + } + } while ((inbytes > 0) && !stop); + + /* FIXMEchpe this code used to skip NUL bytes, + * while the _vte_conv call passes NUL bytes through + * specifically. What's goint on!? + */ + + /* Done. */ + auto processed = buf->len - inbytes; + unibuf->len = unibuf->len - outbytes; + + /* If anything is left unconverted, store it for the next processing round. */ + if (processed != buf->len) { + _vte_byte_array_append(m_incoming_leftover, + buf->data + processed, + buf->len - processed); + } + + auto outlen = unibuf->len; + while (outlen > 0) { + outbuf = (char*)unibuf->data; + while (outlen > 0) { + m_incoming_queue.push(std::move(vte::base::Chunk::get())); + auto chunk = m_incoming_queue.back().get(); + auto len = std::min(size_t(outlen), chunk->capacity()); + memcpy(chunk->data, outbuf, len); + chunk->len = len; + outbuf += len; + outlen -= len; + } + + g_assert_cmpuint(outlen, ==, 0); + } +} + +#endif /* WITH_ICONV */ + +void +Terminal::process_incoming() { VteVisualPosition saved_cursor; gboolean saved_cursor_visible; VteCursorStyle saved_cursor_style; GdkPoint bbox_topleft, bbox_bottomright; - gunichar *wbuf, c; - long wcount, start; - gboolean leftovers, modified, bottom, again; + gboolean modified, bottom; gboolean invalidated_text; gboolean in_scroll_region; - GArray *unichars; - struct _vte_incoming_chunk *chunk, *next_chunk, *achunk = NULL; _vte_debug_print(VTE_DEBUG_IO, - "Handler processing %" G_GSIZE_FORMAT " bytes over %" G_GSIZE_FORMAT " chunks + %d bytes pending.\n", - _vte_incoming_chunks_length(m_incoming), - _vte_incoming_chunks_count(m_incoming), - m_pending->len); + "Handler processing %" G_GSIZE_FORMAT " bytes over %" G_GSIZE_FORMAT " chunks.\n", + m_input_bytes, + m_incoming_queue.size()); _vte_debug_print (VTE_DEBUG_WORK, "("); auto previous_screen = m_screen; @@ -3516,7 +3540,7 @@ /* Save the current cursor position. */ saved_cursor = m_screen->cursor; - saved_cursor_visible = m_cursor_visible; + saved_cursor_visible = m_modes_private.DEC_TEXT_CURSOR(); saved_cursor_style = m_cursor_style; in_scroll_region = m_scrolling_restricted @@ -3524,287 +3548,215 @@ && (m_screen->cursor.row <= (m_screen->insert_delta + m_scrolling_region.end)); /* We should only be called when there's data to process. */ - g_assert(m_incoming || - (m_pending->len > 0)); - - /* Convert the data into unicode characters. */ - unichars = m_pending; - for (chunk = _vte_incoming_chunks_reverse (m_incoming); - chunk != NULL; - chunk = next_chunk) { - gsize processed; - next_chunk = chunk->next; - if (chunk->len == 0) { - goto skip_chunk; - } - processed = _vte_iso2022_process(m_iso2022, - chunk->data, chunk->len, - unichars); - if (G_UNLIKELY (processed != chunk->len)) { - /* shuffle the data about */ - g_memmove (chunk->data, chunk->data + processed, - chunk->len - processed); - chunk->len = chunk->len - processed; - processed = sizeof (chunk->data) - chunk->len; - if (processed != 0 && next_chunk != NULL) { - if (next_chunk->len <= processed) { - /* consume it entirely */ - memcpy (chunk->data + chunk->len, - next_chunk->data, - next_chunk->len); - chunk->len += next_chunk->len; - chunk->next = next_chunk->next; - release_chunk (next_chunk); - } else { - /* next few bytes */ - memcpy (chunk->data + chunk->len, - next_chunk->data, - processed); - chunk->len += processed; - g_memmove (next_chunk->data, - next_chunk->data + processed, - next_chunk->len - processed); - next_chunk->len -= processed; - } - next_chunk = chunk; /* repeat */ - } else { - break; - } - } else { -skip_chunk: - /* cache the last chunk */ - if (achunk) { - release_chunk (achunk); - } - achunk = chunk; - } - } - if (achunk) { - if (chunk != NULL) { - release_chunk (achunk); - } else { - chunk = achunk; - chunk->next = NULL; - chunk->len = 0; - } - } - m_incoming = chunk; + g_assert(!m_incoming_queue.empty()); - /* Compute the number of unicode characters we got. */ - wbuf = &g_array_index(unichars, gunichar, 0); - wcount = unichars->len; +#ifdef WITH_ICONV + /* If we're using a legacy encoding for I/O, we need to + * convert the input to UTF-8 now. + */ + if (G_UNLIKELY(!m_using_utf8)) + convert_incoming(); +#endif - /* Try initial substrings. */ - start = 0; - modified = leftovers = again = FALSE; + modified = FALSE; invalidated_text = FALSE; bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT; bbox_topleft.x = bbox_topleft.y = G_MAXINT; - while (start < wcount && !leftovers) { - const gunichar *next; - vte::parser::Params params{nullptr}; - - /* Try to match any control sequences. */ - sequence_handler_t handler = nullptr; - auto match_result = _vte_matcher_match(m_matcher, - &wbuf[start], - wcount - start, - &handler, - &next, - ¶ms.m_values); - switch (match_result) { - /* We're in one of three possible situations now. - * First, the match returned a handler, and next - * points to the first character which isn't part of this - * sequence. */ - case VTE_MATCHER_RESULT_MATCH: { - _VTE_DEBUG_IF(VTE_DEBUG_PARSE) - params.print(); - - /* Call the sequence handler */ - (this->*handler)(params); - - m_last_graphic_character = 0; - - /* Skip over the proper number of unicode chars. */ - start = (next - wbuf); - modified = TRUE; - - // FIXME m_screen may be != previous_screen, check for that! - - gboolean new_in_scroll_region = m_scrolling_restricted - && (m_screen->cursor.row >= (m_screen->insert_delta + m_scrolling_region.start)) - && (m_screen->cursor.row <= (m_screen->insert_delta + m_scrolling_region.end)); - - /* delta may have changed from sequence. */ - top_row = first_displayed_row(); - bottom_row = last_displayed_row(); + vte::parser::Sequence seq{m_parser}; - /* if we have moved greatly during the sequence handler, or moved - * into a scroll_region from outside it, restart the bbox. - */ - if (invalidated_text && - ((new_in_scroll_region && !in_scroll_region) || - (m_screen->cursor.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK || - m_screen->cursor.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK || - m_screen->cursor.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK || - m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) { - /* Clip off any part of the box which isn't already on-screen. */ - bbox_topleft.x = MAX(bbox_topleft.x, 0); - bbox_topleft.y = MAX(bbox_topleft.y, top_row); - bbox_bottomright.x = MIN(bbox_bottomright.x, - m_column_count); - /* lazily apply the +1 to the cursor_row */ - bbox_bottomright.y = MIN(bbox_bottomright.y + 1, - bottom_row + 1); + m_line_wrapped = false; - invalidate_cells( - bbox_topleft.x, - bbox_bottomright.x - bbox_topleft.x, - bbox_topleft.y, - bbox_bottomright.y - bbox_topleft.y); + size_t bytes_processed = 0; - invalidated_text = FALSE; - bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT; - bbox_topleft.x = bbox_topleft.y = G_MAXINT; - } + while (!m_incoming_queue.empty()) { + auto chunk = std::move(m_incoming_queue.front()); + m_incoming_queue.pop(); - in_scroll_region = new_in_scroll_region; + g_assert_nonnull(chunk.get()); - break; - } - /* Second, we have no match, and next points to the very - * next character in the buffer. Insert the character which - * we're currently examining into the screen. */ - case VTE_MATCHER_RESULT_NO_MATCH: { - c = wbuf[start]; - /* If it's a control character, permute the order, per - * vttest. */ - if ((c != *next) && - ((*next & 0x1f) == *next) && - //FIXMEchpe what about C1 controls - (start + 1 < next - wbuf)) { - const gunichar *tnext = NULL; - gunichar ctrl; - int i; - /* We don't want to permute it if it's another - * control sequence, so check if it is. */ - sequence_handler_t thandler; - _vte_matcher_match(m_matcher, - next, - wcount - (next - wbuf), - &thandler, - &tnext, - NULL); - /* We only do this for non-control-sequence - * characters and random garbage. */ - if (tnext == next + 1) { - /* Save the control character. */ - ctrl = *next; - /* Move everything before it up a - * slot. */ - // FIXMEchpe memmove! - for (i = next - wbuf; i > start; i--) { - wbuf[i] = wbuf[i - 1]; - } - /* Move the control character to the - * front. */ - wbuf[i] = ctrl; - goto next_match; - } - } - _VTE_DEBUG_IF(VTE_DEBUG_PARSE) { - if (c > 255) { - g_printerr("U+%04lx\n", (long) c); - } else { - if (c > 127) { - g_printerr("%ld = ", - (long) c); - } - if (c < 32) { - g_printerr("^%c\n", c + 64); - } else { - g_printerr("`%c'\n", c); - } - } - } + _VTE_DEBUG_IF(VTE_DEBUG_IO) { + _vte_debug_hexdump("Incoming buffer", chunk->data, chunk->len); + } - bbox_topleft.x = MIN(bbox_topleft.x, - m_screen->cursor.col); - bbox_topleft.y = MIN(bbox_topleft.y, - m_screen->cursor.row); - - /* Insert the character. */ - // FIXMEchpe should not use UNLIKELY here - if (G_UNLIKELY(insert_char(c, false, false))) { - /* line wrapped, correct bbox */ - if (invalidated_text && - (m_screen->cursor.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK || - m_screen->cursor.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK || - m_screen->cursor.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK || - m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) { - /* Clip off any part of the box which isn't already on-screen. */ - bbox_topleft.x = MAX(bbox_topleft.x, 0); - bbox_topleft.y = MAX(bbox_topleft.y, top_row); - bbox_bottomright.x = MIN(bbox_bottomright.x, - m_column_count); - /* lazily apply the +1 to the cursor_row */ - bbox_bottomright.y = MIN(bbox_bottomright.y + 1, - bottom_row + 1); - - invalidate_cells( - bbox_topleft.x, - bbox_bottomright.x - bbox_topleft.x, - bbox_topleft.y, - bbox_bottomright.y - bbox_topleft.y); - bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT; - bbox_topleft.x = bbox_topleft.y = G_MAXINT; + bytes_processed += chunk->len; - } - bbox_topleft.x = MIN(bbox_topleft.x, 0); - bbox_topleft.y = MIN(bbox_topleft.y, - m_screen->cursor.row); - } - /* Add the cells over which we have moved to the region - * which we need to refresh for the user. */ - bbox_bottomright.x = MAX(bbox_bottomright.x, - m_screen->cursor.col); - /* cursor.row + 1 (defer until inv.) */ - bbox_bottomright.y = MAX(bbox_bottomright.y, - m_screen->cursor.row); - invalidated_text = TRUE; - - /* We *don't* emit flush pending signals here. */ - modified = TRUE; - start++; + auto const* ip = chunk->data; + auto const* iend = chunk->data + chunk->len; - break; - } - case VTE_MATCHER_RESULT_PARTIAL: { - /* Case three: the read broke in the middle of a - * control sequence, so we're undecided with no more - * data to consult. If we have data following the - * middle of the sequence, then it's just garbage data, - * and for compatibility, we should discard it. */ - if (wbuf + wcount > next) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Invalid control " - "sequence, discarding %ld " - "characters.\n", - (long)(next - (wbuf + start))); - /* Discard. */ - start = next - wbuf + 1; - } else { - /* Pause processing here and wait for more - * data before continuing. */ - leftovers = TRUE; - } + for ( ; ip < iend; ++ip) { - break; - } + switch (m_utf8_decoder.decode(*ip)) { + case vte::base::UTF8Decoder::REJECT: + m_utf8_decoder.reset(); + + /* If a start byte occurred in the middle of a sequence, + * rewind the stream so we try to start a new character + * with it. + * Note that this will never lead to a loop, since in the + * next round this byte *will* be consumed. + */ + if (m_utf8_decoder.is_start_byte(*ip)) + --ip; + + /* Fall through to insert the U+FFFD replacement character. */ + /* [[fallthrough]]; */ + case vte::base::UTF8Decoder::ACCEPT: { + auto rv = m_parser.feed(m_utf8_decoder.codepoint()); + if (G_UNLIKELY(rv < 0)) { + uint32_t c = m_utf8_decoder.codepoint(); + char c_buf[7]; + g_snprintf(c_buf, sizeof(c_buf), "%lc", c); + char const* wp_str = g_unichar_isprint(c) ? c_buf : _vte_debug_sequence_to_string(c_buf, -1); + _vte_debug_print(VTE_DEBUG_PARSER, "Parser error on U+%04X [%s]!\n", + c, wp_str); + break; + } + + if (rv != VTE_SEQ_NONE) + g_assert((bool)seq); + + _VTE_DEBUG_IF(VTE_DEBUG_PARSER) { + if (rv != VTE_SEQ_NONE) { + seq.print(); + } + } + + // FIXMEchpe this assumes that the only handler inserting + // a character is GRAPHIC, which isn't true (at least ICH, REP, SUB + // also do, and invalidate directly for now)... + + switch (rv) { + case VTE_SEQ_GRAPHIC: { + + bbox_topleft.x = MIN(bbox_topleft.x, + m_screen->cursor.col); + bbox_topleft.y = MIN(bbox_topleft.y, + m_screen->cursor.row); + + // does insert_char(c, false, false) + GRAPHIC(seq); + _vte_debug_print(VTE_DEBUG_PARSER, + "Last graphic is now U+%04X %lc\n", + m_last_graphic_character, + g_unichar_isprint(m_last_graphic_character) ? m_last_graphic_character : 0xfffd); + + if (m_line_wrapped) { + m_line_wrapped = false; + /* line wrapped, correct bbox */ + if (invalidated_text && + (m_screen->cursor.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK || + m_screen->cursor.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK || + m_screen->cursor.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK || + m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) { + /* Clip off any part of the box which isn't already on-screen. */ + bbox_topleft.x = MAX(bbox_topleft.x, 0); + bbox_topleft.y = MAX(bbox_topleft.y, top_row); + bbox_bottomright.x = MIN(bbox_bottomright.x, + m_column_count); + /* lazily apply the +1 to the cursor_row */ + bbox_bottomright.y = MIN(bbox_bottomright.y + 1, + bottom_row + 1); + + invalidate_cells( + bbox_topleft.x, + bbox_bottomright.x - bbox_topleft.x, + bbox_topleft.y, + bbox_bottomright.y - bbox_topleft.y); + bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT; + bbox_topleft.x = bbox_topleft.y = G_MAXINT; + + } + bbox_topleft.x = MIN(bbox_topleft.x, 0); + bbox_topleft.y = MIN(bbox_topleft.y, + m_screen->cursor.row); + } + /* Add the cells over which we have moved to the region + * which we need to refresh for the user. */ + bbox_bottomright.x = MAX(bbox_bottomright.x, + m_screen->cursor.col); + /* cursor.row + 1 (defer until inv.) */ + bbox_bottomright.y = MAX(bbox_bottomright.y, + m_screen->cursor.row); + invalidated_text = TRUE; + + /* We *don't* emit flush pending signals here. */ + modified = TRUE; + + break; + } + + case VTE_SEQ_NONE: + case VTE_SEQ_IGNORE: + break; + + default: { + switch (seq.command()) { +#define _VTE_CMD(cmd) case VTE_CMD_##cmd: cmd(seq); break; +#define _VTE_NOP(cmd) +#include "parser-cmd.hh" +#undef _VTE_CMD +#undef _VTE_NOP + default: + _vte_debug_print(VTE_DEBUG_PARSER, + "Unknown parser command %d\n", seq.command()); + break; + } + + m_last_graphic_character = 0; + + modified = TRUE; + + // FIXME m_screen may be != previous_screen, check for that! + + gboolean new_in_scroll_region = m_scrolling_restricted + && (m_screen->cursor.row >= (m_screen->insert_delta + m_scrolling_region.start)) + && (m_screen->cursor.row <= (m_screen->insert_delta + m_scrolling_region.end)); + + /* delta may have changed from sequence. */ + top_row = first_displayed_row(); + bottom_row = last_displayed_row(); + + /* if we have moved greatly during the sequence handler, or moved + * into a scroll_region from outside it, restart the bbox. + */ + if (invalidated_text && + ((new_in_scroll_region && !in_scroll_region) || + (m_screen->cursor.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK || + m_screen->cursor.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK || + m_screen->cursor.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK || + m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) { + /* Clip off any part of the box which isn't already on-screen. */ + bbox_topleft.x = MAX(bbox_topleft.x, 0); + bbox_topleft.y = MAX(bbox_topleft.y, top_row); + bbox_bottomright.x = MIN(bbox_bottomright.x, + m_column_count); + /* lazily apply the +1 to the cursor_row */ + bbox_bottomright.y = MIN(bbox_bottomright.y + 1, + bottom_row + 1); + + invalidate_cells( + bbox_topleft.x, + bbox_bottomright.x - bbox_topleft.x, + bbox_topleft.y, + bbox_bottomright.y - bbox_topleft.y); + + invalidated_text = FALSE; + bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT; + bbox_topleft.x = bbox_topleft.y = G_MAXINT; + } + + in_scroll_region = new_in_scroll_region; + + break; + } + } + break; + } + } } + } #ifdef VTE_DEBUG /* Some safety checks: ensure the visible parts of the buffer @@ -3816,21 +3768,6 @@ g_assert_cmpint(m_screen->cursor.row, >=, m_screen->insert_delta); #endif -next_match: - /* Free any parameters we don't care about any more. */ - params.recycle(m_matcher); - } - - /* Remove most of the processed characters. */ - if (start < wcount) { - g_array_remove_range(m_pending, 0, start); - } else { - g_array_set_size(m_pending, 0); - /* If we're out of data, we needn't pause to let the - * controlling application respond to incoming data, because - * the main loop is already going to do that. */ - } - if (modified) { /* Keep the cursor on-screen if we scroll on output, or if * we're currently at the bottom of the buffer. */ @@ -3888,7 +3825,7 @@ check_cursor_blink(); /* Signal that the cursor moved. */ queue_cursor_moved(); - } else if ((saved_cursor_visible != m_cursor_visible) || + } else if ((saved_cursor_visible != m_modes_private.DEC_TEXT_CURSOR()) || (saved_cursor_style != m_cursor_style)) { invalidate_cell(saved_cursor.col, saved_cursor.row); check_cursor_blink(); @@ -3898,32 +3835,17 @@ im_update_cursor(); /* After processing some data, do a hyperlink GC. The multiplier is totally arbitrary, feel free to fine tune. */ - _vte_ring_hyperlink_maybe_gc(m_screen->row_data, wcount * 4); + _vte_ring_hyperlink_maybe_gc(m_screen->row_data, bytes_processed * 8); _vte_debug_print (VTE_DEBUG_WORK, ")"); _vte_debug_print (VTE_DEBUG_IO, - "%ld chars and %ld bytes in %" G_GSIZE_FORMAT " chunks left to process.\n", - (long) unichars->len, - (long) _vte_incoming_chunks_length(m_incoming), - _vte_incoming_chunks_count(m_incoming)); -} - -void -VteTerminalPrivate::feed_chunks(struct _vte_incoming_chunk *chunks) -{ - struct _vte_incoming_chunk *last; - - _vte_debug_print(VTE_DEBUG_IO, "Feed %" G_GSIZE_FORMAT " bytes, in %" G_GSIZE_FORMAT " chunks.\n", - _vte_incoming_chunks_length(chunks), - _vte_incoming_chunks_count(chunks)); - - for (last = chunks; last->next != NULL; last = last->next) ; - last->next = m_incoming; - m_incoming = chunks; + "%" G_GSIZE_FORMAT " bytes in %" G_GSIZE_FORMAT " chunks left to process.\n", + m_input_bytes, + m_incoming_queue.size()); } bool -VteTerminalPrivate::pty_io_read(GIOChannel *channel, +Terminal::pty_io_read(GIOChannel *channel, GIOCondition condition) { int err = 0; @@ -3936,7 +3858,6 @@ /* Read some data in from this channel. */ if (condition & (G_IO_IN | G_IO_PRI)) { - struct _vte_incoming_chunk *chunk, *chunks = NULL; const int fd = g_io_channel_unix_get_fd (channel); guchar *bp; int rem, len; @@ -3959,14 +3880,21 @@ } bytes = m_input_bytes; - chunk = m_incoming; + vte::base::Chunk* chunk = nullptr; + /* If possible, try adding more data to the chunk at the back of the queue */ + if (!m_incoming_queue.empty()) + chunk = m_incoming_queue.back().get(); + do { - if (!chunk || chunk->len >= 3*sizeof (chunk->data)/4) { - chunk = get_chunk (); - chunk->next = chunks; - chunks = chunk; + /* No chunk, or chunk at least ¾ full? Get a new chunk */ + if (!chunk || + chunk->len >= 3 * chunk->capacity() / 4) { + m_incoming_queue.push(std::move(vte::base::Chunk::get())); + + chunk = m_incoming_queue.back().get(); } - rem = sizeof (chunk->data) - chunk->len; + + rem = chunk->remaining_capacity(); bp = chunk->data + chunk->len; len = 0; do { @@ -4019,15 +3947,12 @@ chunk->len += len; bytes += len; } while (bytes < max_bytes && - chunk->len == sizeof (chunk->data)); - if (chunk->len == 0 && chunk == chunks) { - chunks = chunks->next; - release_chunk (chunk); - } + chunk->len == chunk->capacity()); + + /* We may have an empty chunk at the back of the queue, but + * that doesn't matter, we'll fill it next time. + */ - if (chunks != NULL) { - feed_chunks(chunks); - } if (!is_processing()) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gdk_threads_enter (); @@ -4090,7 +4015,7 @@ } /* - * VteTerminalPrivate::feed: + * Terminal::feed: * @data: (array length=length) (element-type guint8): a string in the terminal's current encoding * @length: the length of the string, or -1 to use the full length or a nul-terminated string * @@ -4099,47 +4024,55 @@ * to mess with your users. */ void -VteTerminalPrivate::feed(char const* data, - gssize length, +Terminal::feed(char const* data, + gssize length_, bool start_processing_) { - g_assert(length == 0 || data != nullptr); + g_assert(length_ == 0 || data != nullptr); - if (length == -1) + size_t length; + if (length_ == -1) length = strlen(data); + else + length = size_t(length_); - /* If we have data, modify the incoming buffer. */ - if (length > 0) { - struct _vte_incoming_chunk *chunk; - if (m_incoming && - (gsize)length < sizeof (m_incoming->data) - m_incoming->len) { - chunk = m_incoming; - } else { - chunk = get_chunk (); - feed_chunks(chunk); - } - do { /* break the incoming data into chunks */ - gsize rem = sizeof (chunk->data) - chunk->len; - gsize len = (gsize) length < rem ? (gsize) length : rem; - memcpy (chunk->data + chunk->len, data, len); - chunk->len += len; - length -= len; - if (length == 0) { - break; - } - data += len; + if (length == 0) + return; - chunk = get_chunk (); - feed_chunks(chunk); - } while (1); + vte::base::Chunk* chunk = nullptr; + if (!m_incoming_queue.empty()) { + auto& achunk = m_incoming_queue.back(); + if (length < achunk->remaining_capacity()) + chunk = achunk.get(); + } + if (chunk == nullptr) { + m_incoming_queue.push(std::move(vte::base::Chunk::get())); + chunk = m_incoming_queue.back().get(); + } + + /* Break the incoming data into chunks. */ + do { + auto rem = chunk->remaining_capacity(); + auto len = std::min(length, rem); + memcpy (chunk->data + chunk->len, data, len); + chunk->len += len; + length -= len; + if (length == 0) + break; - if (start_processing_) - start_processing(); - } + data += len; + + /* Get another chunk for the remaining data */ + m_incoming_queue.push(std::move(vte::base::Chunk::get())); + chunk = m_incoming_queue.back().get(); + } while (true); + + if (start_processing_) + start_processing(); } bool -VteTerminalPrivate::pty_io_write(GIOChannel *channel, +Terminal::pty_io_write(GIOChannel *channel, GIOCondition condition) { gssize count; @@ -4152,15 +4085,9 @@ _vte_byte_array_length(m_outgoing)); if (count != -1) { _VTE_DEBUG_IF (VTE_DEBUG_IO) { - gssize i; - for (i = 0; i < count; i++) { - g_printerr("Wrote %c%c\n", - ((guint8)m_outgoing->data[i]) >= 32 ? - ' ' : '^', - ((guint8)m_outgoing->data[i]) >= 32 ? - m_outgoing->data[i] : - ((guint8)m_outgoing->data[i]) + 64); - } + _vte_debug_hexdump("Outgoing buffer written", + (uint8_t const*)m_outgoing->data, + count); } _vte_byte_array_consume(m_outgoing, count); } @@ -4176,116 +4103,98 @@ /* Convert some UTF-8 data to send to the child. */ void -VteTerminalPrivate::send_child(char const* data, +Terminal::send_child(char const* data, gssize length, - bool local_echo, - bool newline_stuff) + bool local_echo) noexcept { - gsize icount, ocount; - const guchar *ibuf; - guchar *obuf, *obufptr; gchar *cooked; - VteConv conv; - long crcount, cooked_length, i; + long cooked_length, i; if (!m_input_enabled) return; - conv = m_outgoing_conv; - if (conv == VTE_INVALID_CONV) - return; + if (length == -1) + length = strlen(data); - icount = length; - ibuf = (const guchar *)data; - ocount = ((length + 1) * VTE_UTF8_BPC) + 1; - _vte_byte_array_set_minimum_size(m_conv_buffer, ocount); - obuf = obufptr = m_conv_buffer->data; - - if (_vte_conv(conv, &ibuf, &icount, &obuf, &ocount) == (gsize)-1) { - g_warning(_("Error (%s) converting data for child, dropping."), - g_strerror(errno)); - } else { - crcount = 0; - if (newline_stuff) { - for (i = 0; i < obuf - obufptr; i++) { - switch (obufptr[i]) { - case '\015': - crcount++; - break; - default: - break; - } - } - } - if (crcount > 0) { - cooked = (char *)g_malloc(obuf - obufptr + crcount); - cooked_length = 0; - for (i = 0; i < obuf - obufptr; i++) { - switch (obufptr[i]) { - case '\015': - cooked[cooked_length++] = '\015'; - cooked[cooked_length++] = '\012'; - break; - default: - cooked[cooked_length++] = obufptr[i]; - break; - } - } - } else { - cooked = (gchar *)obufptr; - cooked_length = obuf - obufptr; - } - /* Tell observers that we're sending this to the child. */ - if (cooked_length > 0) { - emit_commit(cooked, cooked_length); - } - /* Echo the text if we've been asked to do so. */ - if ((cooked_length > 0) && local_echo) { - gunichar *ucs4; - ucs4 = g_utf8_to_ucs4(cooked, cooked_length, - NULL, NULL, NULL); - if (ucs4 != NULL) { - int len; - len = g_utf8_strlen(cooked, cooked_length); - for (i = 0; i < len; i++) { - insert_char( - ucs4[i], - false, - true); - } - g_free(ucs4); - } - } - /* If there's a place for it to go, add the data to the - * outgoing buffer. */ - if ((cooked_length > 0) && (m_pty != NULL)) { - _vte_byte_array_append(m_outgoing, - cooked, cooked_length); - _VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) { - for (i = 0; i < cooked_length; i++) { - if ((((guint8) cooked[i]) < 32) || - (((guint8) cooked[i]) > 127)) { - g_printerr( - "Sending <%02x> " - "to child.\n", - cooked[i]); - } else { - g_printerr( - "Sending '%c' " - "to child.\n", - cooked[i]); - } - } - } - /* If we need to start waiting for the child pty to - * become available for writing, set that up here. */ - connect_pty_write(); - } - if (crcount > 0) { - g_free(cooked); - } +#ifdef WITH_ICONV + if (m_using_utf8) { +#endif /* WITH_ICONV */ + cooked = (char*)data; + cooked_length = length; +#ifdef WITH_ICONV + } else { + if (m_outgoing_conv == ((GIConv)-1)) + return; + + gsize icount; + icount = length; + auto ibuf = (char*)data; + gsize ocount = ((length + 1) * VTE_UTF8_BPC) + 1; + _vte_byte_array_set_minimum_size(m_conv_buffer, ocount); + char *obuf, *obufptr; + obuf = obufptr = (char*)m_conv_buffer->data; + + if (_vte_conv(m_outgoing_conv, &ibuf, &icount, &obuf, &ocount) == (gsize)-1) { + int errsv = errno; + g_warning(_("Error (%s) converting data for child, dropping."), + g_strerror(errsv)); + return; + } + + cooked = (gchar *)obufptr; + cooked_length = obuf - obufptr; + } +#endif /* WITH_ICONV */ + + /* Tell observers that we're sending this to the child. */ + if (cooked_length > 0) { + emit_commit(cooked, cooked_length); + } + /* Echo the text if we've been asked to do so. */ + if ((cooked_length > 0) && local_echo) { + gunichar *ucs4; + // FIXMEchpe: if (!m_using_utf8), then cooked is NOT UTF-8 !!! + // So I think this should use (data, length) not (cooked, cooked_length) + ucs4 = g_utf8_to_ucs4(cooked, cooked_length, + NULL, NULL, NULL); + if (ucs4 != NULL) { + int len; + len = g_utf8_strlen(cooked, cooked_length); + for (i = 0; i < len; i++) { + insert_char( + ucs4[i], + false, + true); + } + g_free(ucs4); + } + } + + /* If there's a place for it to go, add the data to the + * outgoing buffer. */ + // FIXMEchpe: shouldn't require m_pty for this + if ((cooked_length > 0) && (m_pty != NULL)) { + _vte_byte_array_append(m_outgoing, cooked, cooked_length); + _VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) { + for (i = 0; i < cooked_length; i++) { + if ((((guint8) cooked[i]) < 32) || + (((guint8) cooked[i]) > 127)) { + g_printerr( + "Sending <%02x> " + "to child.\n", + cooked[i]); + } else { + g_printerr( + "Sending '%c' " + "to child.\n", + cooked[i]); + } + } + } + /* If we need to start waiting for the child pty to + * become available for writing, set that up here. */ + connect_pty_write(); } - return; } /* @@ -4297,7 +4206,7 @@ * at the keyboard. */ void -VteTerminalPrivate::feed_child(char const *text, +Terminal::feed_child(char const *text, gssize length) { g_assert(length == 0 || text != nullptr); @@ -4309,19 +4218,19 @@ length = strlen(text); if (length > 0) { - send_child(text, length, false, false); + send_child(text, length, false); } } /* - * VteTerminalPrivate::feed_child_binary: + * Terminal::feed_child_binary: * @data: data to send to the child * @length: length of @data * * Sends a block of binary data to the child. */ void -VteTerminalPrivate::feed_child_binary(guint8 const* data, +Terminal::feed_child_binary(guint8 const* data, gsize length) { g_assert(length == 0 || data != nullptr); @@ -4346,105 +4255,144 @@ } void -VteTerminalPrivate::feed_child_using_modes(char const* data, +Terminal::feed_child_using_modes(char const* data, gssize length) { if (length == -1) length = strlen(data); if (length > 0) - send_child(data, length, - !m_sendrecv_mode, - m_linefeed_mode); + send_child(data, length, !m_modes_ecma.SRM()); } -/* Send text from the input method to the child. */ -static void -vte_terminal_im_commit_cb(GtkIMContext *im_context, - char const* text, - VteTerminalPrivate *that) +void +Terminal::send(vte::parser::u8SequenceBuilder const& builder, + bool c1, + vte::parser::u8SequenceBuilder::Introducer introducer, + vte::parser::u8SequenceBuilder::ST st) noexcept { - that->im_commit(text); + std::string str; + builder.to_string(str, c1, -1, introducer, st); + feed_child(str.data(), str.size()); } void -VteTerminalPrivate::im_commit(char const* text) +Terminal::send(vte::parser::Sequence const& seq, + vte::parser::u8SequenceBuilder const& builder) noexcept { - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method committed `%s'.\n", text); - feed_child_using_modes(text, -1); - /* Committed text was committed because the user pressed a key, so - * we need to obey the scroll-on-keystroke setting. */ - if (m_scroll_on_keystroke) { - maybe_scroll_to_bottom(); - } + // FIXMEchpe take c1 & ST from @seq + send(builder, false); } -/* We've started pre-editing. */ -static void -vte_terminal_im_preedit_start_cb(GtkIMContext *im_context, - VteTerminalPrivate *that) +void +Terminal::send(unsigned int type, + std::initializer_list params) noexcept { - that->im_preedit_start(); + // FIXMEchpe take c1 & ST from @seq + send(vte::parser::ReplyBuilder{type, params}, false); } void -VteTerminalPrivate::im_preedit_start() +Terminal::reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params) noexcept { - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method pre-edit started.\n"); - m_im_preedit_active = true; + send(seq, vte::parser::ReplyBuilder{type, params}); } -/* We've stopped pre-editing. */ -static void -vte_terminal_im_preedit_end_cb(GtkIMContext *im_context, - VteTerminalPrivate *that) +#if 0 +void +Terminal::reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + std::string const& str) noexcept +{ + vte::parser::ReplyBuilder reply_builder{type, params}; + reply_builder.set_string(str); + send(seq, reply_builder); +} +#endif + +void +Terminal::reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + vte::parser::ReplyBuilder const& builder) noexcept { - that->im_preedit_end(); + std::string str; + builder.to_string(str, true, -1, + vte::parser::ReplyBuilder::Introducer::NONE, + vte::parser::ReplyBuilder::ST::NONE); + + vte::parser::ReplyBuilder reply_builder{type, params}; + reply_builder.set_string(std::move(str)); + send(seq, reply_builder); } void -VteTerminalPrivate::im_preedit_end() +Terminal::reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + char const* format, + ...) noexcept { - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method pre-edit ended.\n"); - m_im_preedit_active = false; + char buf[128]; + va_list vargs; + va_start(vargs, format); + auto len = g_vsnprintf(buf, sizeof(buf), format, vargs); + va_end(vargs); + g_assert_cmpint(len, <, sizeof(buf)); + + vte::parser::ReplyBuilder builder{type, params}; + builder.set_string(std::string{buf}); + + send(seq, builder); } -/* The pre-edit string changed. */ -static void -vte_terminal_im_preedit_changed_cb(GtkIMContext *im_context, - VteTerminalPrivate *that) +void +Terminal::im_commit(char const* text) { - that->im_preedit_changed(); + _vte_debug_print(VTE_DEBUG_EVENTS, + "Input method committed `%s'.\n", text); + feed_child_using_modes(text, -1); + /* Committed text was committed because the user pressed a key, so + * we need to obey the scroll-on-keystroke setting. */ + if (m_scroll_on_keystroke) { + maybe_scroll_to_bottom(); + } } void -VteTerminalPrivate::im_preedit_changed() +Terminal::im_preedit_set_active(bool active) noexcept { - gchar *str; - PangoAttrList *attrs; - gint cursorpos; + m_im_preedit_active = active; +} - gtk_im_context_get_preedit_string(m_im_context, &str, &attrs, &cursorpos); - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method pre-edit changed (%s,%d).\n", - str, cursorpos); +void +Terminal::im_preedit_reset() noexcept +{ + m_im_preedit.clear(); + m_im_preedit.shrink_to_fit(); + m_im_preedit_cursor = 0; + if (m_im_preedit_attrs != nullptr) { + pango_attr_list_unref(m_im_preedit_attrs); + m_im_preedit_attrs = nullptr; + } +} +void +Terminal::im_preedit_changed(char const* str, + int cursorpos, + PangoAttrList* attrs) noexcept +{ /* Queue the area where the current preedit string is being displayed * for repainting. */ invalidate_cursor_once(); - g_free(m_im_preedit); + im_preedit_reset(); m_im_preedit = str; - - if (m_im_preedit_attrs != NULL) { - pango_attr_list_unref(m_im_preedit_attrs); - } - m_im_preedit_attrs = attrs; - - m_im_preedit_cursor = cursorpos; + m_im_preedit_attrs = attrs; + m_im_preedit_cursor = cursorpos; /* Invalidate again with the new cursor position */ invalidate_cursor_once(); @@ -4453,44 +4401,23 @@ im_update_cursor(); } -static gboolean -vte_terminal_im_retrieve_surrounding_cb(GtkIMContext *im_context, - VteTerminalPrivate *that) -{ - return that->im_retrieve_surrounding(); -} - bool -VteTerminalPrivate::im_retrieve_surrounding() +Terminal::im_retrieve_surrounding() { /* FIXME: implement this! Bug #726191 */ - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method retrieve-surrounding.\n"); return false; } -static gboolean -vte_terminal_im_delete_surrounding_cb(GtkIMContext *im_context, - int offset, - int n_chars, - VteTerminalPrivate *that) -{ - return that->im_delete_surrounding(offset, n_chars); -} - bool -VteTerminalPrivate::im_delete_surrounding(int offset, - int n_chars) +Terminal::im_delete_surrounding(int offset, + int n_chars) { /* FIXME: implement this! Bug #726191 */ - _vte_debug_print(VTE_DEBUG_EVENTS, - "Input method delete-surrounding offset %d n-chars %d.\n", - offset, n_chars); return false; } void -VteTerminalPrivate::im_update_cursor() +Terminal::im_update_cursor() { if (!widget_realized()) return; @@ -4501,11 +4428,11 @@ rect.width = m_cell_width; // FIXMEchpe: if columns > 1 ? rect.y = row_to_pixel(m_screen->cursor.row) + m_padding.top; rect.height = m_cell_height; - gtk_im_context_set_cursor_location(m_im_context, &rect); + m_real_widget->im_set_cursor_location(&rect); } void -VteTerminalPrivate::widget_style_updated() +Terminal::widget_style_updated() { set_font_desc(m_unscaled_font_desc); @@ -4540,7 +4467,7 @@ } void -VteTerminalPrivate::add_cursor_timeout() +Terminal::add_cursor_timeout() { if (m_cursor_blink_tag) return; /* already added */ @@ -4554,7 +4481,7 @@ } void -VteTerminalPrivate::remove_cursor_timeout() +Terminal::remove_cursor_timeout() { if (m_cursor_blink_tag == 0) return; /* already removed */ @@ -4569,18 +4496,18 @@ /* Activates / disactivates the cursor blink timer to reduce wakeups */ void -VteTerminalPrivate::check_cursor_blink() +Terminal::check_cursor_blink() { if (m_has_focus && m_cursor_blinks && - m_cursor_visible) + m_modes_private.DEC_TEXT_CURSOR()) add_cursor_timeout(); else remove_cursor_timeout(); } void -VteTerminalPrivate::remove_text_blink_timeout() +Terminal::remove_text_blink_timeout() { if (m_text_blink_tag == 0) return; @@ -4590,16 +4517,14 @@ } void -VteTerminalPrivate::beep() +Terminal::beep() { - if (m_audible_bell) { - GdkWindow *window = gtk_widget_get_window(m_widget); - gdk_window_beep(window); - } + if (m_audible_bell) + m_real_widget->beep(); } guint -VteTerminalPrivate::translate_ctrlkey(GdkEventKey *event) +Terminal::translate_ctrlkey(GdkEventKey *event) { guint keyval; GdkKeymap *keymap; @@ -4631,7 +4556,7 @@ } void -VteTerminalPrivate::read_modifiers(GdkEvent *event) +Terminal::read_modifiers(GdkEvent *event) { GdkKeymap *keymap; GdkModifierType mods; @@ -4656,7 +4581,7 @@ } bool -VteTerminalPrivate::widget_key_press(GdkEventKey *event) +Terminal::widget_key_press(GdkEventKey *event) { char *normal = NULL; gssize normal_length = 0; @@ -4784,7 +4709,7 @@ /* Let the input method at this one first. */ if (!steal && m_input_enabled) { - if (m_im_context && gtk_im_context_filter_keypress(m_im_context, event)) { + if (m_real_widget->im_filter_keypress(event)) { _vte_debug_print(VTE_DEBUG_EVENTS, "Keypress taken by IM.\n"); return true; @@ -4989,8 +4914,8 @@ * it to a literal or capability name. */ if (handled == FALSE) { _vte_keymap_map(keyval, m_modifiers, - m_cursor_mode == VTE_KEYMODE_APPLICATION, - m_keypad_mode == VTE_KEYMODE_APPLICATION, + m_modes_private.DEC_APPLICATION_CURSOR_KEYS(), + m_modes_private.DEC_APPLICATION_KEYPAD(), &normal, &normal_length); /* If we found something this way, suppress @@ -5047,11 +4972,11 @@ if (add_modifiers) { _vte_keymap_key_add_key_modifiers(keyval, m_modifiers, - m_cursor_mode == VTE_KEYMODE_APPLICATION, + m_modes_private.DEC_APPLICATION_CURSOR_KEYS(), &normal, &normal_length); } - if (m_meta_sends_escape && + if (m_modes_private.XTERM_META_SENDS_ESCAPE() && !suppress_meta_esc && (normal_length > 0) && (m_modifiers & VTE_META_MASK)) { @@ -5073,13 +4998,12 @@ } bool -VteTerminalPrivate::widget_key_release(GdkEventKey *event) +Terminal::widget_key_release(GdkEventKey *event) { read_modifiers((GdkEvent*)event); if (m_input_enabled && - m_im_context && - gtk_im_context_filter_keypress(m_im_context, event)) + m_real_widget->im_filter_keypress(event)) return true; return false; @@ -5089,8 +5013,8 @@ compare_unichar_p(const void *u1p, const void *u2p) { - const gunichar u1 = *(gunichar*)u1p; - const gunichar u2 = *(gunichar*)u2p; + const char32_t u1 = *(char32_t*)u1p; + const char32_t u2 = *(char32_t*)u2p; return u1 < u2 ? -1 : u1 > u2 ? 1 : 0; } @@ -5128,7 +5052,7 @@ }; /* - * VteTerminalPrivate::is_word_char: + * Terminal::is_word_char: * @c: a candidate Unicode code point * * Checks if a particular character is considered to be part of a word or not. @@ -5136,7 +5060,7 @@ * Returns: %TRUE if the character is considered to be part of a word */ bool -VteTerminalPrivate::is_word_char(gunichar c) const +Terminal::is_word_char(gunichar c) const { const guint8 v = word_char_by_category[g_unichar_type(c)]; @@ -5145,16 +5069,16 @@ /* Do we have an exception? */ return bsearch(&c, - m_word_char_exceptions, - m_word_char_exceptions_len, - sizeof(gunichar), - compare_unichar_p) != NULL; + m_word_char_exceptions.data(), + m_word_char_exceptions.size(), + sizeof(std::u32string::value_type), + compare_unichar_p) != nullptr; } /* Check if the characters in the two given locations are in the same class * (word vs. non-word characters). */ bool -VteTerminalPrivate::is_same_class(vte::grid::column_t acol, +Terminal::is_same_class(vte::grid::column_t acol, vte::grid::row_t arow, vte::grid::column_t bcol, vte::grid::row_t brow) const @@ -5183,7 +5107,7 @@ /* Check if we soft-wrapped on the given line. */ // FIXMEchpe replace this with a method on VteRing bool -VteTerminalPrivate::line_is_wrappable(vte::grid::row_t row) const +Terminal::line_is_wrappable(vte::grid::row_t row) const { VteRowData const* rowdata = find_row_data(row); return rowdata && rowdata->attr.soft_wrapped; @@ -5251,7 +5175,7 @@ /* Check if a cell is selected or not. */ // FIXMEchpe: replace this by just using vte::grid::span for selection and then this simply becomes .contains() bool -VteTerminalPrivate::cell_is_selected(vte::grid::column_t col, +Terminal::cell_is_selected(vte::grid::column_t col, vte::grid::row_t row) const { /* If there's nothing selected, it's an easy question to answer. */ @@ -5277,7 +5201,7 @@ } void -VteTerminalPrivate::widget_paste_received(char const* text) +Terminal::widget_paste_received(char const* text) { gchar *paste, *p; gsize run; @@ -5335,17 +5259,20 @@ break; } } - if (m_bracketed_paste_mode) + + bool const bracketed_paste = m_modes_private.XTERM_READLINE_BRACKETED_PASTE(); + // FIXMEchpe can we not hardcode C0 controls here? + if (bracketed_paste) feed_child("\e[200~", -1); // FIXMEchpe add a way to avoid the extra string copy done here feed_child(paste, p - paste); - if (m_bracketed_paste_mode) + if (bracketed_paste) feed_child("\e[201~", -1); g_free(paste); } bool -VteTerminalPrivate::feed_mouse_event(vte::grid::coords const& rowcol /* confined */, +Terminal::feed_mouse_event(vte::grid::coords const& rowcol /* confined */, int button, bool is_drag, bool is_release) @@ -5386,7 +5313,7 @@ /* With the exception of the 1006 mode, button release is also encoded here. */ /* Note that if multiple extensions are enabled, the 1006 is used, so it's okay to check for only that. */ - if (is_release && !m_mouse_xterm_extension) { + if (is_release && !m_modes_private.XTERM_MOUSE_EXT_SGR()) { cb = 3; } @@ -5407,35 +5334,33 @@ } /* Check the extensions in decreasing order of preference. Encoding the release event above assumes that 1006 comes first. */ - if (m_mouse_xterm_extension) { + if (m_modes_private.XTERM_MOUSE_EXT_SGR()) { /* xterm's extended mode (1006) */ - len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "<%d;%ld;%ld%c", cb, cx, cy, is_release ? 'm' : 'M'); - } else if (m_mouse_urxvt_extension) { + send(is_release ? VTE_REPLY_XTERM_MOUSE_EXT_SGR_REPORT_BUTTON_RELEASE + : VTE_REPLY_XTERM_MOUSE_EXT_SGR_REPORT_BUTTON_PRESS, + {cb, (int)cx, (int)cy}); + } else if (m_modes_private.URXVT_MOUSE_EXT()) { /* urxvt's extended mode (1015) */ - len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "%d;%ld;%ldM", 32 + cb, cx, cy); + send(VTE_REPLY_URXVT_MOUSE_EXT_REPORT, {32 + cb, (int)cx, (int)cy}); } else if (cx <= 231 && cy <= 231) { /* legacy mode */ len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", 32 + cb, 32 + (guchar)cx, 32 + (guchar)cy); - } - /* Send event direct to the child, this is binary not text data */ - feed_child_binary((guint8*) buf, len); + /* Send event direct to the child, this is binary not text data */ + feed_child_binary((guint8*) buf, len); + } return true; } void -VteTerminalPrivate::feed_focus_event(bool in) +Terminal::feed_focus_event(bool in) { - char buf[8]; - gsize len; - - len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "%c", in ? 'I' : 'O'); - feed_child_binary((guint8 *)buf, len); + send(in ? VTE_REPLY_XTERM_FOCUS_IN : VTE_REPLY_XTERM_FOCUS_OUT, {}); } void -VteTerminalPrivate::feed_focus_event_initial() +Terminal::feed_focus_event_initial() { /* We immediately send the terminal a focus event, since otherwise * it has no way to know the current status. @@ -5444,14 +5369,14 @@ } void -VteTerminalPrivate::maybe_feed_focus_event(bool in) +Terminal::maybe_feed_focus_event(bool in) { - if (m_focus_tracking_mode) + if (m_modes_private.XTERM_FOCUS()) feed_focus_event(in); } /* - * VteTerminalPrivate::maybe_send_mouse_button: + * Terminal::maybe_send_mouse_button: * @terminal: * @event: * @@ -5461,7 +5386,7 @@ * Returns: %TRUE iff the event was consumed */ bool -VteTerminalPrivate::maybe_send_mouse_button(vte::grid::coords const& unconfined_rowcol, +Terminal::maybe_send_mouse_button(vte::grid::coords const& unconfined_rowcol, GdkEventType event_type, int event_button) { @@ -5490,7 +5415,7 @@ } /* - * VteTerminalPrivate::maybe_send_mouse_drag: + * Terminal::maybe_send_mouse_drag: * @terminal: * @event: * @@ -5500,7 +5425,7 @@ * Returns: %TRUE iff the event was consumed */ bool -VteTerminalPrivate::maybe_send_mouse_drag(vte::grid::coords const& unconfined_rowcol, +Terminal::maybe_send_mouse_drag(vte::grid::coords const& unconfined_rowcol, GdkEventType event_type) { auto rowcol = confine_grid_coords(unconfined_rowcol); @@ -5547,14 +5472,15 @@ } /* - * VteTerminalPrivate::hyperlink_invalidate_and_get_bbox + * Terminal::hyperlink_invalidate_and_get_bbox * * Invalidates cells belonging to the non-zero hyperlink idx, in order to * stop highlighting the previously hovered hyperlink or start highlighting * the new one. Optionally stores the coordinates of the bounding box. */ void -VteTerminalPrivate::hyperlink_invalidate_and_get_bbox(hyperlink_idx_t idx, GdkRectangle *bbox) +Terminal::hyperlink_invalidate_and_get_bbox(vte::base::Ring::hyperlink_idx_t idx, + GdkRectangle *bbox) { auto first_row = first_displayed_row(); auto end_row = last_displayed_row() + 1; @@ -5596,18 +5522,18 @@ } /* - * VteTerminalPrivate::hyperlink_hilite_update: + * Terminal::hyperlink_hilite_update: * * Checks the coordinates for hyperlink. Updates m_hyperlink_hover_idx * and m_hyperlink_hover_uri, and schedules to update the highlighting. */ void -VteTerminalPrivate::hyperlink_hilite_update() +Terminal::hyperlink_hilite_update() { const VteRowData *rowdata; bool do_check_hilite; vte::grid::coords rowcol; - hyperlink_idx_t new_hyperlink_hover_idx = 0; + vte::base::Ring::hyperlink_idx_t new_hyperlink_hover_idx = 0; GdkRectangle bbox; const char *separator; @@ -5679,14 +5605,15 @@ } /* - * VteTerminalPrivate::match_hilite_clear: + * Terminal::match_hilite_clear: * * Reset match variables and invalidate the old match region if highlighted. */ void -VteTerminalPrivate::match_hilite_clear() +Terminal::match_hilite_clear() { - invalidate_match_span(); + if (m_match != nullptr) + invalidate_match_span(); m_match_span.clear(); m_match_tag = -1; @@ -5698,7 +5625,7 @@ } void -VteTerminalPrivate::invalidate_match_span() +Terminal::invalidate_match_span() { _vte_debug_print(VTE_DEBUG_EVENTS, "Invalidating match span %s\n", m_match_span.to_string()); @@ -5706,14 +5633,14 @@ } /* - * VteTerminalPrivate::match_hilite_update: + * Terminal::match_hilite_update: * * Checks the coordinates for dingu matches, setting m_match_span to * the match region or the no-matches region, and if there is a match, * sets it to display highlighted. */ void -VteTerminalPrivate::match_hilite_update() +Terminal::match_hilite_update() { /* m_mouse_last_position contains the current position, see bug 789536 comment 24. */ auto pos = m_mouse_last_position; @@ -5786,12 +5713,12 @@ clipboard_clear_cb(GtkClipboard *clipboard, gpointer user_data) { - VteTerminalPrivate *that = reinterpret_cast(user_data); + auto that = reinterpret_cast(user_data); that->widget_clipboard_cleared(clipboard); } void -VteTerminalPrivate::widget_clipboard_cleared(GtkClipboard *clipboard_) +Terminal::widget_clipboard_cleared(GtkClipboard *clipboard_) { if (m_changing_selection) return; @@ -5815,7 +5742,7 @@ guint info, gpointer user_data) { - VteTerminalPrivate *that = reinterpret_cast(user_data); + auto that = reinterpret_cast(user_data); that->widget_clipboard_requested(clipboard, data, info); } @@ -5835,7 +5762,7 @@ } void -VteTerminalPrivate::widget_clipboard_requested(GtkClipboard *target_clipboard, +Terminal::widget_clipboard_requested(GtkClipboard *target_clipboard, GtkSelectionData *data, guint info) { @@ -5883,7 +5810,7 @@ unsigned int greenbits, unsigned int bluebits> void -VteTerminalPrivate::rgb_from_index(guint index, +Terminal::rgb_from_index(guint index, vte::color::rgb& color) const { bool dim = false; @@ -5912,7 +5839,7 @@ } GString* -VteTerminalPrivate::get_text(vte::grid::row_t start_row, +Terminal::get_text(vte::grid::row_t start_row, vte::grid::column_t start_col, vte::grid::row_t end_row, vte::grid::column_t end_col, @@ -6056,7 +5983,7 @@ } GString* -VteTerminalPrivate::get_text_displayed(bool wrap, +Terminal::get_text_displayed(bool wrap, bool include_trailing_spaces, GArray *attributes) { @@ -6070,7 +5997,7 @@ * doesn't know about sub-row displays. */ GString* -VteTerminalPrivate::get_text_displayed_a11y(bool wrap, +Terminal::get_text_displayed_a11y(bool wrap, bool include_trailing_spaces, GArray *attributes) { @@ -6081,7 +6008,7 @@ } GString* -VteTerminalPrivate::get_selected_text(GArray *attributes) +Terminal::get_selected_text(GArray *attributes) { return get_text(m_selection_start.row, m_selection_start.col, @@ -6095,7 +6022,7 @@ #ifdef VTE_DEBUG unsigned int -VteTerminalPrivate::checksum_area(vte::grid::row_t start_row, +Terminal::checksum_area(vte::grid::row_t start_row, vte::grid::column_t start_col, vte::grid::row_t end_row, vte::grid::column_t end_col) @@ -6144,7 +6071,7 @@ * evolution's mail editor component. */ char * -VteTerminalPrivate::cellattr_to_html(VteCellAttr const* attr, +Terminal::cellattr_to_html(VteCellAttr const* attr, char const* text) const { GString *string; @@ -6235,7 +6162,7 @@ * indexing and returns the VteCellAttr. */ VteCellAttr const* -VteTerminalPrivate::char_to_cell_attr(VteCharAttributes const* attr) const +Terminal::char_to_cell_attr(VteCharAttributes const* attr) const { VteCell const* cell = find_charcell(attr->column, attr->row); if (cell) @@ -6244,7 +6171,7 @@ } /* - * VteTerminalPrivate::attributes_to_html: + * Terminal::attributes_to_html: * @text: A string as returned by the vte_terminal_get_* family of functions. * @attrs: (array) (element-type Vte.CharAttributes): text attributes, as created by vte_terminal_get_* * @@ -6256,7 +6183,7 @@ * Returns: (transfer full): a newly allocated text string, or %NULL. */ GString* -VteTerminalPrivate::attributes_to_html(GString* text_string, +Terminal::attributes_to_html(GString* text_string, GArray* attrs) { GString *string; @@ -6354,7 +6281,7 @@ /* Place the selected text onto the clipboard. Do this asynchronously so that * we get notified when the selection we placed on the clipboard is replaced. */ void -VteTerminalPrivate::widget_copy(VteSelection sel, +Terminal::widget_copy(VteSelection sel, VteFormat format) { /* Only put HTML on the CLIPBOARD, not PRIMARY */ @@ -6411,7 +6338,7 @@ /* Paste from the given clipboard. */ void -VteTerminalPrivate::widget_paste(GdkAtom board) +Terminal::widget_paste(GdkAtom board) { if (!m_input_enabled) return; @@ -6422,11 +6349,11 @@ _vte_debug_print(VTE_DEBUG_SELECTION, "Requesting clipboard contents.\n"); - m_paste_request.request_text(clip, &VteTerminalPrivate::widget_paste_received, this); + m_paste_request.request_text(clip, &Terminal::widget_paste_received, this); } void -VteTerminalPrivate::invalidate_selection() +Terminal::invalidate_selection() { invalidate_region(m_selection_start.col, m_selection_end.col, @@ -6437,7 +6364,7 @@ /* Confine coordinates into the visible area. Padding is already subtracted. */ void -VteTerminalPrivate::confine_coordinates(long *xp, +Terminal::confine_coordinates(long *xp, long *yp) { long x = *xp; @@ -6469,7 +6396,7 @@ /* Start selection at the location of the event. */ void -VteTerminalPrivate::start_selection(long x, +Terminal::start_selection(long x, long y, enum vte_selection_type type) { @@ -6521,7 +6448,7 @@ } bool -VteTerminalPrivate::maybe_end_selection() +Terminal::maybe_end_selection() { if (m_selecting) { /* Copy only if something was selected. */ @@ -6556,7 +6483,7 @@ /* Helper */ void -VteTerminalPrivate::extend_selection_expand() +Terminal::extend_selection_expand() { long i, j; const VteCell *cell; @@ -6755,7 +6682,7 @@ /* Extend selection to include the given event coordinates. */ void -VteTerminalPrivate::extend_selection(long x, +Terminal::extend_selection(long x, long y, bool always_grow, bool force) @@ -6980,12 +6907,12 @@ } /* - * VteTerminalPrivate::select_all: + * Terminal::select_all: * * Selects all text within the terminal (including the scrollback buffer). */ void -VteTerminalPrivate::select_all() +Terminal::select_all() { deselect_all(); @@ -7008,18 +6935,18 @@ /* Autoscroll a bit. */ static gboolean -vte_terminal_autoscroll_cb(VteTerminalPrivate *that) +vte_terminal_autoscroll_cb(vte::terminal::Terminal* that) { return that->autoscroll() ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE; } /* - * VteTerminalPrivate::autoscroll(): + * Terminal::autoscroll(): * * Returns: %true to continue autoscrolling, %false to stop */ bool -VteTerminalPrivate::autoscroll() +Terminal::autoscroll() { bool extend = false; long x, y, xmax, ymax; @@ -7071,7 +6998,7 @@ /* Start autoscroll. */ void -VteTerminalPrivate::start_autoscroll() +Terminal::start_autoscroll() { if (m_mouse_autoscroll_tag != 0) return; @@ -7086,7 +7013,7 @@ /* Stop autoscroll. */ void -VteTerminalPrivate::stop_autoscroll() +Terminal::stop_autoscroll() { if (m_mouse_autoscroll_tag == 0) return; @@ -7096,7 +7023,7 @@ } bool -VteTerminalPrivate::widget_motion_notify(GdkEventMotion *event) +Terminal::widget_motion_notify(GdkEventMotion *event) { bool handled = false; @@ -7161,7 +7088,7 @@ } bool -VteTerminalPrivate::widget_button_press(GdkEventButton *event) +Terminal::widget_button_press(GdkEventButton *event) { bool handled = false; gboolean start_selecting = FALSE, extend_selecting = FALSE; @@ -7313,7 +7240,7 @@ } bool -VteTerminalPrivate::widget_button_release(GdkEventButton *event) +Terminal::widget_button_release(GdkEventButton *event) { bool handled = false; @@ -7366,7 +7293,7 @@ } void -VteTerminalPrivate::widget_focus_in(GdkEventFocus *event) +Terminal::widget_focus_in(GdkEventFocus *event) { _vte_debug_print(VTE_DEBUG_EVENTS, "Focus in.\n"); @@ -7391,14 +7318,14 @@ check_cursor_blink(); - gtk_im_context_focus_in(m_im_context); + m_real_widget->im_focus_in(); invalidate_cursor_once(); maybe_feed_focus_event(true); } } void -VteTerminalPrivate::widget_focus_out(GdkEventFocus *event) +Terminal::widget_focus_out(GdkEventFocus *event) { _vte_debug_print(VTE_DEBUG_EVENTS, "Focus out.\n"); @@ -7420,7 +7347,7 @@ invalidate_all(); } - gtk_im_context_focus_out(m_im_context); + m_real_widget->im_focus_out(); invalidate_cursor_once(); m_mouse_pressed_buttons = 0; @@ -7432,7 +7359,7 @@ } void -VteTerminalPrivate::widget_enter(GdkEventCrossing *event) +Terminal::widget_enter(GdkEventCrossing *event) { GdkEvent* base_event = reinterpret_cast(event); auto pos = view_coords_from_event(base_event); @@ -7449,7 +7376,7 @@ } void -VteTerminalPrivate::widget_leave(GdkEventCrossing *event) +Terminal::widget_leave(GdkEventCrossing *event) { GdkEvent* base_event = reinterpret_cast(event); auto pos = view_coords_from_event(base_event); @@ -7488,7 +7415,7 @@ * here. Similarly, increase cell_width_scale to get nonzero char_spacing.{left,right}. */ void -VteTerminalPrivate::apply_font_metrics(int cell_width, +Terminal::apply_font_metrics(int cell_width, int cell_height, int char_ascent, int char_descent, @@ -7558,7 +7485,7 @@ } void -VteTerminalPrivate::ensure_font() +Terminal::ensure_font() { if (m_draw != NULL) { /* Load default fonts, if no fonts have been loaded. */ @@ -7587,7 +7514,7 @@ } void -VteTerminalPrivate::update_font() +Terminal::update_font() { /* We'll get called again later */ if (m_unscaled_font_desc == nullptr) @@ -7617,7 +7544,7 @@ } /* - * VteTerminalPrivate::set_font_desc: + * Terminal::set_font_desc: * @font_desc: (allow-none): a #PangoFontDescription for the desired font, or %nullptr * * Sets the font used for rendering all text displayed by the terminal, @@ -7627,7 +7554,7 @@ * and columns. The font scale is applied to the specified font. */ bool -VteTerminalPrivate::set_font_desc(PangoFontDescription const* font_desc) +Terminal::set_font_desc(PangoFontDescription const* font_desc) { /* Create an owned font description. */ PangoFontDescription *desc; @@ -7676,7 +7603,7 @@ } bool -VteTerminalPrivate::set_font_scale(gdouble scale) +Terminal::set_font_scale(gdouble scale) { /* FIXME: compare old and new scale in pixel space */ if (_vte_double_equal(scale, m_font_scale)) @@ -7689,7 +7616,7 @@ } bool -VteTerminalPrivate::set_cell_width_scale(double scale) +Terminal::set_cell_width_scale(double scale) { /* FIXME: compare old and new scale in pixel space */ if (_vte_double_equal(scale, m_cell_width_scale)) @@ -7706,7 +7633,7 @@ } bool -VteTerminalPrivate::set_cell_height_scale(double scale) +Terminal::set_cell_height_scale(double scale) { /* FIXME: compare old and new scale in pixel space */ if (_vte_double_equal(scale, m_cell_height_scale)) @@ -7724,25 +7651,30 @@ /* Read and refresh our perception of the size of the PTY. */ void -VteTerminalPrivate::refresh_size() +Terminal::refresh_size() { if (!m_pty) return; int rows, columns; - if (vte_pty_get_size(m_pty, &rows, &columns, NULL)) { - m_row_count = rows; - m_column_count = columns; - } else { + if (!vte_pty_get_size(m_pty, &rows, &columns, nullptr)) { /* Error reading PTY size, use defaults */ - m_row_count = VTE_ROWS; - m_column_count = VTE_COLUMNS; + rows = VTE_ROWS; + columns = VTE_COLUMNS; } + + if (m_row_count == rows && + m_column_count == columns) + return; + + m_row_count = rows; + m_column_count = columns; + m_tabstops.resize(columns); } /* Resize the given screen (normal or alternate) of the terminal. */ void -VteTerminalPrivate::screen_set_size(VteScreen *screen_, +Terminal::screen_set_size(VteScreen *screen_, long old_columns, long old_rows, bool do_rewrap) @@ -7878,7 +7810,7 @@ } void -VteTerminalPrivate::set_size(long columns, +Terminal::set_size(long columns, long rows) { glong old_columns, old_rows; @@ -7904,6 +7836,7 @@ } else { m_row_count = rows; m_column_count = columns; + m_tabstops.resize(columns); } if (old_rows != m_row_count || old_columns != m_column_count) { m_scrolling_restricted = FALSE; @@ -7935,13 +7868,13 @@ /* Redraw the widget. */ static void -vte_terminal_vadjustment_value_changed_cb(VteTerminalPrivate *that) +vte_terminal_vadjustment_value_changed_cb(vte::terminal::Terminal* that) { that->vadjustment_value_changed(); } void -VteTerminalPrivate::vadjustment_value_changed() +Terminal::vadjustment_value_changed() { /* Read the new adjustment value and save the difference. */ double adj = gtk_adjustment_get_value(m_vadjustment); @@ -7965,7 +7898,7 @@ } void -VteTerminalPrivate::widget_set_hadjustment(GtkAdjustment *adjustment) +Terminal::widget_set_hadjustment(GtkAdjustment *adjustment) { if (adjustment == m_hadjustment) return; @@ -7977,7 +7910,7 @@ } void -VteTerminalPrivate::widget_set_vadjustment(GtkAdjustment *adjustment) +Terminal::widget_set_vadjustment(GtkAdjustment *adjustment) { if (adjustment != nullptr && adjustment == m_vadjustment) return; @@ -8008,9 +7941,16 @@ this); } -VteTerminalPrivate::VteTerminalPrivate(VteTerminal *t) : +Terminal::Terminal(vte::platform::Widget* w, + VteTerminal *t) : + m_real_widget(w), m_terminal(t), - m_widget(&t->widget) + m_widget(&t->widget), + m_row_count(VTE_ROWS), + m_column_count(VTE_COLUMNS), + m_normal_screen(VTE_SCROLLBACK_INIT, true), + m_alternate_screen(VTE_ROWS, false), + m_screen(&m_normal_screen) { /* Inits allocation to 1x1 @ -1,-1 */ cairo_rectangle_int_t allocation; @@ -8065,15 +8005,6 @@ m_regex_underline_position = 1; m_regex_underline_thickness = 1; - m_row_count = VTE_ROWS; - m_column_count = VTE_COLUMNS; - - /* Initialize the screens and histories. */ - _vte_ring_init (m_alternate_screen.row_data, m_row_count, FALSE); - m_screen = &m_alternate_screen; - _vte_ring_init (m_normal_screen.row_data, VTE_SCROLLBACK_INIT, TRUE); - m_screen = &m_normal_screen; - reset_default_attributes(true); /* Initialize charset modes. */ @@ -8087,27 +8018,18 @@ m_palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE; /* Set up I/O encodings. */ + g_assert_true(m_using_utf8); m_utf8_ambiguous_width = VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH; - m_iso2022 = _vte_iso2022_state_new(m_encoding); - m_incoming = nullptr; - m_pending = g_array_new(FALSE, TRUE, sizeof(gunichar)); m_max_input_bytes = VTE_MAX_INPUT_READ; m_cursor_blink_tag = 0; m_text_blink_tag = 0; m_outgoing = _vte_byte_array_new(); - m_outgoing_conv = VTE_INVALID_CONV; - m_conv_buffer = _vte_byte_array_new(); - set_encoding(nullptr /* UTF-8 */); - g_assert_cmpstr(m_encoding, ==, "UTF-8"); m_last_graphic_character = 0; - /* Set up the emulation. */ - m_keypad_mode = VTE_KEYMODE_NORMAL; - m_cursor_mode = VTE_KEYMODE_NORMAL; - m_autowrap = TRUE; - m_sendrecv_mode = TRUE; - m_dec_saved = g_hash_table_new(NULL, NULL); - m_matcher = _vte_matcher_new(); +#ifdef WITH_ICONV + m_incoming_leftover = _vte_byte_array_new(); + m_conv_buffer = _vte_byte_array_new(); +#endif /* Setting the terminal type and size requires the PTY master to * be set up properly first. */ @@ -8115,11 +8037,9 @@ set_size(VTE_COLUMNS, VTE_ROWS); m_pty_input_source = 0; m_pty_output_source = 0; - m_pty_pid = -1; /* Scrolling options. */ m_scroll_on_keystroke = TRUE; - m_alternate_screen_scroll = TRUE; m_scrollback_lines = -1; /* force update in vte_terminal_set_scrollback_lines */ set_scrollback_lines(VTE_SCROLLBACK_INIT); @@ -8133,14 +8053,11 @@ /* Miscellaneous options. */ set_backspace_binding(VTE_ERASE_AUTO); set_delete_binding(VTE_ERASE_AUTO); - m_meta_sends_escape = TRUE; m_audible_bell = TRUE; m_text_blink_mode = VTE_TEXT_BLINK_ALWAYS; m_allow_bold = TRUE; m_bold_is_bright = TRUE; - m_deccolm_mode = FALSE; m_rewrap_on_resize = TRUE; - set_default_tabstops(); m_input_enabled = TRUE; @@ -8149,7 +8066,6 @@ m_cursor_aspect_ratio = 0.04; /* Cursor blinking. */ - m_cursor_visible = TRUE; m_cursor_blink_timeout = 500; m_cursor_blinks = FALSE; m_cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM; @@ -8202,8 +8118,8 @@ update_view_extents(); #ifdef VTE_DEBUG - if (g_test_mode) { - static char const warning[] = "\e[1m\e[31mWARNING:\e[39m Test mode enabled.\e[0m\n\e[G"; + if (g_test_flags != 0) { + static char const warning[] = "\e[1m\e[31mWARNING:\e[39m Test mode enabled. This is insecure!\e[0m\n\e[G"; feed(warning, strlen(warning), false); } #endif @@ -8213,14 +8129,14 @@ char buf[1024]; auto len = g_snprintf(buf, sizeof(buf), "\e[1m\e[31m%s:\e[39m %s\e[0m\n\e[G", _("WARNING"), - _("GNUTLS not enabled; data will be written to disk unencrypted!")); + _("GnuTLS not enabled; data will be written to disk unencrypted!")); feed(buf, len, false); } #endif } void -VteTerminalPrivate::widget_constructed() +Terminal::widget_constructed() { /* Set the style as early as possible, before GTK+ starts * invoking various callbacks. This is needed in order to @@ -8230,7 +8146,7 @@ } void -VteTerminalPrivate::widget_get_preferred_width(int *minimum_width, +Terminal::widget_get_preferred_width(int *minimum_width, int *natural_width) { _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_get_preferred_width()\n"); @@ -8257,7 +8173,7 @@ } void -VteTerminalPrivate::widget_get_preferred_height(int *minimum_height, +Terminal::widget_get_preferred_height(int *minimum_height, int *natural_height) { _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_get_preferred_height()\n"); @@ -8284,7 +8200,7 @@ } void -VteTerminalPrivate::widget_size_allocate(GtkAllocation *allocation) +Terminal::widget_size_allocate(GtkAllocation *allocation) { glong width, height; gboolean repaint, update_scrollback; @@ -8327,13 +8243,7 @@ queue_contents_changed(); } - /* Resize the GDK window. */ if (widget_realized()) { - gdk_window_move_resize(m_event_window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); /* Force a repaint if we were resized. */ if (repaint) { reset_update_rects(); @@ -8343,44 +8253,14 @@ } void -VteTerminalPrivate::widget_unrealize() +Terminal::widget_unrealize() { - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_unrealize()\n"); - /* Deallocate the cursors. */ m_mouse_cursor_over_widget = FALSE; - g_object_unref(m_mouse_default_cursor); - m_mouse_default_cursor = NULL; - g_object_unref(m_mouse_mousing_cursor); - m_mouse_mousing_cursor = NULL; - g_object_unref(m_mouse_hyperlink_cursor); - m_mouse_hyperlink_cursor = NULL; - g_object_unref(m_mouse_inviso_cursor); - m_mouse_inviso_cursor = NULL; match_hilite_clear(); - /* Shut down input methods. */ - if (m_im_context != nullptr) { - g_signal_handlers_disconnect_matched(m_im_context, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - this); - im_reset(); - gtk_im_context_set_client_window(m_im_context, - NULL); - g_object_unref(m_im_context); - m_im_context = nullptr; - } m_im_preedit_active = FALSE; - if (m_im_preedit != nullptr) { - g_free(m_im_preedit); - m_im_preedit = NULL; - } - if (m_im_preedit_attrs != NULL) { - pango_attr_list_unref(m_im_preedit_attrs); - m_im_preedit_attrs = NULL; - } - m_im_preedit_cursor = 0; /* Clean up our draw structure. */ if (m_draw != NULL) { @@ -8413,38 +8293,13 @@ /* Clear modifiers. */ m_modifiers = 0; - - /* Destroy the even window */ - gtk_widget_unregister_window(m_widget, m_event_window); - gdk_window_destroy(m_event_window); - m_event_window = nullptr; -} - -static void -vte_terminal_settings_notify_cb (GtkSettings *settings, - GParamSpec *pspec, - VteTerminalPrivate *that) -{ - that->widget_settings_notify(); } void -VteTerminalPrivate::widget_settings_notify() +Terminal::set_blink_settings(bool blink, + int blink_time, + int blink_timeout) noexcept { - gboolean blink; - int blink_time = 1000; - int blink_timeout = G_MAXINT; - - g_object_get(gtk_widget_get_settings(m_widget), - "gtk-cursor-blink", &blink, - "gtk-cursor-blink-time", &blink_time, - "gtk-cursor-blink-timeout", &blink_timeout, - nullptr); - - _vte_debug_print(VTE_DEBUG_MISC, - "Cursor blinking settings: blink=%d time=%d timeout=%d\n", - blink, blink_time, blink_timeout); - m_cursor_blink_cycle = blink_time / 2; m_cursor_blink_timeout = blink_timeout; @@ -8461,50 +8316,24 @@ } } -void -VteTerminalPrivate::widget_screen_changed (GdkScreen *previous_screen) -{ - GtkSettings *settings; - - auto gdk_screen = gtk_widget_get_screen (m_widget); - if (previous_screen != NULL && - (gdk_screen != previous_screen || gdk_screen == NULL)) { - settings = gtk_settings_get_for_screen (previous_screen); - g_signal_handlers_disconnect_matched (settings, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - this); - } - - if (gdk_screen == previous_screen || gdk_screen == nullptr) - return; - - widget_settings_notify(); - - settings = gtk_widget_get_settings(m_widget); - g_signal_connect (settings, "notify::gtk-cursor-blink", - G_CALLBACK (vte_terminal_settings_notify_cb), this); - g_signal_connect (settings, "notify::gtk-cursor-blink-time", - G_CALLBACK (vte_terminal_settings_notify_cb), this); - g_signal_connect (settings, "notify::gtk-cursor-blink-timeout", - G_CALLBACK (vte_terminal_settings_notify_cb), this); -} - -VteTerminalPrivate::~VteTerminalPrivate() +Terminal::~Terminal() { struct vte_match_regex *regex; int sel; guint i; - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_finalize()\n"); + terminate_child(); + set_pty(nullptr); + remove_update_timeout(this); + + /* Stop processing input. */ + stop_processing(this); /* Free the draw structure. */ if (m_draw != NULL) { _vte_draw_free(m_draw); } - /* The NLS maps. */ - _vte_iso2022_state_free(m_iso2022); - /* Free the font description. */ if (m_unscaled_font_desc != NULL) { pango_font_description_free(m_unscaled_font_desc); @@ -8542,11 +8371,6 @@ /* Cancel pending adjustment change notifications. */ m_adjustment_changed_pending = FALSE; - /* Tabstop information. */ - if (m_tabstops) { - g_hash_table_destroy(m_tabstops); - } - /* Free any selected text, but if we currently own the selection, * throw the text onto the clipboard without an owner so that it * doesn't just disappear. */ @@ -8564,15 +8388,18 @@ } } - /* Clear the output histories. */ - _vte_ring_fini(m_normal_screen.row_data); - _vte_ring_fini(m_alternate_screen.row_data); - +#ifdef WITH_ICONV /* Free conversion descriptors. */ - if (m_outgoing_conv != VTE_INVALID_CONV) { - _vte_conv_close(m_outgoing_conv); - m_outgoing_conv = VTE_INVALID_CONV; + if (m_incoming_conv != ((GIConv)-1)) { + g_iconv_close(m_incoming_conv); } + if (m_outgoing_conv != ((GIConv)-1)) { + g_iconv_close(m_outgoing_conv); + } + + _vte_byte_array_free(m_conv_buffer); + _vte_byte_array_free(m_incoming_leftover); +#endif /* Stop listening for child-exited signals. */ if (m_reaper) { @@ -8582,62 +8409,11 @@ g_object_unref(m_reaper); } - /* Stop processing input. */ - stop_processing(this); - /* Discard any pending data. */ - _vte_incoming_chunks_release(m_incoming); _vte_byte_array_free(m_outgoing); - g_array_free(m_pending, TRUE); - _vte_byte_array_free(m_conv_buffer); - - /* Stop the child and stop watching for input from the child. */ - if (m_pty_pid != -1) { -#ifdef HAVE_GETPGID - pid_t pgrp; - pgrp = getpgid(m_pty_pid); - if (pgrp != -1) { - kill(-pgrp, SIGHUP); - } -#endif - kill(m_pty_pid, SIGHUP); - } - disconnect_pty_read(); - disconnect_pty_write(); - if (m_pty_channel != NULL) { - g_io_channel_unref (m_pty_channel); - } - if (m_pty != NULL) { - g_object_unref(m_pty); - } - - /* Remove hash tables. */ - if (m_dec_saved != NULL) { - g_hash_table_destroy(m_dec_saved); - } - - /* Clean up emulation structures. */ - if (m_matcher != NULL) { - _vte_matcher_free(m_matcher); - } - - remove_update_timeout(this); - - /* discard title updates */ - g_free(m_window_title); - g_free(m_window_title_changed); - g_free(m_icon_title_changed); - g_free(m_current_directory_uri_changed); - g_free(m_current_directory_uri); - g_free(m_current_file_uri_changed); - g_free(m_current_file_uri); - - /* Word char exceptions */ - g_free(m_word_char_exceptions_string); - g_free(m_word_char_exceptions); + m_outgoing = nullptr; /* Free public-facing data. */ - g_free(m_icon_title); if (m_vadjustment != NULL) { /* Disconnect our signal handlers from this object. */ g_signal_handlers_disconnect_by_func(m_vadjustment, @@ -8655,86 +8431,16 @@ } void -VteTerminalPrivate::widget_realize() +Terminal::widget_realize() { - _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_realize()\n"); - - auto allocation = get_allocated_rect(); - - /* Create the stock cursors. */ m_mouse_cursor_over_widget = FALSE; /* We'll receive an enter_notify_event if the window appears under the cursor. */ - m_mouse_default_cursor = widget_cursor_new(VTE_DEFAULT_CURSOR); - m_mouse_mousing_cursor = widget_cursor_new(VTE_MOUSING_CURSOR); - if (_vte_debug_on(VTE_DEBUG_HYPERLINK)) - /* Differ from the standard regex match cursor in debug mode. */ - m_mouse_hyperlink_cursor = widget_cursor_new(VTE_HYPERLINK_CURSOR_DEBUG); - else - m_mouse_hyperlink_cursor = widget_cursor_new(VTE_HYPERLINK_CURSOR); - m_mouse_inviso_cursor = widget_cursor_new(GDK_BLANK_CURSOR); - - /* Create a GDK window for the widget. */ - GdkWindowAttr attributes; - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = allocation.x; - attributes.y = allocation.y; - attributes.width = allocation.width; - attributes.height = allocation.height; - attributes.wclass = GDK_INPUT_ONLY; - attributes.visual = gtk_widget_get_visual(m_widget); - attributes.event_mask = gtk_widget_get_events(m_widget) | - GDK_EXPOSURE_MASK | - GDK_FOCUS_CHANGE_MASK | - GDK_SMOOTH_SCROLL_MASK | - GDK_SCROLL_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON1_MOTION_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK | - GDK_KEY_PRESS_MASK | - GDK_KEY_RELEASE_MASK; - attributes.cursor = m_mouse_default_cursor; - guint attributes_mask = GDK_WA_X | - GDK_WA_Y | - (attributes.visual ? GDK_WA_VISUAL : 0) | - GDK_WA_CURSOR; - - m_event_window = gdk_window_new(gtk_widget_get_parent_window (m_widget), - &attributes, attributes_mask); - gtk_widget_register_window(m_widget, m_event_window); /* Create rendering data if this is a re-realise */ if (m_draw == NULL) { m_draw = _vte_draw_new(); } - // FIXMEchpe this shouldn't ever be true: - if (m_im_context != nullptr) { - g_signal_handlers_disconnect_matched(m_im_context, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - this); - im_reset(); - gtk_im_context_set_client_window(m_im_context, nullptr); - g_object_unref(m_im_context); - m_im_context = nullptr; - } m_im_preedit_active = FALSE; - m_im_context = gtk_im_multicontext_new(); - gtk_im_context_set_client_window(m_im_context, m_event_window); - g_signal_connect(m_im_context, "commit", - G_CALLBACK(vte_terminal_im_commit_cb), this); - g_signal_connect(m_im_context, "preedit-start", - G_CALLBACK(vte_terminal_im_preedit_start_cb), this); - g_signal_connect(m_im_context, "preedit-changed", - G_CALLBACK(vte_terminal_im_preedit_changed_cb), this); - g_signal_connect(m_im_context, "preedit-end", - G_CALLBACK(vte_terminal_im_preedit_end_cb), this); - g_signal_connect(m_im_context, "retrieve-surrounding", - G_CALLBACK(vte_terminal_im_retrieve_surrounding_cb), this); - g_signal_connect(m_im_context, "delete-surrounding", - G_CALLBACK(vte_terminal_im_delete_surrounding_cb), this); - gtk_im_context_set_use_preedit(m_im_context, TRUE); /* Clear modifiers. */ m_modifiers = 0; @@ -8742,20 +8448,6 @@ ensure_font(); } -void -VteTerminalPrivate::widget_map() -{ - if (m_event_window) - gdk_window_show_unraised(m_event_window); -} - -void -VteTerminalPrivate::widget_unmap() -{ - if (m_event_window) - gdk_window_hide(m_event_window); -} - static inline void swap (guint *a, guint *b) { @@ -8765,7 +8457,7 @@ // FIXMEchpe probably @attr should be passed by ref void -VteTerminalPrivate::determine_colors(VteCellAttr const* attr, +Terminal::determine_colors(VteCellAttr const* attr, bool is_selected, bool is_cursor, guint *pfore, @@ -8780,7 +8472,7 @@ vte_color_triple_get(attr->colors(), &fore, &back, &deco); /* Reverse-mode switches default fore and back colors */ - if (G_UNLIKELY (m_reverse_mode)) { + if (G_UNLIKELY (m_modes_private.DEC_REVERSE_IMAGE())) { if (fore == VTE_DEFAULT_FG) fore = VTE_DEFAULT_BG; if (back == VTE_DEFAULT_BG) @@ -8857,7 +8549,7 @@ } void -VteTerminalPrivate::determine_colors(VteCell const* cell, +Terminal::determine_colors(VteCell const* cell, bool highlight, guint *fore, guint *back, @@ -8869,7 +8561,7 @@ } void -VteTerminalPrivate::determine_cursor_colors(VteCell const* cell, +Terminal::determine_cursor_colors(VteCell const* cell, bool highlight, guint *fore, guint *back, @@ -8881,7 +8573,7 @@ } static gboolean -invalidate_text_blink_cb(VteTerminalPrivate *that) +invalidate_text_blink_cb(vte::terminal::Terminal* that) { that->m_text_blink_tag = 0; that->invalidate_all(); @@ -8890,7 +8582,7 @@ /* Draw a string of characters with similar attributes. */ void -VteTerminalPrivate::draw_cells(struct _vte_draw_text_request *items, +Terminal::draw_cells(struct _vte_draw_text_request *items, gssize n, uint32_t fore, uint32_t back, @@ -8926,7 +8618,6 @@ } #endif - auto bold = (attr & VTE_ATTR_BOLD) != 0; rgb_from_index<8, 8, 8>(fore, fg); rgb_from_index<8, 8, 8>(back, bg); // FIXMEchpe defer resolving deco color until we actually need to draw an underline? @@ -8944,11 +8635,10 @@ columns += items[i].columns; } if (clear && (draw_default_bg || back != VTE_DEFAULT_BG)) { - gint bold_offset = (bold && !_vte_draw_has_bold(m_draw, VTE_DRAW_BOLD)) ? 1 : 0; _vte_draw_fill_rectangle(m_draw, x, y, - columns * column_width + bold_offset, row_height, + columns * column_width, row_height, &bg, VTE_DRAW_OPAQUE); } } while (i < n); @@ -9078,7 +8768,7 @@ * fix things. Do this here, so that if we suddenly get red-on-black, we'll do * the right thing. */ void -VteTerminalPrivate::fudge_pango_colors(GSList *attributes, +Terminal::fudge_pango_colors(GSList *attributes, VteCell *cells, gsize n) { @@ -9149,7 +8839,7 @@ /* Apply the attribute given in the PangoAttribute to the list of cells. */ void -VteTerminalPrivate::apply_pango_attr(PangoAttribute *attr, +Terminal::apply_pango_attr(PangoAttribute *attr, VteCell *cells, gsize n_cells) { @@ -9253,7 +8943,7 @@ * typically means that the cell array should have the same length as the * string (byte-wise) which the attributes describe. */ void -VteTerminalPrivate::translate_pango_cells(PangoAttrList *attrs, +Terminal::translate_pango_cells(PangoAttrList *attrs, VteCell *cells, gsize n_cells) { @@ -9284,10 +8974,7 @@ attr->start_index, MIN(n_cells, attr->end_index) - attr->start_index); - g_slist_foreach(list, - (GFunc)pango_attribute_destroy, - nullptr); - g_slist_free(list); + g_slist_free_full(list, (GDestroyNotify)pango_attribute_destroy); } } while (pango_attr_iterator_next(attriter) == TRUE); pango_attr_iterator_destroy(attriter); @@ -9298,7 +8985,7 @@ * attribute string is indexed by byte in the UTF-8 representation of the string * of characters. Because we draw a character at a time, this is slower. */ void -VteTerminalPrivate::draw_cells_with_attributes(struct _vte_draw_text_request *items, +Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items, gssize n, PangoAttrList *attrs, bool draw_default_bg, @@ -9341,7 +9028,7 @@ * of multiple-draw APIs by finding runs of characters with identical * attributes and bundling them together. */ void -VteTerminalPrivate::draw_rows(VteScreen *screen_, +Terminal::draw_rows(VteScreen *screen_, vte::grid::row_t start_row, vte::grid::row_t end_row, vte::grid::column_t start_column, @@ -9392,7 +9079,6 @@ selected = cell_is_selected(i, row); determine_colors(cell, selected, &fore, &back, &deco); - bool bold = cell && cell->attr.bold(); j = i + (cell ? cell->attr.columns() : 1); while (j < end_column){ @@ -9413,18 +9099,16 @@ if (nback != back) { break; } - bold = cell && cell->attr.bold(); j += cell ? cell->attr.columns() : 1; } if (back != VTE_DEFAULT_BG) { vte::color::rgb bg; - gint bold_offset = (bold && !_vte_draw_has_bold(m_draw, VTE_DRAW_BOLD)) ? 1 : 0; rgb_from_index<8, 8, 8>(back, bg); _vte_draw_fill_rectangle ( m_draw, x + i * column_width, y, - (j - i) * column_width + bold_offset, + (j - i) * column_width, row_height, &bg, VTE_DRAW_OPAQUE); } @@ -9646,7 +9330,7 @@ } void -VteTerminalPrivate::expand_rectangle(cairo_rectangle_int_t& rect) const +Terminal::expand_rectangle(cairo_rectangle_int_t& rect) const { /* increase the paint by one pixel on all sides to force the * inclusion of neighbouring cells */ @@ -9680,7 +9364,7 @@ } void -VteTerminalPrivate::paint_area(GdkRectangle const* area) +Terminal::paint_area(GdkRectangle const* area) { vte::grid::row_t row, row_stop; vte::grid::column_t col, col_stop; @@ -9724,7 +9408,7 @@ } void -VteTerminalPrivate::paint_cursor() +Terminal::paint_cursor() { struct _vte_draw_text_request item; vte::grid::row_t drow; @@ -9736,12 +9420,19 @@ int x, y; gboolean blink, selected, focus; - if (!m_cursor_visible) + //FIXMEchpe this should already be reflected in the m_cursor_blink_state below + if (!m_modes_private.DEC_TEXT_CURSOR()) return; if (m_im_preedit_active) return; + focus = m_has_focus; + blink = m_cursor_blink_state; + + if (focus && !blink) + return; + col = m_screen->cursor.col; drow = m_screen->cursor.row; width = m_cell_width; @@ -9751,12 +9442,6 @@ if (CLAMP(col, 0, m_column_count - 1) != col) return; - focus = m_has_focus; - blink = m_cursor_blink_state; - - if (focus && !blink) - return; - /* Find the first cell of the character "under" the cursor. * This is for CJK. For TAB, paint the cursor where it really is. */ auto cell = find_charcell(col, drow); @@ -9879,13 +9564,13 @@ } void -VteTerminalPrivate::paint_im_preedit_string() +Terminal::paint_im_preedit_string() { int col, columns; long width, height; int i, len; - if (!m_im_preedit) + if (m_im_preedit.empty()) return; /* Keep local copies of rendering information. */ @@ -9906,7 +9591,7 @@ /* Draw the preedit string, boxed. */ if (len > 0) { struct _vte_draw_text_request *items; - const char *preedit = m_im_preedit; + const char *preedit = m_im_preedit.c_str(); int preedit_cursor; items = g_new(struct _vte_draw_text_request, len); @@ -9954,7 +9639,7 @@ } void -VteTerminalPrivate::widget_draw(cairo_t *cr) +Terminal::widget_draw(cairo_t *cr) { cairo_rectangle_int_t clip_rect; cairo_region_t *region; @@ -10126,7 +9811,7 @@ } void -VteTerminalPrivate::widget_scroll(GdkEventScroll *event) +Terminal::widget_scroll(GdkEventScroll *event) { gdouble delta_x, delta_y; gdouble v; @@ -10187,7 +9872,7 @@ "Scroll speed is %d lines per non-smooth scroll unit\n", (int) v); if (m_screen == &m_alternate_screen && - m_alternate_screen_scroll) { + m_modes_private.XTERM_ALTBUF_SCROLL()) { char *normal; gssize normal_length; @@ -10205,8 +9890,8 @@ _vte_keymap_map ( cnt > 0 ? GDK_KEY_Down : GDK_KEY_Up, m_modifiers, - m_cursor_mode == VTE_KEYMODE_APPLICATION, - m_keypad_mode == VTE_KEYMODE_APPLICATION, + m_modes_private.DEC_APPLICATION_CURSOR_KEYS(), + m_modes_private.DEC_APPLICATION_KEYPAD(), &normal, &normal_length); if (cnt < 0) @@ -10224,7 +9909,7 @@ } bool -VteTerminalPrivate::set_audible_bell(bool setting) +Terminal::set_audible_bell(bool setting) { if (setting == m_audible_bell) return false; @@ -10234,7 +9919,7 @@ } bool -VteTerminalPrivate::set_text_blink_mode(VteTextBlinkMode setting) +Terminal::set_text_blink_mode(VteTextBlinkMode setting) { if (setting == m_text_blink_mode) return false; @@ -10246,7 +9931,7 @@ } bool -VteTerminalPrivate::set_allow_bold(bool setting) +Terminal::set_allow_bold(bool setting) { if (setting == m_allow_bold) return false; @@ -10258,7 +9943,7 @@ } bool -VteTerminalPrivate::set_bold_is_bright(bool setting) +Terminal::set_bold_is_bright(bool setting) { if (setting == m_bold_is_bright) return false; @@ -10270,7 +9955,7 @@ } bool -VteTerminalPrivate::set_allow_hyperlink(bool setting) +Terminal::set_allow_hyperlink(bool setting) { if (setting == m_allow_hyperlink) return false; @@ -10291,7 +9976,7 @@ } bool -VteTerminalPrivate::set_scroll_on_output(bool scroll) +Terminal::set_scroll_on_output(bool scroll) { if (scroll == m_scroll_on_output) return false; @@ -10301,7 +9986,7 @@ } bool -VteTerminalPrivate::set_scroll_on_keystroke(bool scroll) +Terminal::set_scroll_on_keystroke(bool scroll) { if (scroll == m_scroll_on_keystroke) return false; @@ -10311,7 +9996,7 @@ } bool -VteTerminalPrivate::set_rewrap_on_resize(bool rewrap) +Terminal::set_rewrap_on_resize(bool rewrap) { if (rewrap == m_rewrap_on_resize) return false; @@ -10321,7 +10006,7 @@ } void -VteTerminalPrivate::update_cursor_blinks() +Terminal::update_cursor_blinks() { bool blink = false; @@ -10349,7 +10034,7 @@ } bool -VteTerminalPrivate::set_cursor_blink_mode(VteCursorBlinkMode mode) +Terminal::set_cursor_blink_mode(VteCursorBlinkMode mode) { if (mode == m_cursor_blink_mode) return false; @@ -10361,7 +10046,7 @@ } bool -VteTerminalPrivate::set_cursor_shape(VteCursorShape shape) +Terminal::set_cursor_shape(VteCursorShape shape) { if (shape == m_cursor_shape) return false; @@ -10374,7 +10059,7 @@ /* DECSCUSR set cursor style */ bool -VteTerminalPrivate::set_cursor_style(VteCursorStyle style) +Terminal::set_cursor_style(VteCursorStyle style) { if (m_cursor_style == style) return false; @@ -10388,7 +10073,7 @@ } /* - * VteTerminalPrivate::decscusr_cursor_blink: + * Terminal::decscusr_cursor_blink: * * Returns the cursor blink mode set by DECSCUSR. If DECSCUSR was never * called, or it set the blink mode to terminal default, this returns the @@ -10397,7 +10082,7 @@ * Return value: cursor blink mode */ VteCursorBlinkMode -VteTerminalPrivate::decscusr_cursor_blink() +Terminal::decscusr_cursor_blink() { switch (m_cursor_style) { default: @@ -10415,7 +10100,7 @@ } /* - * VteTerminalPrivate::decscusr_cursor_shape: + * Terminal::decscusr_cursor_shape: * @terminal: a #VteTerminal * * Returns the cursor shape set by DECSCUSR. If DECSCUSR was never called, @@ -10425,7 +10110,7 @@ * Return value: cursor shape */ VteCursorShape -VteTerminalPrivate::decscusr_cursor_shape() +Terminal::decscusr_cursor_shape() { switch (m_cursor_style) { default: @@ -10444,7 +10129,7 @@ } bool -VteTerminalPrivate::set_scrollback_lines(long lines) +Terminal::set_scrollback_lines(long lines) { glong low, high, next; double scroll_delta; @@ -10500,7 +10185,7 @@ } bool -VteTerminalPrivate::set_backspace_binding(VteEraseBinding binding) +Terminal::set_backspace_binding(VteEraseBinding binding) { if (binding == m_backspace_binding) return false; @@ -10510,7 +10195,7 @@ } bool -VteTerminalPrivate::set_delete_binding(VteEraseBinding binding) +Terminal::set_delete_binding(VteEraseBinding binding) { if (binding == m_delete_binding) return false; @@ -10520,7 +10205,7 @@ } bool -VteTerminalPrivate::set_mouse_autohide(bool autohide) +Terminal::set_mouse_autohide(bool autohide) { if (autohide == m_mouse_autohide) return false; @@ -10536,7 +10221,7 @@ } /* - * VteTerminalPrivate::reset: + * Terminal::reset: * @clear_tabstops: whether to reset tabstops * @clear_history: whether to empty the terminal's scrollback buffer * @@ -10547,7 +10232,7 @@ * */ void -VteTerminalPrivate::reset(bool clear_tabstops, +Terminal::reset(bool clear_tabstops, bool clear_history, bool from_api) { @@ -10562,25 +10247,38 @@ /* Clear the output buffer. */ _vte_byte_array_clear(m_outgoing); /* Reset charset substitution state. */ - _vte_iso2022_state_free(m_iso2022); - m_iso2022 = _vte_iso2022_state_new(nullptr); - _vte_iso2022_state_set_codeset(m_iso2022, - m_encoding); + + m_utf8_decoder.reset(); + +#ifdef WITH_ICONV + if (m_incoming_conv != ((GIConv)-1)) { + /* Reset the converter state */ + g_iconv(m_incoming_conv, nullptr, nullptr, nullptr, nullptr); + } + _vte_byte_array_clear(m_incoming_leftover); +#endif + + /* Reset parser */ + m_parser.reset(); m_last_graphic_character = 0; - /* Reset keypad/cursor key modes. */ - m_keypad_mode = VTE_KEYMODE_NORMAL; - m_cursor_mode = VTE_KEYMODE_NORMAL; - /* Enable autowrap. */ - m_autowrap = TRUE; - /* Enable meta-sends-escape. */ - m_meta_sends_escape = TRUE; - /* Disable DECCOLM mode. */ - m_deccolm_mode = FALSE; - /* Reset saved settings. */ - if (m_dec_saved != NULL) { - g_hash_table_destroy(m_dec_saved); - m_dec_saved = g_hash_table_new(NULL, NULL); - } + + /* Reset modes */ + m_modes_ecma.reset(); + m_modes_private.clear_saved(); + m_modes_private.reset(); + + /* Reset tabstops */ + if (clear_tabstops) { + m_tabstops.reset(); + } + + /* Window title stack */ + if (clear_history) { + m_window_title_stack.clear(); + } + + update_mouse_protocol(); + /* Reset the color palette. Only the 256 indexed colors, not the special ones, as per xterm. */ for (int i = 0; i < 256; i++) m_palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE; @@ -10611,21 +10309,9 @@ } /* DECSCUSR cursor style */ set_cursor_style(VTE_CURSOR_STYLE_TERMINAL_DEFAULT); - /* Do more stuff we refer to as a "full" reset. */ - if (clear_tabstops) { - set_default_tabstops(); - } /* Reset restricted scrolling regions, leave insert mode, make * the cursor visible again. */ m_scrolling_restricted = FALSE; - m_sendrecv_mode = TRUE; - m_insert_mode = FALSE; - m_linefeed_mode = FALSE; - m_origin_mode = FALSE; - m_reverse_mode = FALSE; - m_cursor_visible = TRUE; - /* For some reason, xterm doesn't reset alternateScroll, but we do. */ - m_alternate_screen_scroll = TRUE; /* Reset the visual bits of selection on hard reset, see bug 789954. */ if (clear_history) { deselect_all(); @@ -10644,19 +10330,12 @@ } /* Reset mouse motion events. */ - m_mouse_tracking_mode = MOUSE_TRACKING_NONE; - apply_mouse_cursor(); m_mouse_pressed_buttons = 0; m_mouse_handled_buttons = 0; - m_mouse_xterm_extension = FALSE; - m_mouse_urxvt_extension = FALSE; + m_mouse_last_position = vte::view::coords(-1, -1); m_mouse_smooth_scroll_delta = 0.; - /* Reset focus tracking */ - m_focus_tracking_mode = FALSE; /* Clear modifiers. */ m_modifiers = 0; - /* Reset miscellaneous stuff. */ - m_bracketed_paste_mode = FALSE; /* Reset the saved cursor. */ save_cursor(&m_normal_screen); save_cursor(&m_alternate_screen); @@ -10667,41 +10346,43 @@ } bool -VteTerminalPrivate::set_pty(VtePty *new_pty) +Terminal::set_pty(VtePty *new_pty) { if (new_pty == m_pty) return false; - if (m_pty != NULL) { + if (m_pty != nullptr) { disconnect_pty_read(); disconnect_pty_write(); - if (m_pty_channel != NULL) { + if (m_pty_channel != nullptr) { g_io_channel_unref (m_pty_channel); - m_pty_channel = NULL; + m_pty_channel = nullptr; } /* Take one last shot at processing whatever data is pending, * then flush the buffers in case we're about to run a new * command, disconnecting the timeout. */ - if (m_incoming != NULL) { + if (!m_incoming_queue.empty()) { process_incoming(); - _vte_incoming_chunks_release (m_incoming); - m_incoming = NULL; + while (!m_incoming_queue.empty()) + m_incoming_queue.pop(); + m_input_bytes = 0; } - g_array_set_size(m_pending, 0); stop_processing(this); + m_utf8_decoder.reset(); // FIXMEchpe necessary here? + /* Clear the outgoing buffer as well. */ _vte_byte_array_clear(m_outgoing); g_object_unref(m_pty); - m_pty = NULL; + m_pty = nullptr; } - if (new_pty == NULL) { - m_pty = NULL; + if (new_pty == nullptr) { + m_pty = nullptr; return true; } @@ -10718,9 +10399,7 @@ set_size(m_column_count, m_row_count); GError *error = nullptr; - if (!vte_pty_set_utf8(m_pty, - strcmp(m_encoding, "UTF-8") == 0, - &error)) { + if (!vte_pty_set_utf8(m_pty, m_using_utf8, &error)) { g_warning ("Failed to set UTF8 mode: %s\n", error->message); g_error_free (error); } @@ -10731,16 +10410,34 @@ return true; } +bool +Terminal::terminate_child() noexcept +{ + if (m_pty_pid == -1) + return false; + +#ifdef HAVE_GETPGID + auto pgrp = getpgid(m_pty_pid); + if (pgrp != -1) { + kill(-pgrp, SIGHUP); + } +#endif + kill(m_pty_pid, SIGHUP); + m_pty_pid = -1; + + return true; +} + /* We need this bit of glue to ensure that accessible objects will always * get signals. */ void -VteTerminalPrivate::subscribe_accessible_events() +Terminal::subscribe_accessible_events() { m_accessible_emit = true; } void -VteTerminalPrivate::select_text(vte::grid::column_t start_col, +Terminal::select_text(vte::grid::column_t start_col, vte::grid::row_t start_row, vte::grid::column_t end_col, vte::grid::row_t end_row) @@ -10763,7 +10460,7 @@ } void -VteTerminalPrivate::select_empty(vte::grid::column_t col, +Terminal::select_empty(vte::grid::column_t col, vte::grid::row_t row) { select_text(col, row, col - 1, row); @@ -10781,7 +10478,7 @@ } static void -add_update_timeout(VteTerminalPrivate *that) +add_update_timeout(vte::terminal::Terminal* that) { if (update_timeout_tag == 0) { _vte_debug_print (VTE_DEBUG_TIMEOUT, @@ -10804,14 +10501,14 @@ } void -VteTerminalPrivate::reset_update_rects() +Terminal::reset_update_rects() { g_array_set_size(m_update_rects, 0); m_invalidated_all = FALSE; } static bool -remove_from_active_list(VteTerminalPrivate *that) +remove_from_active_list(vte::terminal::Terminal* that) { if (that->m_active_terminals_link == nullptr || that->m_update_rects->len != 0) @@ -10824,7 +10521,7 @@ } static void -stop_processing(VteTerminalPrivate *that) +stop_processing(vte::terminal::Terminal* that) { if (!remove_from_active_list(that)) return; @@ -10844,14 +10541,14 @@ } static void -remove_update_timeout(VteTerminalPrivate *that) +remove_update_timeout(vte::terminal::Terminal* that) { that->reset_update_rects(); stop_processing(that); } static void -add_process_timeout(VteTerminalPrivate *that) +add_process_timeout(vte::terminal::Terminal* that) { _vte_debug_print(VTE_DEBUG_TIMEOUT, "Adding terminal to active list\n"); @@ -10868,75 +10565,60 @@ } void -VteTerminalPrivate::start_processing() +Terminal::start_processing() { if (!is_processing()) add_process_timeout(this); } void -VteTerminalPrivate::emit_pending_signals() +Terminal::emit_pending_signals() { GObject *object = G_OBJECT(m_terminal); g_object_freeze_notify(object); - gboolean really_changed; emit_adjustment_changed(); if (m_window_title_changed) { - really_changed = (g_strcmp0(m_window_title, m_window_title_changed) != 0); - g_free (m_window_title); - m_window_title = m_window_title_changed; - m_window_title_changed = NULL; + if (m_window_title != m_window_title_pending) { + m_window_title.swap(m_window_title_pending); - if (really_changed) { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `window-title-changed'.\n"); g_signal_emit(object, signals[SIGNAL_WINDOW_TITLE_CHANGED], 0); g_object_notify_by_pspec(object, pspecs[PROP_WINDOW_TITLE]); } - } - - if (m_icon_title_changed) { - really_changed = (g_strcmp0(m_icon_title, m_icon_title_changed) != 0); - g_free (m_icon_title); - m_icon_title = m_icon_title_changed; - m_icon_title_changed = NULL; - if (really_changed) { - _vte_debug_print(VTE_DEBUG_SIGNALS, - "Emitting `icon-title-changed'.\n"); - g_signal_emit(object, signals[SIGNAL_ICON_TITLE_CHANGED], 0); - g_object_notify_by_pspec(object, pspecs[PROP_ICON_TITLE]); - } + m_window_title_pending.clear(); + m_window_title_changed = false; } if (m_current_directory_uri_changed) { - really_changed = (g_strcmp0(m_current_directory_uri, m_current_directory_uri_changed) != 0); - g_free (m_current_directory_uri); - m_current_directory_uri = m_current_directory_uri_changed; - m_current_directory_uri_changed = NULL; + if (m_current_directory_uri != m_current_directory_uri_pending) { + m_current_directory_uri.swap(m_current_directory_uri_pending); - if (really_changed) { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `current-directory-uri-changed'.\n"); g_signal_emit(object, signals[SIGNAL_CURRENT_DIRECTORY_URI_CHANGED], 0); g_object_notify_by_pspec(object, pspecs[PROP_CURRENT_DIRECTORY_URI]); } + + m_current_directory_uri_pending.clear(); + m_current_directory_uri_changed = false; } if (m_current_file_uri_changed) { - really_changed = (g_strcmp0(m_current_file_uri, m_current_file_uri_changed) != 0); - g_free (m_current_file_uri); - m_current_file_uri = m_current_file_uri_changed; - m_current_file_uri_changed = NULL; + if (m_current_file_uri != m_current_file_uri_pending) { + m_current_file_uri.swap(m_current_file_uri_pending); - if (really_changed) { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `current-file-uri-changed'.\n"); g_signal_emit(object, signals[SIGNAL_CURRENT_FILE_URI_CHANGED], 0); g_object_notify_by_pspec(object, pspecs[PROP_CURRENT_FILE_URI]); } + + m_current_file_uri_pending.clear(); + m_current_file_uri_changed = false; } /* Flush any pending "inserted" signals. */ @@ -10994,7 +10676,7 @@ } void -VteTerminalPrivate::time_process_incoming() +Terminal::time_process_incoming() { g_timer_reset(process_timer); process_incoming(); @@ -11004,10 +10686,8 @@ } bool -VteTerminalPrivate::process(bool emit_adj_changed) +Terminal::process(bool emit_adj_changed) { - bool is_active; - if (m_pty_channel) { if (m_pty_input_active || m_pty_input_source == 0) { @@ -11018,7 +10698,8 @@ } if (emit_adj_changed) emit_adjustment_changed(); - is_active = _vte_incoming_chunks_length(m_incoming) != 0; + + bool is_active = !m_incoming_queue.empty(); if (is_active) { if (VTE_MAX_PROCESS_TIME) { time_process_incoming(); @@ -11053,7 +10734,7 @@ g_list_length(g_active_terminals)); for (l = g_active_terminals; l != NULL; l = next) { - VteTerminalPrivate *that = reinterpret_cast(l->data); + auto that = reinterpret_cast(l->data); bool active; next = l->next; @@ -11094,14 +10775,14 @@ g_usleep (0); } else if (update_timeout_tag == 0) { /* otherwise free up memory used to capture incoming data */ - prune_chunks (10); + vte::base::Chunk::prune(); } return again; } bool -VteTerminalPrivate::invalidate_dirty_rects_and_process_updates() +Terminal::invalidate_dirty_rects_and_process_updates() { if (G_UNLIKELY(!widget_realized())) return false; @@ -11148,7 +10829,7 @@ g_list_length(g_active_terminals)); for (l = g_active_terminals; l != NULL; l = next) { - VteTerminalPrivate *that = reinterpret_cast(l->data); + auto that = reinterpret_cast(l->data); next = l->next; @@ -11198,7 +10879,7 @@ g_usleep (0); } else { /* otherwise free up memory used to capture incoming data */ - prune_chunks (10); + vte::base::Chunk::prune(); } return FALSE; /* If we need to go again, we already have a new timer for that. */ @@ -11223,7 +10904,7 @@ remove_process_timeout_source(); for (l = g_active_terminals; l != NULL; l = next) { - VteTerminalPrivate *that = reinterpret_cast(l->data); + auto that = reinterpret_cast(l->data); next = l->next; @@ -11255,7 +10936,7 @@ } bool -VteTerminalPrivate::write_contents_sync (GOutputStream *stream, +Terminal::write_contents_sync (GOutputStream *stream, VteWriteFlags flags, GCancellable *cancellable, GError **error) @@ -11272,14 +10953,14 @@ /* TODO Add properties & signals */ /* - * VteTerminalPrivate::search_set_regex: + * Terminal::search_set_regex: * @regex: (allow-none): a #VteRegex, or %nullptr * @flags: PCRE2 match flags, or 0 * * Sets the regex to search for. Unsets the search regex when passed %nullptr. */ bool -VteTerminalPrivate::search_set_regex (VteRegex *regex, +Terminal::search_set_regex (VteRegex *regex, guint32 flags) { struct vte_regex_and_flags *rx; @@ -11303,7 +10984,7 @@ } bool -VteTerminalPrivate::search_set_wrap_around(bool wrap) +Terminal::search_set_wrap_around(bool wrap) { if (wrap == m_search_wrap_around) return false; @@ -11313,7 +10994,7 @@ } bool -VteTerminalPrivate::search_rows(pcre2_match_context_8 *match_context, +Terminal::search_rows(pcre2_match_context_8 *match_context, pcre2_match_data_8 *match_data, vte::grid::row_t start_row, vte::grid::row_t end_row, @@ -11409,7 +11090,7 @@ } bool -VteTerminalPrivate::search_rows_iter(pcre2_match_context_8 *match_context, +Terminal::search_rows_iter(pcre2_match_context_8 *match_context, pcre2_match_data_8 *match_data, vte::grid::row_t start_row, vte::grid::row_t end_row, @@ -11452,7 +11133,7 @@ } bool -VteTerminalPrivate::search_find (bool backward) +Terminal::search_find (bool backward) { vte::grid::row_t buffer_start_row, buffer_end_row; vte::grid::row_t last_start_row, last_end_row; @@ -11525,7 +11206,7 @@ } /* - * VteTerminalPrivate::set_input_enabled: + * Terminal::set_input_enabled: * @enabled: whether to enable user input * * Enables or disables user input. When user input is disabled, @@ -11535,7 +11216,7 @@ * Returns: %true iff the setting changed */ bool -VteTerminalPrivate::set_input_enabled (bool enabled) +Terminal::set_input_enabled (bool enabled) { if (enabled == m_input_enabled) return false; @@ -11548,13 +11229,13 @@ if (enabled) { if (gtk_widget_has_focus(m_widget)) - gtk_im_context_focus_in(m_im_context); + m_real_widget->im_focus_in(); gtk_style_context_remove_class (context, GTK_STYLE_CLASS_READ_ONLY); } else { im_reset(); if (gtk_widget_has_focus(m_widget)) - gtk_im_context_focus_out(m_im_context); + m_real_widget->im_focus_out(); disconnect_pty_write(); _vte_byte_array_clear(m_outgoing); @@ -11566,23 +11247,16 @@ } bool -VteTerminalPrivate::process_word_char_exceptions(char const *str, - gunichar **arrayp, - gsize *lenp) -{ - const char *p; - gunichar *array, c; - gsize len, i; - - if (str == NULL) +Terminal::process_word_char_exceptions(char const *str, + std::u32string& array) const noexcept +{ + if (str == nullptr) str = WORD_CHAR_EXCEPTIONS_DEFAULT; - len = g_utf8_strlen(str, -1); - array = g_new(gunichar, len); - i = 0; + array.reserve(g_utf8_strlen(str, -1)); - for (p = str; *p; p = g_utf8_next_char(p)) { - c = g_utf8_get_char(p); + for (auto const* p = str; *p; p = g_utf8_next_char(p)) { + auto const c = g_utf8_get_char(p); /* For forward compatibility reasons, we skip * characters that aren't supposed to be here, @@ -11598,41 +11272,39 @@ if (g_unichar_isalnum(c)) continue; - array[i++] = g_utf8_get_char(p); + array.push_back(c); } - g_assert(i <= len); - len = i; /* we may have skipped some characters */ - /* Sort the result since we want to use bsearch on it */ - qsort(array, len, sizeof(gunichar), compare_unichar_p); + // FIXME remove the const cast when upgrading to C++17 + qsort(const_cast(array.data()), + array.size(), + sizeof(std::u32string::value_type), + compare_unichar_p); /* Check that no character occurs twice */ - for (i = 1; i < len; i++) { + for (size_t i = 1; i < array.size(); ++i) { if (array[i-1] != array[i]) continue; - g_free(array); return false; } #if 0 /* Debug */ - for (i = 0; i < len; i++) { + for (size_t i = 0; i < array.size(); i++) { char utf[7]; - c = array[i]; + auto const c = array[i]; utf[g_unichar_to_utf8(c, utf)] = '\0'; g_printerr("Word char exception: U+%04X %s\n", c, utf); } #endif - *lenp = len; - *arrayp = array; return true; } /* - * VteTerminalPrivate::set_word_char_exceptions: + * Terminal::set_word_char_exceptions: * @exceptions: a string of ASCII punctuation characters, or %nullptr * * With this function you can provide a set of characters which will @@ -11649,29 +11321,23 @@ * Returns: %true if the word char exceptions changed */ bool -VteTerminalPrivate::set_word_char_exceptions(char const* exceptions) +Terminal::set_word_char_exceptions(char const* exceptions) { - gunichar *array; - gsize len; - - if (g_strcmp0(exceptions, m_word_char_exceptions_string) == 0) + if (g_strcmp0(exceptions, m_word_char_exceptions_string.data()) == 0) return false; - if (!process_word_char_exceptions(exceptions, &array, &len)) + std::u32string array; + if (!process_word_char_exceptions(exceptions, array)) return false; - g_free(m_word_char_exceptions_string); - m_word_char_exceptions_string = g_strdup(exceptions); - - g_free(m_word_char_exceptions); - m_word_char_exceptions = array; - m_word_char_exceptions_len = len; + m_word_char_exceptions_string = exceptions ? exceptions : ""; + m_word_char_exceptions.swap(array); return true; } void -VteTerminalPrivate::set_clear_background(bool setting) +Terminal::set_clear_background(bool setting) { if (m_clear_background == setting) return; @@ -11679,3 +11345,6 @@ m_clear_background = setting; invalidate_all(); } + +} // namespace terminal +} // namespace vte diff -Nru vte2.91-0.52.2/src/vteconv.cc vte2.91-0.54.0/src/vteconv.cc --- vte2.91-0.52.2/src/vteconv.cc 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/src/vteconv.cc 1970-01-01 00:00:00.000000000 +0000 @@ -1,788 +0,0 @@ -/* - * Copyright (C) 2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#include "config.h" - -#include -#include -#include -#include -#include "buffer.h" -#include "vteconv.h" -#include "vtedefines.hh" - -typedef size_t (*convert_func)(GIConv converter, - const guchar **inbuf, - gsize *inbytes_left, - guchar **outbuf, - gsize *outbytes_left); -struct _VteConv { - GIConv conv; - convert_func convert; - gint (*close)(GIConv converter); - gboolean in_unichar, out_unichar; - VteByteArray *in_scratch, *out_scratch; -}; - -/* We can't use g_utf8_strlen as that's not nul-safe :( */ -static gsize -_vte_conv_utf8_strlen(const gchar *p, gssize max) -{ - const gchar *q = p + max; - gsize length = 0; - while (p < q) { - p = g_utf8_next_char(p); - length++; - } - return length; -} - -/* A variant of g_utf8_validate() that allows NUL characters. - * Requires that max_len >= 0 && end != NULL. */ -static gboolean -_vte_conv_utf8_validate(const gchar *str, - gssize max_len, - const gchar **end) -{ - gboolean ret; - do { - ret = g_utf8_validate(str, max_len, end); - max_len -= *end - str; - str = *end; - /* Hitting a NUL is okay. Clear the error and iterate over them. */ - while (max_len > 0 && *str == '\0') { - ret = TRUE; - max_len--; - str++; - *end = str; - } - } while (ret && max_len > 0); - return ret; -} - -/* A variant of g_utf8_get_char_validated() that allows NUL characters. - * Requires that max_len >= 0. */ -static gunichar -_vte_conv_utf8_get_char_validated(const gchar *p, - gssize max_len) { - gunichar ret; - /* Handle NUL at the beginning. */ - if (max_len > 0 && p[0] == '\0') - return 0; - ret = g_utf8_get_char_validated(p, max_len); - /* If a partial match is returned but there's a NUL in the buffer - * then this is a wrong error, we're facing an invalid character. */ - if (ret == (gunichar) -2 && memchr(p, '\0', max_len) != NULL) - ret = (gunichar) -1; - return ret; -} - -/* A bogus UTF-8 to UTF-8 conversion function which attempts to provide the - * same semantics as g_iconv(). */ -static size_t -_vte_conv_utf8_utf8(GIConv converter, - const gchar **inbuf, - gsize *inbytes_left, - gchar **outbuf, - gsize *outbytes_left) -{ - gboolean validated; - const gchar *endptr; - size_t bytes; - - /* We don't tolerate shenanigans! */ - g_assert_cmpuint(*outbytes_left, >=, *inbytes_left); - - /* The only error we can throw is EILSEQ, so check for that here. */ - validated = _vte_conv_utf8_validate(*inbuf, *inbytes_left, &endptr); - - /* Copy whatever data was validated. */ - bytes = endptr - *inbuf; - memcpy(*outbuf, *inbuf, bytes); - *inbuf += bytes; - *outbuf += bytes; - *outbytes_left -= bytes; - *inbytes_left -= bytes; - - /* Return 0 (number of non-reversible conversions performed) if everything - * looked good, else EILSEQ. */ - if (validated) { - return 0; - } - - /* Determine why the end of the string is not valid. */ - if (_vte_conv_utf8_get_char_validated(*inbuf, *inbytes_left) == (gunichar) -2) { - /* Prefix of a valid UTF-8 */ - errno = EINVAL; - } else { - /* We had enough bytes to validate the character, and - * it failed. It just doesn't look right. */ - errno = EILSEQ; - } - return (size_t) -1; -} - -/* Open a conversion descriptor which, in addition to normal cases, provides - * UTF-8 to UTF-8 conversions and a gunichar-compatible source and target - * encoding. */ -VteConv -_vte_conv_open(const char *target, const char *source) -{ - VteConv ret; - GIConv conv; - gboolean in_unichar, out_unichar, utf8; - const char *real_target, *real_source; - - /* No shenanigans. */ - g_assert(target != NULL); - g_assert(source != NULL); - g_assert(strlen(target) > 0); - g_assert(strlen(source) > 0); - - /* Assume normal iconv usage. */ - in_unichar = FALSE; - out_unichar = FALSE; - real_source = source; - real_target = target; - - /* Determine if we need to convert gunichars to UTF-8 on input. */ - if (strcmp(target, VTE_CONV_GUNICHAR_TYPE) == 0) { - real_target = "UTF-8"; - out_unichar = TRUE; - } - - /* Determine if we need to convert UTF-8 to gunichars on output. */ - if (strcmp(source, VTE_CONV_GUNICHAR_TYPE) == 0) { - real_source = "UTF-8"; - in_unichar = TRUE; - } - - /* Determine if this is a UTF-8 to UTF-8 conversion. */ - utf8 = ((g_ascii_strcasecmp(real_target, "UTF-8") == 0) && - (g_ascii_strcasecmp(real_source, "UTF-8") == 0)); - - /* If we're doing UTF-8 to UTF-8, just use a dummy function which - * checks for bad data. */ - conv = NULL; - if (!utf8) { - char *translit_target = g_strdup_printf ("%s//translit", real_target); - conv = g_iconv_open(translit_target, real_source); - g_free (translit_target); - if (conv == ((GIConv) -1)) { - conv = g_iconv_open(real_target, real_source); - } - if (conv == ((GIConv) -1)) { - return VTE_INVALID_CONV; - } - } - - /* Set up the descriptor. */ - ret = g_slice_new0(struct _VteConv); - if (utf8) { - ret->conv = NULL; - ret->convert = (convert_func) _vte_conv_utf8_utf8; - ret->close = NULL; - } else { - g_assert((conv != NULL) && (conv != ((GIConv) -1))); - ret->conv = conv; - ret->convert = (convert_func) g_iconv; - ret->close = g_iconv_close; - } - - /* Initialize other elements. */ - ret->in_unichar = in_unichar; - ret->out_unichar = out_unichar; - - /* Create scratch buffers. */ - ret->in_scratch = _vte_byte_array_new(); - ret->out_scratch = _vte_byte_array_new(); - - return ret; -} - -gint -_vte_conv_close(VteConv converter) -{ - g_assert(converter != NULL); - g_assert(converter != VTE_INVALID_CONV); - - /* Close the underlying descriptor, if there is one. */ - if (converter->conv != NULL) { - g_assert(converter->close != NULL); - converter->close(converter->conv); - } - - /* Free the scratch buffers. */ - _vte_byte_array_free(converter->in_scratch); - _vte_byte_array_free(converter->out_scratch); - - /* Free the structure itself. */ - g_slice_free(struct _VteConv, converter); - - return 0; -} - -size_t -_vte_conv(VteConv converter, - const guchar **inbuf, gsize *inbytes_left, - guchar **outbuf, gsize *outbytes_left) -{ - size_t ret, tmp; - const guchar *work_inbuf_start, *work_inbuf_working; - guchar *work_outbuf_start, *work_outbuf_working; - gsize work_inbytes, work_outbytes; - - g_assert(converter != NULL); - g_assert(converter != VTE_INVALID_CONV); - - work_inbuf_start = work_inbuf_working = *inbuf; - work_outbuf_start = work_outbuf_working = *outbuf; - work_inbytes = *inbytes_left; - work_outbytes = *outbytes_left; - - /* Possibly convert the input data from gunichars to UTF-8. */ - if (converter->in_unichar) { - int i, char_count; - guchar *p, *end; - gunichar *g; - /* Make sure the scratch buffer has enough space. */ - char_count = *inbytes_left / sizeof(gunichar); - _vte_byte_array_set_minimum_size(converter->in_scratch, - (char_count + 1) * VTE_UTF8_BPC); - /* Convert the incoming text. */ - g = (gunichar*) *inbuf; - p = converter->in_scratch->data; - end = p + (char_count + 1) * VTE_UTF8_BPC; - for (i = 0; i < char_count; i++) { - p += g_unichar_to_utf8(g[i], (gchar *)p); - g_assert(p <= end); - } - /* Update our working pointers. */ - work_inbuf_start = converter->in_scratch->data; - work_inbuf_working = work_inbuf_start; - work_inbytes = p - work_inbuf_start; - } - - /* Possibly set the output pointers to point at our scratch buffer. */ - if (converter->out_unichar) { - work_outbytes = *outbytes_left * VTE_UTF8_BPC; - _vte_byte_array_set_minimum_size(converter->out_scratch, - work_outbytes); - work_outbuf_start = converter->out_scratch->data; - work_outbuf_working = work_outbuf_start; - } - - /* Call the underlying conversion. */ - ret = 0; - do { - tmp = converter->convert(converter->conv, - &work_inbuf_working, - &work_inbytes, - &work_outbuf_working, - &work_outbytes); - if (tmp == (size_t) -1) { - /* Check for zero bytes, which we pass right through. */ - if (errno == EILSEQ) { - if ((work_inbytes > 0) && - (work_inbuf_working[0] == '\0') && - (work_outbytes > 0)) { - work_outbuf_working[0] = '\0'; - work_outbuf_working++; - work_inbuf_working++; - work_outbytes--; - work_inbytes--; - ret++; - } else { - /* No go. */ - ret = -1; - break; - } - } else { - ret = -1; - break; - } - } else { - ret += tmp; - break; - } - } while (work_inbytes > 0); - - /* We can't handle this particular failure, and it should - * never happen. (If it does, our caller needs fixing.) */ - g_assert((ret != (size_t)-1) || (errno != E2BIG)); - - /* Possibly convert the output from UTF-8 to gunichars. */ - if (converter->out_unichar) { - int left = *outbytes_left; - gunichar *g; - gchar *p; - - g = (gunichar*) *outbuf; - for(p = (gchar *)work_outbuf_start; - p < (gchar *)work_outbuf_working; - p = g_utf8_next_char(p)) { - g_assert(left>=0); - *g++ = g_utf8_get_char(p); - left -= sizeof(gunichar); - } - *outbytes_left = left; - *outbuf = (guchar*) g; - } else { - /* Pass on the output results. */ - *outbuf = work_outbuf_working; - *outbytes_left -= (work_outbuf_working - work_outbuf_start); - } - - /* Advance the input pointer to the right place. */ - if (converter->in_unichar) { - /* Get an idea of how many characters were converted, and - * advance the pointer as required. */ - gsize chars; - chars = _vte_conv_utf8_strlen((const gchar *)work_inbuf_start, - work_inbuf_working - work_inbuf_start); - *inbuf += (sizeof(gunichar) * chars); - *inbytes_left -= (sizeof(gunichar) * chars); - } else { - /* Pass on the input results. */ - *inbuf = work_inbuf_working; - *inbytes_left -= (work_inbuf_working - work_inbuf_start); - } - - return ret; -} - -size_t -_vte_conv_cu(VteConv converter, - const guchar **inbuf, gsize *inbytes_left, - gunichar **outbuf, gsize *outbytes_left) -{ - return _vte_conv(converter, - inbuf, inbytes_left, - (guchar**)outbuf, outbytes_left); -} - -size_t -_vte_conv_uu(VteConv converter, - const gunichar **inbuf, gsize *inbytes_left, - gunichar **outbuf, gsize *outbytes_left) -{ - return _vte_conv(converter, - (const guchar**)inbuf, inbytes_left, - (guchar**)outbuf, outbytes_left); -} - -size_t -_vte_conv_uc(VteConv converter, - const gunichar **inbuf, gsize *inbytes_left, - guchar **outbuf, gsize *outbytes_left) -{ - return _vte_conv(converter, - (const guchar**)inbuf, inbytes_left, - outbuf, outbytes_left); -} - -#ifdef VTECONV_MAIN - -static gsize -ucs4_strlen(const gunichar *p, - gsize max_len) -{ - const gunichar *q = p + max_len; - gsize length = 0; - while (p < q && *p++ != 0) - length++; - return length; -} -static void -clear(gunichar wide[5], gchar narrow[5]) -{ - wide[0] = 'T'; - wide[1] = 'E'; - wide[2] = 'S'; - wide[3] = 'T'; - wide[4] = '\0'; - strcpy(narrow, "test"); -} - -static int -mixed_strcmp(const gunichar *wide, const guchar *narrow) -{ - while (*wide && *narrow) { - if (*wide != (gunichar)*narrow) { - return -1; - } - wide++; - narrow++; - } - return 0; -} - -/* Test _vte_conv_utf8_strlen, especially where it differs from g_utf8_strlen. */ -static void -test_utf8_strlen (void) -{ - g_assert_cmpuint(_vte_conv_utf8_strlen("", 0), ==, 0); - g_assert_cmpuint(_vte_conv_utf8_strlen("\0\0\0\0", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("\0A\0\0", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("\0A\0B", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("A\0B\0", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("ABCD", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("ABCDE", 4), ==, 4); - g_assert_cmpuint(_vte_conv_utf8_strlen("\xC2\xA0\xC2\xA0", 4), ==, 2); -} - -static void -test_utf8_validate (void) -{ - static const struct { - char input[16]; - gsize ilen; - gsize endlen; - gboolean validates; - } tests[] = { - { "\0\0\0", 0, 0, TRUE }, - { "\0\0\0", 1, 1, TRUE }, - { "\0\0\0", 3, 3, TRUE }, - - { "ab\0cd\0\0ef", 6, 6, TRUE }, - { "ab\0cd\0\0ef", 7, 7, TRUE }, - { "ab\0cd\0\0ef", 9, 9, TRUE }, - - { "ab\xE2\x94\x80\0\xE2\x94\x80yz", 11, 11, TRUE }, - - { "ab\x80\0cd", 6, 2, FALSE }, - - { "ab\xE2\0cd", 6, 2, FALSE }, - }; - guint i; - const char *end; - - for (i = 0; i < G_N_ELEMENTS (tests); i++) { - g_assert(_vte_conv_utf8_validate(tests[i].input, tests[i].ilen, &end) == tests[i].validates); - g_assert_cmpuint((gsize)(end - tests[i].input), ==, tests[i].endlen); - } -} - -/* Test _vte_conv_utf8_get_char_validated. */ -static void -test_utf8_get_char_validated (void) -{ - static const guchar mbyte_test_u[] = { 0xe2, 0x94, 0x80 }; - static const guchar mbyte_test_break_u[] = { 0xe2, 0xe2, 0xe2 }; - const char *mbyte_test = (const char *)mbyte_test_u; - const char *mbyte_test_break = (const char *)mbyte_test_break_u; - - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("", 0), ==, (gunichar)-2); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\0", 1), ==, 0); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 1), ==, (gunichar)-2); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 2), ==, (gunichar)-2); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 3), ==, 0x2500); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 1), ==, (gunichar)-2); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 2), ==, (gunichar)-1); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 3), ==, (gunichar)-1); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\x80\0", 2), ==, (gunichar)-1); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\0", 2), ==, (gunichar)-1); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\x94\0", 3), ==, (gunichar)-1); - g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\x94\x80\0", 4), ==, 0x2500); -} - -typedef struct { - gunichar wide[8]; - gssize widelen; - gchar narrow[8]; - gssize narrowlen; - char target[16]; - char source[16]; -} TestData; - -static void -test_narrow_narrow (const TestData *tests, - gsize n_tests) -{ - VteConv conv; - guchar buf[10]; - const guchar *inbuf; - guchar *outbuf; - gsize inbytes, outbytes, ret; - gsize i; - - for (i = 0; i < n_tests; i++) { - memset(buf, 0, sizeof(buf)); - inbuf = (const guchar *)tests[i].narrow; - inbytes = tests[i].narrowlen >= 0 ? tests[i].narrowlen : strlen(tests[i].narrow); - outbuf = buf; - outbytes = sizeof(buf); - conv = _vte_conv_open(tests[i].target, tests[i].source); - ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert_cmpuint(ret, ==, 0); - g_assert_cmpuint(inbytes, ==, 0); - g_assert_cmpstr(tests[i].narrow, ==, (char *)buf); - _vte_conv_close(conv); - } -} - -static void -test_narrow_to_wide (const TestData *tests, - gsize n_tests) -{ - gunichar widebuf[5]; - VteConv conv; - const guchar *inbuf; - guchar *outbuf; - gsize inbytes, outbytes, ret; - gsize i; - - for (i = 0; i < n_tests; i++) { - memset(widebuf, 0, sizeof(widebuf)); - inbuf = (const guchar *)tests[i].narrow; - inbytes = tests[i].narrowlen >= 0 ? tests[i].narrowlen : strlen(tests[i].narrow); - outbuf = (guchar*) widebuf; - outbytes = sizeof(widebuf); - conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, tests[i].source); - ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert_cmpuint(ret, ==, 0); - g_assert_cmpuint(inbytes, ==, 0); - g_assert_cmpint(mixed_strcmp(widebuf, inbuf), ==, 0); - _vte_conv_close(conv); - } -} - -static void -test_wide_to_narrow (const TestData *tests, - gsize n_tests) -{ - char buf[10]; - VteConv conv; - const guchar *inbuf; - guchar *outbuf; - gsize inbytes, outbytes, ret; - gsize i; - - for (i = 0; i < n_tests; i++) { - memset(buf, 0, sizeof(buf)); - inbuf = (const guchar *)tests[i].wide; - inbytes = tests[i].widelen >= 0 ? tests[i].widelen - : ucs4_strlen(tests[i].wide, sizeof(tests[i].wide)) * sizeof(gunichar); - outbuf = (guchar *)buf; - outbytes = sizeof(buf); - conv = _vte_conv_open(tests[i].target, VTE_CONV_GUNICHAR_TYPE); - ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert_cmpuint(ret, ==, 0); - g_assert_cmpuint(inbytes, ==, 0); - g_assert_cmpint(mixed_strcmp(tests[i].wide, outbuf), ==, 0); - _vte_conv_close(conv); - } -} - -static void -test_g_iconv_narrow_narrow (void) -{ - static const TestData tests[] = { - { { 0, }, -1, "test", -1, "UTF-8", "ISO-8859-1" }, - { { 0, }, -1, "test", -1, "ISO-8859-1", "UTF-8" }, - }; - - test_narrow_narrow (tests, G_N_ELEMENTS(tests)); -} - -static void -test_g_iconv_narrow_to_wide (void) -{ - static const TestData tests[] = { - { { 0, }, -1, "test", -1, VTE_CONV_GUNICHAR_TYPE, "ISO-8859-1" }, - }; - - test_narrow_to_wide (tests, G_N_ELEMENTS(tests)); -} - -static void -test_g_iconv_wide_to_narrow (void) -{ - static const TestData tests[] = { - { { 'T', 'E', 'S', 'T', 0 }, -1, "", -1, "ISO-8859-1", VTE_CONV_GUNICHAR_TYPE }, - }; - - test_wide_to_narrow (tests, G_N_ELEMENTS(tests)); -} - -static void -test_utf8_to_utf8 (void) -{ - static const TestData tests[] = { - { { 0, }, -1, "test", -1, "UTF-8", "UTF-8" }, - }; - - test_narrow_narrow (tests, G_N_ELEMENTS (tests)); -} - -static void -test_zero_byte_passthrough (void) -{ - gunichar wide_test[5]; - gchar narrow_test[5]; - VteConv conv; - const guchar *inbuf; - guchar *outbuf; - gsize inbytes, outbytes; - int i; - - /* Test zero-byte pass-through. */ - clear(wide_test, narrow_test); - memset(wide_test, 0, sizeof(wide_test)); - inbuf = (guchar *)wide_test; - inbytes = 3 * sizeof(gunichar); - outbuf = (guchar *)narrow_test; - outbytes = sizeof(narrow_test); - conv = _vte_conv_open("UTF-8", VTE_CONV_GUNICHAR_TYPE); - i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert(inbytes == 0); - if ((narrow_test[0] != 0) || - (narrow_test[1] != 0) || - (narrow_test[2] != 0)) { - g_error("Conversion 6 failed.\n"); - } - _vte_conv_close(conv); - - /* Test zero-byte pass-through. */ - clear(wide_test, narrow_test); - memset(wide_test, 'A', sizeof(wide_test)); - memset(narrow_test, 0, sizeof(narrow_test)); - inbuf = (guchar *)narrow_test; - inbytes = 3; - outbuf = (guchar *)wide_test; - outbytes = sizeof(wide_test); - conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, "UTF-8"); - i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert(inbytes == 0); - if ((wide_test[0] != 0) || - (wide_test[1] != 0) || - (wide_test[2] != 0)) { - g_error("Conversion 7 failed.\n"); - } - _vte_conv_close(conv); - - /* Test zero-byte pass-through. */ - clear(wide_test, narrow_test); - memset(wide_test, 'A', sizeof(wide_test)); - memset(narrow_test, 0, sizeof(narrow_test)); - inbuf = (guchar *)narrow_test; - inbytes = 3; - outbuf = (guchar *)wide_test; - outbytes = sizeof(wide_test); - conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, "ISO-8859-1"); - i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - g_assert(inbytes == 0); - if ((wide_test[0] != 0) || - (wide_test[1] != 0) || - (wide_test[2] != 0)) { - g_error("Conversion 8 failed.\n"); - } - _vte_conv_close(conv); -} - -static void -test_utf8_to_utf8_error (void) -{ - static const guchar mbyte_test[] = { 0xe2, 0x94, 0x80 }; - static const guchar mbyte_test_break[] = { 0xe2, 0xe2, 0xe2 }; - gchar buf[10]; - VteConv conv; - const guchar *inbuf; - guchar *outbuf; - gsize inbytes, outbytes; - gsize i; - - /* Test UTF-8 to UTF-8 error reporting, valid multibyte. */ - for (i = 0; i < sizeof(mbyte_test); i++) { - int ret; - inbuf = mbyte_test; - inbytes = i + 1; - outbuf = (guchar *)buf; - outbytes = sizeof(buf); - conv = _vte_conv_open("UTF-8", "UTF-8"); - ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - switch (i) { - case 0: - g_assert_cmpint(ret, ==, -1); - g_assert_cmpint(errno, ==, EINVAL); - break; - case 1: - g_assert_cmpint(ret, ==, -1); - g_assert_cmpint(errno, ==, EINVAL); - break; - case 2: - g_assert_cmpint(ret, !=, -1); - break; - default: - g_assert_not_reached(); - break; - } - _vte_conv_close(conv); - } - - /* Test UTF-8 to UTF-8 error reporting, invalid multibyte. */ - for (i = 0; i < sizeof(mbyte_test_break); i++) { - int ret; - inbuf = mbyte_test_break; - inbytes = i + 1; - outbuf = (guchar *)buf; - outbytes = sizeof(buf); - conv = _vte_conv_open("UTF-8", "UTF-8"); - ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); - _vte_conv_close(conv); - switch (i) { - case 0: - g_assert_cmpint(ret, ==, -1); - g_assert_cmpint(errno, ==, EINVAL); - break; - case 1: - g_assert_cmpint(ret, ==, -1); - g_assert_cmpint(errno, ==, EILSEQ); - break; - case 2: - g_assert_cmpint(ret, ==, -1); - g_assert_cmpint(errno, ==, EILSEQ); - break; - default: - g_assert_not_reached(); - break; - } - } -} - -int -main (int argc, - char *argv[]) -{ - g_test_init (&argc, &argv, nullptr); - - g_test_add_func ("/vte/conv/utf8/strlen", test_utf8_strlen); - g_test_add_func ("/vte/conv/utf8/validate", test_utf8_validate); - g_test_add_func ("/vte/conv/utf8/get-char", test_utf8_get_char_validated); - g_test_add_func ("/vte/conv/utf8/conversion", test_utf8_to_utf8); - g_test_add_func ("/vte/conv/utf8/conversion-with-error", test_utf8_to_utf8_error); - g_test_add_func ("/vte/conv/narrow-narrow", test_g_iconv_narrow_narrow); - g_test_add_func ("/vte/conv/narrow-to-wide", test_g_iconv_narrow_to_wide); - g_test_add_func ("/vte/conv/wide-to-narrow", test_g_iconv_wide_to_narrow); - g_test_add_func ("/vte/conv/zero-byte-passthrough", test_zero_byte_passthrough); - - return g_test_run (); -} -#endif diff -Nru vte2.91-0.52.2/src/vteconv.h vte2.91-0.54.0/src/vteconv.h --- vte2.91-0.52.2/src/vteconv.h 2018-05-21 19:30:33.000000000 +0000 +++ vte2.91-0.54.0/src/vteconv.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2003 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#ifndef vte_vteconv_h_included -#define vte_vteconv_h_included - - -#include - -G_BEGIN_DECLS - -#define VTE_CONV_GUNICHAR_TYPE "X-VTE-GUNICHAR" -#define VTE_INVALID_CONV ((VteConv)-1) - -struct _VteConv; -typedef struct _VteConv *VteConv; - -VteConv _vte_conv_open(const char *target, const char *source); -size_t _vte_conv(VteConv converter, - const guchar **inbuf, gsize *inbytes_left, - guchar **outbuf, gsize *outbytes_left); -size_t _vte_conv_uc(VteConv converter, - const gunichar **inbuf, gsize *inbytes_left, - guchar **outbuf, gsize *outbytes_left); -size_t _vte_conv_uu(VteConv converter, - const gunichar **inbuf, gsize *inbytes_left, - gunichar **outbuf, gsize *outbytes_left); -size_t _vte_conv_cu(VteConv converter, - const guchar **inbuf, gsize *inbytes_left, - gunichar **outbuf, gsize *outbytes_left); -gint _vte_conv_close(VteConv converter); - -G_END_DECLS - -#endif diff -Nru vte2.91-0.52.2/src/vtedefines.hh vte2.91-0.54.0/src/vtedefines.hh --- vte2.91-0.52.2/src/vtedefines.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vtedefines.hh 2018-09-02 13:20:15.000000000 +0000 @@ -79,18 +79,9 @@ #define VTE_MOUSING_CURSOR GDK_LEFT_PTR #define VTE_HYPERLINK_CURSOR GDK_HAND2 #define VTE_HYPERLINK_CURSOR_DEBUG GDK_SPIDER -#define VTE_TAB_MAX 999 -#define VTE_ADJUSTMENT_PRIORITY G_PRIORITY_DEFAULT_IDLE -#define VTE_INPUT_RETRY_PRIORITY G_PRIORITY_HIGH -#define VTE_INPUT_PRIORITY G_PRIORITY_DEFAULT_IDLE #define VTE_CHILD_INPUT_PRIORITY G_PRIORITY_DEFAULT_IDLE #define VTE_CHILD_OUTPUT_PRIORITY G_PRIORITY_HIGH -#define VTE_FX_PRIORITY G_PRIORITY_DEFAULT_IDLE -#define VTE_REGCOMP_FLAGS REG_EXTENDED -#define VTE_REGEXEC_FLAGS 0 -#define VTE_INPUT_CHUNK_SIZE 0x2000 #define VTE_MAX_INPUT_READ 0x1000 -#define VTE_INVALID_BYTE '?' #define VTE_DISPLAY_TIMEOUT 10 #define VTE_UPDATE_TIMEOUT 15 #define VTE_UPDATE_REPEAT_TIMEOUT 30 @@ -98,7 +89,7 @@ #define VTE_CELL_BBOX_SLACK 1 #define VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH 1 -#define VTE_UTF8_BPC (6) /* Maximum number of bytes used per UTF-8 character */ +#define VTE_UTF8_BPC (4) /* Maximum number of bytes used per UTF-8 character */ /* Keep in decreasing order of precedence. */ #define VTE_COLOR_SOURCE_ESCAPE 0 @@ -139,3 +130,9 @@ * Currently the hyperlink data is the ID and URI and a separator in between. * Make sure there are enough bits to store this in VteStreamCellAttr.hyperlink_length */ #define VTE_HYPERLINK_TOTAL_LENGTH_MAX (VTE_HYPERLINK_ID_LENGTH_MAX + 1 + VTE_HYPERLINK_URI_LENGTH_MAX) + +/* Max length of title */ +#define VTE_WINDOW_TITLE_MAX_LENGTH (1024) + +/* Max depth of title stack */ +#define VTE_WINDOW_TITLE_STACK_MAX_DEPTH (8) diff -Nru vte2.91-0.52.2/src/vtedraw.cc vte2.91-0.54.0/src/vtedraw.cc --- vte2.91-0.52.2/src/vtedraw.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vtedraw.cc 2018-09-02 13:20:15.000000000 +0000 @@ -982,12 +982,6 @@ *right = l + w; } -gboolean -_vte_draw_has_bold (struct _vte_draw *draw, guint style) -{ - return (draw->fonts[style ^ VTE_DRAW_BOLD] != draw->fonts[style]); -} - /* Check if a unicode character is actually a graphic character we draw * ourselves to handle cases where fonts don't have glyphs for them. */ static gboolean @@ -1561,22 +1555,6 @@ } _vte_draw_text_internal (draw, requests, n_requests, color, alpha, style); - - /* handle fonts that lack a bold face by double-striking */ - if ((style & VTE_DRAW_BOLD) && !_vte_draw_has_bold (draw, style)) { - gsize i; - - /* Take a step to the right. */ - for (i = 0; i < n_requests; i++) { - requests[i].x++; - } - _vte_draw_text_internal (draw, requests, - n_requests, color, alpha, style); - /* Now take a step back. */ - for (i = 0; i < n_requests; i++) { - requests[i].x--; - } - } } /* The following two functions are unused since commit 154abade902850afb44115cccf8fcac51fc082f0, diff -Nru vte2.91-0.52.2/src/vtedraw.hh vte2.91-0.54.0/src/vtedraw.hh --- vte2.91-0.52.2/src/vtedraw.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vtedraw.hh 2018-09-02 13:20:15.000000000 +0000 @@ -70,7 +70,6 @@ GtkBorder *char_spacing); void _vte_draw_get_char_edges (struct _vte_draw *draw, vteunistr c, int columns, guint style, int *left, int *right); -gboolean _vte_draw_has_bold (struct _vte_draw *draw, guint style); void _vte_draw_text(struct _vte_draw *draw, struct _vte_draw_text_request *requests, gsize n_requests, diff -Nru vte2.91-0.52.2/src/vtegtk.cc vte2.91-0.54.0/src/vtegtk.cc --- vte2.91-0.52.2/src/vtegtk.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vtegtk.cc 2018-09-02 13:20:15.000000000 +0000 @@ -53,6 +53,7 @@ #include "vtedefines.hh" #include "vteinternal.hh" #include "vteaccess.h" +#include "widget.hh" #include "vtegtk.hh" #include "vteregexinternal.hh" @@ -71,7 +72,10 @@ #ifdef VTE_DEBUG G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET, - G_ADD_PRIVATE(VteTerminal) + { + VteTerminal_private_offset = + g_type_add_instance_private(g_define_type_id, sizeof(vte::platform::Widget)); + } g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate)); G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL) if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) { @@ -79,17 +83,34 @@ }) #else G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET, - G_ADD_PRIVATE(VteTerminal) + { + VteTerminal_private_offset = + g_type_add_instance_private(g_define_type_id, sizeof(vte::platform::Widget)); + } g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate)); G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL)) #endif -#define IMPL(t) (reinterpret_cast(vte_terminal_get_instance_private(t))) +static inline +vte::platform::Widget* get_widget(VteTerminal* terminal) +{ + return reinterpret_cast(vte_terminal_get_instance_private(terminal)); +} + +#define WIDGET(t) (get_widget(t)) + +vte::terminal::Terminal* +_vte_terminal_get_impl(VteTerminal *terminal) +{ + return WIDGET(terminal)->terminal(); +} + +#define IMPL(t) (_vte_terminal_get_impl(t)) guint signals[LAST_SIGNAL]; GParamSpec *pspecs[LAST_PROP]; GTimer *process_timer; -bool g_test_mode = false; +uint64_t g_test_flags = 0; static bool valid_color(GdkRGBA const* color) @@ -100,17 +121,12 @@ color->alpha >= 0. && color->alpha <= 1.; } -VteTerminalPrivate *_vte_terminal_get_impl(VteTerminal *terminal) -{ - return IMPL(terminal); -} - static void vte_terminal_set_hadjustment(VteTerminal *terminal, GtkAdjustment *adjustment) { g_return_if_fail(adjustment == nullptr || GTK_IS_ADJUSTMENT(adjustment)); - IMPL(terminal)->widget_set_hadjustment(adjustment); + WIDGET(terminal)->set_hadjustment(adjustment); } static void @@ -118,7 +134,7 @@ GtkAdjustment *adjustment) { g_return_if_fail(adjustment == nullptr || GTK_IS_ADJUSTMENT(adjustment)); - IMPL(terminal)->widget_set_vadjustment(adjustment); + WIDGET(terminal)->set_vadjustment(adjustment); } static void @@ -141,13 +157,13 @@ static void vte_terminal_real_copy_clipboard(VteTerminal *terminal) { - IMPL(terminal)->widget_copy(VTE_SELECTION_CLIPBOARD, VTE_FORMAT_TEXT); + WIDGET(terminal)->copy(VTE_SELECTION_CLIPBOARD, VTE_FORMAT_TEXT); } static void vte_terminal_real_paste_clipboard(VteTerminal *terminal) { - IMPL(terminal)->widget_paste(GDK_SELECTION_CLIPBOARD); + WIDGET(terminal)->paste(GDK_SELECTION_CLIPBOARD); } static void @@ -157,7 +173,7 @@ GTK_WIDGET_CLASS (vte_terminal_parent_class)->style_updated (widget); - IMPL(terminal)->widget_style_updated(); + WIDGET(terminal)->style_updated(); } static gboolean @@ -181,42 +197,42 @@ } } - return IMPL(terminal)->widget_key_press(event); + return WIDGET(terminal)->key_press(event); } static gboolean vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - return IMPL(terminal)->widget_key_release(event); + return WIDGET(terminal)->key_release(event); } static gboolean vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - return IMPL(terminal)->widget_motion_notify(event); + return WIDGET(terminal)->motion_notify(event); } static gboolean vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - return IMPL(terminal)->widget_button_press(event); + return WIDGET(terminal)->button_press(event); } static gboolean vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - return IMPL(terminal)->widget_button_release(event); + return WIDGET(terminal)->button_release(event); } static gboolean vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_scroll(event); + WIDGET(terminal)->scroll(event); return TRUE; } @@ -224,7 +240,7 @@ vte_terminal_focus_in(GtkWidget *widget, GdkEventFocus *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_focus_in(event); + WIDGET(terminal)->focus_in(event); return FALSE; } @@ -232,7 +248,7 @@ vte_terminal_focus_out(GtkWidget *widget, GdkEventFocus *event) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_focus_out(event); + WIDGET(terminal)->focus_out(event); return FALSE; } @@ -246,7 +262,7 @@ ret = GTK_WIDGET_CLASS (vte_terminal_parent_class)->enter_notify_event (widget, event); } - IMPL(terminal)->widget_enter(event); + WIDGET(terminal)->enter(event); return ret; } @@ -261,7 +277,7 @@ ret = GTK_WIDGET_CLASS (vte_terminal_parent_class)->leave_notify_event (widget, event); } - IMPL(terminal)->widget_leave(event); + WIDGET(terminal)->leave(event); return ret; } @@ -272,7 +288,7 @@ int *natural_width) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_get_preferred_width(minimum_width, natural_width); + WIDGET(terminal)->get_preferred_width(minimum_width, natural_width); } static void @@ -281,14 +297,14 @@ int *natural_height) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_get_preferred_height(minimum_height, natural_height); + WIDGET(terminal)->get_preferred_height(minimum_height, natural_height); } static void vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_size_allocate(allocation); + WIDGET(terminal)->size_allocate(allocation); } static gboolean @@ -296,24 +312,28 @@ cairo_t *cr) { VteTerminal *terminal = VTE_TERMINAL (widget); - IMPL(terminal)->widget_draw(cr); + WIDGET(terminal)->draw(cr); return FALSE; } static void vte_terminal_realize(GtkWidget *widget) { + _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_realize()\n"); + GTK_WIDGET_CLASS(vte_terminal_parent_class)->realize(widget); VteTerminal *terminal= VTE_TERMINAL(widget); - IMPL(terminal)->widget_realize(); + WIDGET(terminal)->realize(); } static void vte_terminal_unrealize(GtkWidget *widget) { + _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_unrealize()\n"); + VteTerminal *terminal = VTE_TERMINAL (widget); - IMPL(terminal)->widget_unrealize(); + WIDGET(terminal)->unrealize(); GTK_WIDGET_CLASS(vte_terminal_parent_class)->unrealize(widget); } @@ -326,7 +346,7 @@ VteTerminal *terminal = VTE_TERMINAL(widget); GTK_WIDGET_CLASS(vte_terminal_parent_class)->map(widget); - IMPL(terminal)->widget_map(); + WIDGET(terminal)->map(); } static void @@ -335,7 +355,7 @@ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_unmap()\n"); VteTerminal *terminal = VTE_TERMINAL(widget); - IMPL(terminal)->widget_unmap(); + WIDGET(terminal)->unmap(); GTK_WIDGET_CLASS(vte_terminal_parent_class)->unmap(widget); } @@ -350,7 +370,7 @@ GTK_WIDGET_CLASS (vte_terminal_parent_class)->screen_changed (widget, previous_screen); } - IMPL(terminal)->widget_screen_changed(previous_screen); + WIDGET(terminal)->screen_changed(previous_screen); } static void @@ -360,7 +380,7 @@ G_OBJECT_CLASS (vte_terminal_parent_class)->constructed (object); - IMPL(terminal)->widget_constructed(); + WIDGET(terminal)->constructed(); } static void @@ -378,17 +398,30 @@ /* Initialize private data. NOTE: place is zeroed */ place = vte_terminal_get_instance_private(terminal); - new (place) VteTerminalPrivate(terminal); + new (place) vte::platform::Widget(terminal); gtk_widget_set_has_window(&terminal->widget, FALSE); } static void +vte_terminal_dispose(GObject *object) +{ + _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_dispose()\n"); + + VteTerminal *terminal = VTE_TERMINAL (object); + WIDGET(terminal)->dispose(); + + /* Call the inherited dispose() method. */ + G_OBJECT_CLASS(vte_terminal_parent_class)->dispose(object); +} + +static void vte_terminal_finalize(GObject *object) { - VteTerminal *terminal = VTE_TERMINAL (object); + _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_finalize()\n"); - IMPL(terminal)->~VteTerminalPrivate(); + VteTerminal *terminal = VTE_TERMINAL (object); + WIDGET(terminal)->~Widget(); /* Call the inherited finalize() method. */ G_OBJECT_CLASS(vte_terminal_parent_class)->finalize(object); @@ -401,21 +434,22 @@ GParamSpec *pspec) { VteTerminal *terminal = VTE_TERMINAL (object); + auto widget = WIDGET(terminal); auto impl = IMPL(terminal); switch (prop_id) { case PROP_HADJUSTMENT: - g_value_set_object (value, impl->m_hadjustment); + g_value_set_object (value, widget->get_hadjustment()); break; case PROP_VADJUSTMENT: - g_value_set_object (value, impl->m_vadjustment); + g_value_set_object (value, widget->get_vadjustment()); break; case PROP_HSCROLL_POLICY: - g_value_set_enum (value, impl->m_hscroll_policy); + g_value_set_enum (value, widget->hscroll_policy()); break; case PROP_VSCROLL_POLICY: - g_value_set_enum (value, impl->m_vscroll_policy); + g_value_set_enum (value, widget->vscroll_policy()); break; case PROP_ALLOW_BOLD: g_value_set_boolean (value, vte_terminal_get_allow_bold (terminal)); @@ -642,12 +676,6 @@ " = vte_terminal_paint\n" " ]} end update_timeout\n" " > end process_timeout\n"); - - char const* test_env = g_getenv("VTE_TEST"); - if (test_env != nullptr) { - g_test_mode = g_str_equal(test_env, "1"); - g_unsetenv("VTE_TEST"); - } } #endif @@ -663,6 +691,7 @@ /* Override some of the default handlers. */ gobject_class->constructed = vte_terminal_constructed; + gobject_class->dispose = vte_terminal_dispose; gobject_class->finalize = vte_terminal_finalize; gobject_class->get_property = vte_terminal_get_property; gobject_class->set_property = vte_terminal_set_property; @@ -795,7 +824,7 @@ * VteTerminal::icon-title-changed: * @vteterminal: the object which received the signal * - * Emitted when the terminal's %icon_title field is modified. + * Deprecated: 0.54: This signal is never emitted. */ signals[SIGNAL_ICON_TITLE_CHANGED] = g_signal_new(I_("icon-title-changed"), @@ -870,9 +899,9 @@ * VteTerminal::encoding-changed: * @vteterminal: the object which received the signal * - * Emitted whenever the terminal's current encoding has changed, either - * as a result of receiving a control sequence which toggled between the - * local and UTF-8 encodings, or at the parent application's request. + * Emitted whenever the terminal's current encoding has changed. + * + * Note: support for non-UTF-8 is deprecated. */ signals[SIGNAL_ENCODING_CHANGED] = g_signal_new(I_("encoding-changed"), @@ -1369,9 +1398,10 @@ /** * VteTerminal:cjk-ambiguous-width: * - * This setting controls whether ambiguous-width characters are narrow or wide - * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, - * the width of ambiguous-width characters is fixed. + * This setting controls whether ambiguous-width characters are narrow or wide. + * (Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), + * the width of ambiguous-width characters is fixed and determined by the encoding + * itself.) * * This setting only takes effect the next time the terminal is reset, either * via escape sequence or with vte_terminal_reset(). @@ -1435,6 +1465,9 @@ * be encoded with. For certain terminal types, applications executing in the * terminal can change the encoding. The default is defined by the * application's locale settings. + * + * Deprecated: 0.54: Instead of using this, you should use a tool like + * luit(1) when support for non-UTF-8 is required */ pspecs[PROP_ENCODING] = g_param_spec_string ("encoding", NULL, NULL, @@ -1458,7 +1491,7 @@ /** * VteTerminal:icon-title: * - * The terminal's so-called icon title, or %NULL if no icon title has been set. + * Deprecated: 0.54: This property is always %NULL. */ pspecs[PROP_ICON_TITLE] = g_param_spec_string ("icon-title", NULL, NULL, @@ -1746,6 +1779,23 @@ return NULL; } +/** + * vte_set_test_flags: (skip): + * @flags: flags + * + * Sets test flags. This function is only useful for implementing + * unit tests for vte itself; it is a no-op in non-debug builds. + * + * Since: 0.54 + */ +void +vte_set_test_flags(guint64 flags) +{ +#ifdef VTE_DEBUG + g_test_flags = flags; +#endif +} + /* VteTerminal public API */ /** @@ -1804,7 +1854,7 @@ g_return_if_fail(VTE_IS_TERMINAL(terminal)); g_return_if_fail(format == VTE_FORMAT_TEXT || format == VTE_FORMAT_HTML); - IMPL(terminal)->widget_copy(VTE_SELECTION_CLIPBOARD, format); + WIDGET(terminal)->copy(VTE_SELECTION_CLIPBOARD, format); } /** @@ -1819,7 +1869,7 @@ { g_return_if_fail(VTE_IS_TERMINAL(terminal)); _vte_debug_print(VTE_DEBUG_SELECTION, "Copying to PRIMARY.\n"); - IMPL(terminal)->widget_copy(VTE_SELECTION_PRIMARY, VTE_FORMAT_TEXT); + WIDGET(terminal)->copy(VTE_SELECTION_PRIMARY, VTE_FORMAT_TEXT); } /** @@ -1827,8 +1877,7 @@ * @terminal: a #VteTerminal * * Sends the contents of the #GDK_SELECTION_CLIPBOARD selection to the - * terminal's child. If necessary, the data is converted from UTF-8 to the - * terminal's current encoding. It's called on paste menu item, or when + * terminal's child. It's called on paste menu item, or when * user presses Shift+Insert. */ void @@ -1844,8 +1893,7 @@ * @terminal: a #VteTerminal * * Sends the contents of the #GDK_SELECTION_PRIMARY selection to the terminal's - * child. If necessary, the data is converted from UTF-8 to the terminal's - * current encoding. The terminal will call also paste the + * child. The terminal will call also paste the * #GDK_SELECTION_PRIMARY selection when the user clicks with the the second * mouse button. */ @@ -1854,7 +1902,7 @@ { g_return_if_fail(VTE_IS_TERMINAL(terminal)); _vte_debug_print(VTE_DEBUG_SELECTION, "Pasting PRIMARY.\n"); - IMPL(terminal)->widget_paste(GDK_SELECTION_PRIMARY); + WIDGET(terminal)->paste(GDK_SELECTION_PRIMARY); } /** @@ -2088,7 +2136,7 @@ * Sets which cursor the terminal will use if the pointer is over the pattern * specified by @tag. The terminal keeps a reference to @cursor. * - * Deprecated: 0.40: Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead. + * Deprecated: 0.40: Use vte_terminal_match_set_cursor_name() instead. */ void vte_terminal_match_set_cursor(VteTerminal *terminal, @@ -2107,6 +2155,8 @@ * * Sets which cursor the terminal will use if the pointer is over the pattern * specified by @tag. + * + * Deprecated: 0.54: Use vte_terminal_match_set_cursor_name() instead. */ void vte_terminal_match_set_cursor_type(VteTerminal *terminal, @@ -2539,10 +2589,12 @@ /* Automatically watch the child */ if (terminal != nullptr) { - if (pid != -1) + if (pid != -1) { + vte_terminal_set_pty(terminal, pty); vte_terminal_watch_child(terminal, pid); - else + } else { vte_terminal_set_pty(terminal, nullptr); + } } else { if (pid != -1) { vte_reaper_add_child(pid); @@ -2667,8 +2719,6 @@ return; } - vte_terminal_set_pty(terminal, pty); - guint spawn_flags = (guint)spawn_flags_; /* We do NOT support this flag. If you want to have some FD open in the child @@ -3163,8 +3213,10 @@ * vte_terminal_get_cjk_ambiguous_width: * @terminal: a #VteTerminal * - * Returns whether ambiguous-width characters are narrow or wide when using - * the UTF-8 encoding (vte_terminal_set_encoding()). + * Returns whether ambiguous-width characters are narrow or wide. + * (Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), + * the width of ambiguous-width characters is fixed and determined by the encoding + * itself.) * * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide */ @@ -3180,9 +3232,10 @@ * @terminal: a #VteTerminal * @width: either 1 (narrow) or 2 (wide) * - * This setting controls whether ambiguous-width characters are narrow or wide - * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, - * the width of ambiguous-width characters is fixed. + * This setting controls whether ambiguous-width characters are narrow or wide. + * (Note that when using a non-UTF-8 encoding set via vte_terminal_set_encoding(), + * the width of ambiguous-width characters is fixed and determined by the encoding + * itself.) */ void vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width) @@ -3440,21 +3493,22 @@ * vte_terminal_get_current_directory_uri: * @terminal: a #VteTerminal * - * Returns: (transfer none): the URI of the current directory of the + * Returns: (nullable) (transfer none): the URI of the current directory of the * process running in the terminal, or %NULL */ const char * vte_terminal_get_current_directory_uri(VteTerminal *terminal) { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); - return IMPL(terminal)->m_current_directory_uri; + auto impl = IMPL(terminal); + return impl->m_current_directory_uri.size() ? impl->m_current_directory_uri.data() : nullptr; } /** * vte_terminal_get_current_file_uri: * @terminal: a #VteTerminal * - * Returns: (transfer none): the URI of the current file the + * Returns: (nullable) (transfer none): the URI of the current file the * process running in the terminal is operating on, or %NULL if * not set */ @@ -3462,7 +3516,8 @@ vte_terminal_get_current_file_uri(VteTerminal *terminal) { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); - return IMPL(terminal)->m_current_file_uri; + auto impl = IMPL(terminal); + return impl->m_current_file_uri.size() ? impl->m_current_file_uri.data() : nullptr; } /** @@ -3558,15 +3613,17 @@ * @terminal: a #VteTerminal * * Determines the name of the encoding in which the terminal expects data to be - * encoded. + * encoded, or %NULL if UTF-8 is in use. * - * Returns: (transfer none): the current encoding for the terminal + * Returns: (nullable) (transfer none): the current encoding for the terminal + * + * Deprecated: 0.54: Support for non-UTF-8 is deprecated. */ const char * vte_terminal_get_encoding(VteTerminal *terminal) { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); - return IMPL(terminal)->m_encoding; + return WIDGET(terminal)->encoding(); } /** @@ -3579,8 +3636,14 @@ * be encoded with. For certain terminal types, applications executing in the * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8". * + * Note: Support for non-UTF-8 is deprecated and may get removed altogether. + * Instead of this function, you should use a wrapper like luit(1) when + * spawning the child process. + * * Returns: %TRUE if the encoding could be changed to the specified one, * or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION. + * + * Deprecated: 0.54: Support for non-UTF-8 is deprecated. */ gboolean vte_terminal_set_encoding(VteTerminal *terminal, @@ -3871,13 +3934,14 @@ * vte_terminal_get_icon_title: * @terminal: a #VteTerminal * - * Returns: (transfer none): the icon title + * Returns: (nullable) (transfer none): %NULL + * + * Deprecated: 0.54: */ const char * vte_terminal_get_icon_title(VteTerminal *terminal) { - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), ""); - return IMPL(terminal)->m_icon_title; + return nullptr; } /** @@ -4157,13 +4221,13 @@ * vte_terminal_get_window_title: * @terminal: a #VteTerminal * - * Returns: (transfer none): the window title + * Returns: (nullable) (transfer none): the window title, or %NULL */ const char * vte_terminal_get_window_title(VteTerminal *terminal) { - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), ""); - return IMPL(terminal)->m_window_title; + g_return_val_if_fail(VTE_IS_TERMINAL(terminal), nullptr); + return IMPL(terminal)->m_window_title.data(); } /** @@ -4176,7 +4240,7 @@ * * If %NULL, a built-in set is used. * - * Returns: (transfer none): a string, or %NULL + * Returns: (nullable) (transfer none): a string, or %NULL * * Since: 0.40 */ @@ -4185,7 +4249,8 @@ { g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL); - return IMPL(terminal)->m_word_char_exceptions_string; + auto impl = IMPL(terminal); + return impl->m_word_char_exceptions_string.empty() ? nullptr : impl->m_word_char_exceptions_string.data(); } /** @@ -4271,3 +4336,36 @@ IMPL(terminal)->set_clear_background(setting != FALSE); } + +/** + * vte_terminal_get_color_background_for_draw: + * @terminal: a #VteTerminal + * @color: (out): a location to store a #GdbRGBA color + * + * Returns the background colour, as used by @terminal when + * drawing the background, which may be different from + * the color set by vte_terminal_set_color_background(). + * + * Note: you must only call this function while handling the + * GtkWidget::draw signal. + * + * This function is rarely useful. One use for it is if you disable + * drawing the background (see vte_terminal_set_clear_background()) + * and then need to draw the background yourself. + * + * Since: 0.54 + */ +void +vte_terminal_get_color_background_for_draw(VteTerminal* terminal, + GdkRGBA* color) +{ + g_return_if_fail(VTE_IS_TERMINAL(terminal)); + g_return_if_fail(color != nullptr); + + auto impl = IMPL(terminal); + auto const c = impl->get_color(VTE_DEFAULT_BG); + color->red = c->red / 65535.; + color->green = c->green / 65535.; + color->blue = c->blue / 65535.; + color->alpha = impl->m_background_alpha; +} diff -Nru vte2.91-0.52.2/src/vteinternal.hh vte2.91-0.54.0/src/vteinternal.hh --- vte2.91-0.52.2/src/vteinternal.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vteinternal.hh 2018-09-02 13:20:15.000000000 +0000 @@ -22,15 +22,27 @@ #include "vtedefines.hh" #include "vtetypes.hh" +#include "vtedraw.hh" #include "reaper.hh" -#include "ring.h" -#include "vteconv.h" +#include "ring.hh" #include "buffer.h" -#include "matcher.hh" +#include "parser.hh" +#include "parser-glue.hh" +#include "modes.hh" +#include "tabstops.hh" +#include "refptr.hh" #include "vtepcre2.h" #include "vteregexinternal.hh" +#include "chunk.hh" +#include "utf8.hh" + +#include +#include +#include +#include + typedef enum { VTE_REGEX_CURSOR_GDKCURSOR, VTE_REGEX_CURSOR_GDKCURSORTYPE, @@ -47,6 +59,69 @@ MOUSE_TRACKING_ALL_MOTION_TRACKING } MouseTrackingMode; +enum { + VTE_XTERM_WM_RESTORE_WINDOW = 1, + VTE_XTERM_WM_MINIMIZE_WINDOW = 2, + VTE_XTERM_WM_SET_WINDOW_POSITION = 3, + VTE_XTERM_WM_SET_WINDOW_SIZE_PIXELS = 4, + VTE_XTERM_WM_RAISE_WINDOW = 5, + VTE_XTERM_WM_LOWER_WINDOW = 6, + VTE_XTERM_WM_REFRESH_WINDOW = 7, + VTE_XTERM_WM_SET_WINDOW_SIZE_CELLS = 8, + VTE_XTERM_WM_MAXIMIZE_WINDOW = 9, + VTE_XTERM_WM_FULLSCREEN_WINDOW = 10, + VTE_XTERM_WM_GET_WINDOW_STATE = 11, + VTE_XTERM_WM_GET_WINDOW_POSITION = 13, + VTE_XTERM_WM_GET_WINDOW_SIZE_PIXELS = 14, + VTE_XTERM_WM_GET_WINDOW_SIZE_CELLS = 18, + VTE_XTERM_WM_GET_SCREEN_SIZE_CELLS = 19, + VTE_XTERM_WM_GET_ICON_TITLE = 20, + VTE_XTERM_WM_GET_WINDOW_TITLE = 21, + VTE_XTERM_WM_TITLE_STACK_PUSH = 22, + VTE_XTERM_WM_TITLE_STACK_POP = 23, +}; + +enum { + VTE_SGR_SET_BOLD = 1, + VTE_SGR_SET_DIM = 2, + VTE_SGR_SET_ITALIC = 3, + VTE_SGR_SET_UNDERLINE = 4, + VTE_SGR_SET_BLINK = 5, + VTE_SGR_SET_REVERSE = 7, + VTE_SGR_SET_INVISIBLE = 8, + VTE_SGR_SET_STRIKETHROUGH = 9, + VTE_SGR_SET_UNDERLINE_DOUBLE = 21, + VTE_SGR_SET_FORE_LEGACY_START = 30, + VTE_SGR_SET_FORE_LEGACY_END = 37, + VTE_SGR_SET_FORE_SPEC = 38, + VTE_SGR_SET_BACK_LEGACY_START = 40, + VTE_SGR_SET_BACK_LEGACY_END = 47, + VTE_SGR_SET_BACK_SPEC = 48, + VTE_SGR_SET_OVERLINE = 53, + VTE_SGR_SET_DECO_SPEC = 58, + VTE_SGR_SET_FORE_LEGACY_BRIGHT_START = 90, + VTE_SGR_SET_FORE_LEGACY_BRIGHT_END = 97, + VTE_SGR_SET_BACK_LEGACY_BRIGHT_START = 100, + VTE_SGR_SET_BACK_LEGACY_BRIGHT_END = 107, + VTE_SGR_RESET_ALL = 0, + VTE_SGR_RESET_BOLD_AND_DIM = 22, + VTE_SGR_RESET_ITALIC = 23, + VTE_SGR_RESET_UNDERLINE = 24, + VTE_SGR_RESET_BLINK = 25, + VTE_SGR_RESET_REVERSE = 27, + VTE_SGR_RESET_INVISIBLE = 28, + VTE_SGR_RESET_STRIKETHROUGH = 29, + VTE_SGR_RESET_FORE = 39, + VTE_SGR_RESET_BACK = 49, + VTE_SGR_RESET_OVERLINE = 55, + VTE_SGR_RESET_DECO = 59, +}; + +enum { + VTE_SGR_COLOR_SPEC_RGB = 2, + VTE_SGR_COLOR_SPEC_LEGACY = 5 +}; + struct vte_regex_and_flags { VteRegex *regex; guint32 match_flags; @@ -70,13 +145,6 @@ VTE_CHARACTER_REPLACEMENT_BRITISH } VteCharacterReplacement; -/* The terminal's keypad/cursor state. A terminal can either be using the - * normal keypad, or the "application" keypad. */ -typedef enum _VteKeymode { - VTE_KEYMODE_NORMAL, - VTE_KEYMODE_APPLICATION -} VteKeymode; - typedef struct _VtePaletteColor { struct { vte::color::rgb color; @@ -107,29 +175,28 @@ VTE_CURSOR_STYLE_STEADY_IBEAM = 6 } VteCursorStyle; -typedef struct _vte_incoming_chunk _vte_incoming_chunk_t; -struct _vte_incoming_chunk{ - _vte_incoming_chunk_t *next; - guint len; - guchar dataminusone; /* Hack: Keep it right before data, so that data[-1] is valid and usable */ - guchar data[VTE_INPUT_CHUNK_SIZE - 2 * sizeof(void *) - 1]; -}; +struct VteScreen { +public: + VteScreen(gulong max_rows, + bool has_streams) : + m_ring{max_rows, has_streams}, + row_data(&m_ring), + cursor{0,0} + { + } -typedef struct _VteScreen VteScreen; -struct _VteScreen { - VteRing row_data[1]; /* buffer contents */ + vte::base::Ring m_ring; /* buffer contents */ + VteRing* row_data; VteVisualPosition cursor; /* absolute value, from the beginning of the terminal history */ - double scroll_delta; /* scroll offset */ - long insert_delta; /* insertion offset */ + double scroll_delta{0.0}; /* scroll offset */ + long insert_delta{0}; /* insertion offset */ /* Stuff saved along with the cursor */ struct { VteVisualPosition cursor; /* onscreen coordinate, that is, relative to insert_delta */ - gboolean reverse_mode; - gboolean origin_mode; - gboolean sendrecv_mode; - gboolean insert_mode; - gboolean linefeed_mode; + uint8_t modes_ecma; + bool reverse_mode; + bool origin_mode; VteCell defaults; VteCell color_defaults; VteCell fill_defaults; @@ -258,141 +325,34 @@ }; namespace vte { -namespace parser { - -struct Params { - - typedef long number; - - char* ucs4_to_utf8(gunichar const* str) const; - - void print() const; - - inline unsigned int size() const - { - return G_LIKELY(m_values != nullptr) ? m_values->n_values : 0; - } - - inline GValue* value_at_unchecked(unsigned int position) const - { - return g_value_array_get_nth(m_values, position); - } - - inline bool has_number_at_unchecked(unsigned int position) const - { - return G_UNLIKELY(G_VALUE_HOLDS_LONG(value_at_unchecked(position))); - } - - inline bool number_at_unchecked(unsigned int position, number& v) const - { - auto value = value_at_unchecked(position); - if (G_UNLIKELY(!G_VALUE_HOLDS(value, G_TYPE_LONG))) - return false; - - v = g_value_get_long(value); - return true; - } - - inline bool number_at(unsigned int position, number& v) const - { - if (G_UNLIKELY(position >= size())) - return false; - return number_at_unchecked(position, v); - } - - inline number number_or_default_at_unchecked(unsigned int position, number default_v = 0) const - { - number v; - if (G_UNLIKELY(!number_at_unchecked(position, v))) - v = default_v; - return v; - } - - - inline number number_or_default_at(unsigned int position, number default_v = 0) const - { - number v; - if (G_UNLIKELY(!number_at(position, v))) - v = default_v; - return v; - } - - inline bool string_at_unchecked(unsigned int position, char*& str) const - { - auto value = value_at_unchecked(position); - if (G_LIKELY(G_VALUE_HOLDS_POINTER(value))) { - str = ucs4_to_utf8((gunichar const*)g_value_get_pointer (value)); - return str != nullptr; - } - if (G_VALUE_HOLDS_STRING(value)) { - /* Copy the string into the buffer. */ - str = g_value_dup_string(value); - return str != nullptr; - } - if (G_VALUE_HOLDS_LONG(value)) { - /* Convert the long to a string. */ - str = g_strdup_printf("%ld", g_value_get_long(value)); - return true; - } - return false; - } - - inline bool string_at(unsigned int position, char*& str) const - { - if (G_UNLIKELY(position >= size())) - return false; - - return string_at_unchecked(position, str); - - } - - inline bool has_subparams_at_unchecked(unsigned int position) const - { - return G_UNLIKELY(G_VALUE_HOLDS_BOXED(value_at_unchecked(position))); - } - - inline Params subparams_at_unchecked(unsigned int position) const - { - return {(GValueArray*)g_value_get_boxed(value_at_unchecked(position))}; - } - - inline void recycle(struct _vte_matcher *matcher) - { - if (G_LIKELY(m_values != nullptr)) - _vte_matcher_free_params_array(matcher, m_values); - } - - GValueArray *m_values; -}; - -} // namespace parser -} // namespace vte +namespace platform { +class Widget; +} +namespace terminal { -/* Terminal private data. */ -class VteTerminalPrivate { +class Terminal { public: - VteTerminalPrivate(VteTerminal *t); - ~VteTerminalPrivate(); + Terminal(vte::platform::Widget* w, + VteTerminal *t); + ~Terminal(); public: + vte::platform::Widget* m_real_widget; VteTerminal *m_terminal; GtkWidget *m_widget; - /* Event window */ - GdkWindow *m_event_window; - /* Metric and sizing data: dimensions of the window */ - vte::grid::row_t m_row_count; - vte::grid::column_t m_column_count; + vte::grid::row_t m_row_count{VTE_ROWS}; + vte::grid::column_t m_column_count{VTE_COLUMNS}; + + vte::terminal::Tabstops m_tabstops{}; + + vte::parser::Parser m_parser; /* control sequence state machine */ - /* Emulation setup data. */ - struct _vte_matcher *m_matcher; /* control sequence matcher */ - gboolean m_autowrap; /* auto wraparound at right margin */ - int m_keypad_mode, m_cursor_mode; /* these would be VteKeymodes, but we - need to guarantee its type */ - GHashTable *m_dec_saved; + vte::terminal::modes::ECMA m_modes_ecma{}; + vte::terminal::modes::Private m_modes_private{}; /* PTY handling data. */ VtePty *m_pty; @@ -400,15 +360,18 @@ guint m_pty_input_source; guint m_pty_output_source; gboolean m_pty_input_active; - GPid m_pty_pid; /* pid of child process */ + pid_t m_pty_pid{-1}; /* pid of child process */ VteReaper *m_reaper; - /* Input data queues. */ + /* Queue of chunks of data read from the PTY. + * Chunks are inserted at the back, and processed from the front. + */ + std::queue> m_incoming_queue; + + vte::base::UTF8Decoder m_utf8_decoder; + bool m_using_utf8{true}; const char *m_encoding; /* the pty's encoding */ int m_utf8_ambiguous_width; - struct _vte_iso2022_state *m_iso2022; - _vte_incoming_chunk_t *m_incoming; /* pending bytestream */ - GArray *m_pending; /* pending characters */ gunichar m_last_graphic_character; /* for REP */ /* Array of dirty rectangles in view coordinates; need to * add allocation origin and padding when passing to gtk. @@ -420,26 +383,28 @@ */ GList *m_active_terminals_link; // FIXMEchpe should these two be g[s]size ? - glong m_input_bytes; + size_t m_input_bytes; glong m_max_input_bytes; /* Output data queue. */ VteByteArray *m_outgoing; /* pending input characters */ - VteConv m_outgoing_conv; - /* IConv buffer. */ +#ifdef WITH_ICONV + /* Legacy charset support */ + GIConv m_incoming_conv{GIConv(-1)}; + VteByteArray* m_incoming_leftover; + GIConv m_outgoing_conv{GIConv(-1)}; VteByteArray *m_conv_buffer; + void convert_incoming() noexcept; +#endif + /* Screen data. We support the normal screen, and an alternate * screen, which seems to be a DEC-specific feature. */ - struct _VteScreen m_normal_screen, m_alternate_screen, *m_screen; + VteScreen m_normal_screen; + VteScreen m_alternate_screen; + VteScreen *m_screen; /* points to either m_normal_screen or m_alternate_screen */ - /* Values we save along with the cursor */ - gboolean m_reverse_mode; /* reverse mode */ - gboolean m_origin_mode; /* origin mode */ - gboolean m_sendrecv_mode; /* sendrecv mode */ - gboolean m_insert_mode; /* insert mode */ - gboolean m_linefeed_mode; /* linefeed mode */ VteCell m_defaults; /* default characteristics for insertion of any new characters */ @@ -454,9 +419,8 @@ VteCharacterReplacement *m_character_replacement; /* pointer to the active one */ /* Word chars */ - char *m_word_char_exceptions_string; - gunichar *m_word_char_exceptions; - gsize m_word_char_exceptions_len; + std::string m_word_char_exceptions_string; + std::u32string m_word_char_exceptions; /* Selection information. */ gboolean m_has_selection; @@ -477,27 +441,22 @@ GString *m_selection[LAST_VTE_SELECTION]; GtkClipboard *m_clipboard[LAST_VTE_SELECTION]; - ClipboardTextRequestGtk m_paste_request; + ClipboardTextRequestGtk m_paste_request; /* Miscellaneous options. */ VteEraseBinding m_backspace_binding; VteEraseBinding m_delete_binding; - gboolean m_meta_sends_escape; gboolean m_audible_bell; gboolean m_allow_bold; gboolean m_bold_is_bright; - gboolean m_deccolm_mode; /* DECCOLM allowed */ - GHashTable *m_tabstops; gboolean m_text_modified_flag; gboolean m_text_inserted_flag; gboolean m_text_deleted_flag; gboolean m_rewrap_on_resize; - gboolean m_bracketed_paste_mode; /* Scrolling options. */ gboolean m_scroll_on_output; gboolean m_scroll_on_keystroke; - gboolean m_alternate_screen_scroll; vte::grid::row_t m_scrollback_lines; /* Restricted scrolling */ @@ -516,7 +475,6 @@ gint m_cursor_blink_timeout; /* gtk-cursor-blink-timeout */ gboolean m_cursor_blinks; /* whether the cursor is actually blinking */ gint64 m_cursor_blink_time; /* how long the cursor has been blinking yet */ - gboolean m_cursor_visible; gboolean m_has_focus; /* is the terminal window focused */ /* Contents blinking */ @@ -534,8 +492,7 @@ gboolean m_input_enabled; time_t m_last_keypress_time; - int m_mouse_tracking_mode; /* this is of type MouseTrackingMode, - but we need to guarantee its type. */ + MouseTrackingMode m_mouse_tracking_mode{MOUSE_TRACKING_NONE}; guint m_mouse_pressed_buttons; /* bits 0, 1, 2 resp. for buttons 1, 2, 3 */ guint m_mouse_handled_buttons; /* similar bitmap for buttons we handled ourselves */ /* The last known position the mouse pointer from an event. We don't store @@ -544,11 +501,7 @@ */ vte::view::coords m_mouse_last_position; guint m_mouse_autoscroll_tag; - gboolean m_mouse_xterm_extension; - gboolean m_mouse_urxvt_extension; - double m_mouse_smooth_scroll_delta; - - gboolean m_focus_tracking_mode; + double m_mouse_smooth_scroll_delta{0.0}; /* State variables for handling match checks. */ char* m_match_contents; @@ -610,15 +563,10 @@ gboolean m_mouse_cursor_over_widget; /* as per enter and leave events */ gboolean m_mouse_autohide; /* the API setting */ gboolean m_mouse_cursor_autohidden; /* whether the autohiding logic wants to hide it; even if autohiding is disabled via API */ - GdkCursor* m_mouse_default_cursor; - GdkCursor* m_mouse_mousing_cursor; - GdkCursor* m_mouse_hyperlink_cursor; - GdkCursor* m_mouse_inviso_cursor; /* Input method support. */ - GtkIMContext *m_im_context; - gboolean m_im_preedit_active; - char *m_im_preedit; + bool m_im_preedit_active; + std::string m_im_preedit; PangoAttrList *m_im_preedit_attrs; int m_im_preedit_cursor; @@ -630,15 +578,17 @@ gboolean m_cursor_moved_pending; gboolean m_contents_changed_pending; - /* window name changes */ - char* m_window_title; - char* m_window_title_changed; - char* m_icon_title; - char* m_icon_title_changed; - char* m_current_directory_uri; - char* m_current_directory_uri_changed; - char* m_current_file_uri; - char* m_current_file_uri_changed; + std::string m_window_title{}; + std::string m_current_directory_uri{}; + std::string m_current_file_uri{}; + std::string m_window_title_pending{}; + std::string m_current_directory_uri_pending{}; + std::string m_current_file_uri_pending{}; + bool m_window_title_changed{false}; + bool m_current_directory_uri_changed{false}; + bool m_current_file_uri_changed{false}; + + std::vector m_window_title_stack{}; /* Background */ double m_background_alpha; @@ -677,7 +627,7 @@ /* Hyperlinks */ gboolean m_allow_hyperlink; - hyperlink_idx_t m_hyperlink_hover_idx; + vte::base::Ring::hyperlink_idx_t m_hyperlink_hover_idx; const char *m_hyperlink_hover_uri; /* data is owned by the ring */ long m_hyperlink_auto_id; @@ -717,7 +667,7 @@ void restore_cursor(VteScreen *screen__); void save_cursor(VteScreen *screen__); - bool insert_char(gunichar c, + void insert_char(gunichar c, bool insert, bool invalidate_now); @@ -768,7 +718,7 @@ m_allocated_rect.height - m_padding.top - m_padding.bottom); } - inline bool widget_realized() const { return gtk_widget_get_realized(m_widget); } + bool widget_realized() const noexcept; inline cairo_rectangle_int_t const& get_allocated_rect() const { return m_allocated_rect; } inline vte::view::coord_t get_allocated_width() const { return m_allocated_rect.width; } inline vte::view::coord_t get_allocated_height() const { return m_allocated_rect.height; } @@ -791,7 +741,6 @@ void confine_coordinates(long *xp, long *yp); - void widget_paste(GdkAtom board); void widget_copy(VteSelection sel, VteFormat format); @@ -804,13 +753,9 @@ void widget_set_hadjustment(GtkAdjustment *adjustment); void widget_set_vadjustment(GtkAdjustment *adjustment); - GdkCursor *widget_cursor_new(GdkCursorType cursor_type) const; - void widget_constructed(); void widget_realize(); void widget_unrealize(); - void widget_map(); - void widget_unmap(); void widget_style_updated(); void widget_focus_in(GdkEventFocus *event); void widget_focus_out(GdkEventFocus *event); @@ -823,14 +768,15 @@ void widget_scroll(GdkEventScroll *event); bool widget_motion_notify(GdkEventMotion *event); void widget_draw(cairo_t *cr); - void widget_screen_changed (GdkScreen *previous_screen); void widget_get_preferred_width(int *minimum_width, int *natural_width); void widget_get_preferred_height(int *minimum_height, int *natural_height); void widget_size_allocate(GtkAllocation *allocation); - void widget_settings_notify(); + void set_blink_settings(bool blink, + int blink_time, + int blink_timeout) noexcept; void expand_rectangle(cairo_rectangle_int_t& rect) const; void paint_area(GdkRectangle const* area); @@ -896,22 +842,23 @@ bool pty_io_write(GIOChannel *channel, GIOCondition condition); - void feed_chunks(struct _vte_incoming_chunk *chunks); void send_child(char const* data, gssize length, - bool local_echo, - bool newline_stuff); + bool local_echo) noexcept; void feed_child_using_modes(char const* data, gssize length); - void watch_child (GPid child_pid); - void child_watch_done(GPid pid, + void watch_child (pid_t child_pid); + bool terminate_child () noexcept; + void child_watch_done(pid_t pid, int status); void im_commit(char const* text); - void im_preedit_start(); - void im_preedit_end(); - void im_preedit_changed(); + void im_preedit_set_active(bool active) noexcept; + void im_preedit_reset() noexcept; + void im_preedit_changed(char const* str, + int cursorpos, + PangoAttrList* attrs) noexcept; bool im_retrieve_surrounding(); bool im_delete_surrounding(int offset, int n_chars); @@ -1098,12 +1045,7 @@ void emit_paste_clipboard(); void emit_hyperlink_hover_uri_changed(const GdkRectangle *bbox); - void clear_tabstop(int column); // FIXMEchpe vte::grid::column_t ? - bool get_tabstop(int column); - void set_tabstop(int column); - void set_default_tabstops(); - - void hyperlink_invalidate_and_get_bbox(hyperlink_idx_t idx, GdkRectangle *bbox); + void hyperlink_invalidate_and_get_bbox(vte::base::Ring::hyperlink_idx_t idx, GdkRectangle *bbox); void hyperlink_hilite_update(); void match_contents_clear(); @@ -1204,8 +1146,7 @@ long rows); bool process_word_char_exceptions(char const *str, - gunichar **arrayp, - gsize *lenp); + std::u32string& array) const noexcept; long get_cell_height() { ensure_font(); return m_cell_height; } long get_cell_width() { ensure_font(); return m_cell_width; } @@ -1266,10 +1207,6 @@ GCancellable *cancellable, GError **error); - /* Sequence handlers and their helper functions */ - void handle_sequence(char const* match, - vte::parser::Params const& params); - inline void ensure_cursor_is_onscreen(); inline void home_cursor(); inline void clear_screen(); @@ -1281,23 +1218,17 @@ inline void switch_alternate_screen(); inline void save_cursor(); inline void restore_cursor(); - inline void switch_normal_screen_and_restore_cursor(); - inline void save_cursor_and_switch_alternate_screen(); - void set_title_internal(vte::parser::Params const& params, - bool icon_title, - bool window_title); - inline void set_mode(vte::parser::Params const& params, - bool value); - inline void reset_mouse_smooth_scroll_delta(); - inline void enter_focus_tracking_mode(); - inline void decset(long setting, - bool restore, - bool save, - bool set); - inline void decset(vte::parser::Params const& params, - bool restore, - bool save, - bool set); + + inline void set_mode_ecma(vte::parser::Sequence const& seq, + bool set) noexcept; + inline void set_mode_private(vte::parser::Sequence const& seq, + bool set) noexcept; + inline void set_mode_private(int mode, + bool set) noexcept; + inline void save_mode_private(vte::parser::Sequence const& seq, + bool save) noexcept; + void update_mouse_protocol() noexcept; + inline void set_character_replacements(unsigned slot, VteCharacterReplacement replacement); inline void set_character_replacement(unsigned slot); @@ -1306,41 +1237,38 @@ inline void clear_to_eol(); inline void delete_character(); inline void set_cursor_column(vte::grid::column_t col); + inline void set_cursor_column1(vte::grid::column_t col); /* 1-based */ + inline int get_cursor_column() const noexcept { return CLAMP(m_screen->cursor.col, 0, m_column_count - 1); } + inline int get_cursor_column1() const noexcept { return get_cursor_column() + 1; } inline void set_cursor_row(vte::grid::row_t row /* relative to scrolling region */); + inline void set_cursor_row1(vte::grid::row_t row /* relative to scrolling region */); /* 1-based */ + inline int get_cursor_row() const noexcept { return CLAMP(m_screen->cursor.row, 0, m_row_count - 1); } + inline int get_cursor_row1() const noexcept { return get_cursor_row() + 1; } inline void set_cursor_coords(vte::grid::row_t row /* relative to scrolling region */, vte::grid::column_t column); - inline vte::grid::row_t get_cursor_row() const; - inline vte::grid::column_t get_cursor_column() const; - inline void reset_scrolling_region(); - inline void set_scrolling_region(vte::grid::row_t start /* relative */, - vte::grid::row_t end /* relative */); + inline void set_cursor_coords1(vte::grid::row_t row /* relative to scrolling region */, + vte::grid::column_t column); /* 1-based */ + inline vte::grid::row_t get_cursor_row_unclamped() const; + inline vte::grid::column_t get_cursor_column_unclamped() const; inline void move_cursor_up(vte::grid::row_t rows); inline void move_cursor_down(vte::grid::row_t rows); inline void erase_characters(long count); inline void insert_blank_character(); template - inline int32_t parse_sgr_38_48_parameters(vte::parser::Params const& params, - unsigned int *index, - bool might_contain_color_space_id); + inline bool seq_parse_sgr_color(vte::parser::Sequence const& seq, + unsigned int& idx, + uint32_t& color) const noexcept; inline void move_cursor_backward(vte::grid::column_t columns); inline void move_cursor_forward(vte::grid::column_t columns); - inline void move_cursor_tab(); - inline void change_color(vte::parser::Params const& params, - char const* terminator); + inline void move_cursor_tab_backward(int count = 1); + inline void move_cursor_tab_forward(int count = 1); inline void line_feed(); - inline void set_current_hyperlink(char* hyperlink_params /* adopted */, char* uri /* adopted */); - inline void set_keypad_mode(VteKeymode mode); - inline void erase_in_display(long param); - inline void erase_in_line(long param); + inline void erase_in_display(vte::parser::Sequence const& seq); + inline void erase_in_line(vte::parser::Sequence const& seq); inline void insert_lines(vte::grid::row_t param); inline void delete_lines(vte::grid::row_t param); - inline void change_special_color(vte::parser::Params const& params, - int index, - int index_fallback, - const char *osc, - char const *terminator); unsigned int checksum_area(vte::grid::row_t start_row, vte::grid::column_t start_col, @@ -1355,15 +1283,87 @@ void select_empty(vte::grid::column_t col, vte::grid::row_t row); -#define SEQUENCE_HANDLER(name) \ - inline void seq_ ## name (vte::parser::Params const& params); -#include "vteseq-list.hh" -#undef SEQUENCE_HANDLER + void send(vte::parser::u8SequenceBuilder const& builder, + bool c1 = true, + vte::parser::u8SequenceBuilder::Introducer introducer = vte::parser::u8SequenceBuilder::Introducer::DEFAULT, + vte::parser::u8SequenceBuilder::ST st = vte::parser::u8SequenceBuilder::ST::DEFAULT) noexcept; + void send(vte::parser::Sequence const& seq, + vte::parser::u8SequenceBuilder const& builder) noexcept; + void send(unsigned int type, + std::initializer_list params) noexcept; + void reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params) noexcept; + void reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + vte::parser::ReplyBuilder const& builder) noexcept; + #if 0 + void reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + std::string const& str) noexcept; + #endif + void reply(vte::parser::Sequence const& seq, + unsigned int type, + std::initializer_list params, + char const* format, + ...) noexcept G_GNUC_PRINTF(5, 6); + + /* OSC handler helpers */ + bool get_osc_color_index(int osc, + int value, + int& index) const noexcept; + void set_color_index(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int number, + int index, + int index_fallback, + int osc) noexcept; + + /* OSC handlers */ + void set_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int osc) noexcept; + void set_special_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int index, + int index_fallback, + int osc) noexcept; + void reset_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int osc) noexcept; + void set_current_directory_uri(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept; + void set_current_file_uri(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept; + void set_current_hyperlink(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept; + + /* Sequence handlers */ + bool m_line_wrapped; // signals line wrapped from character insertion + // Note: inlining the handlers seems to worsen the performance, so we don't do that +#define _VTE_CMD(cmd) \ + /* inline */ void cmd (vte::parser::Sequence const& seq); +#define _VTE_NOP(cmd) G_GNUC_UNUSED _VTE_CMD(cmd) +#include "parser-cmd.hh" +#undef _VTE_CMD +#undef _VTE_NOP }; +} // namespace terminal +} // namespace vte + extern GTimer *process_timer; -VteTerminalPrivate *_vte_terminal_get_impl(VteTerminal *terminal); +vte::terminal::Terminal* _vte_terminal_get_impl(VteTerminal *terminal); static inline bool _vte_double_equal(double a, @@ -1375,4 +1375,6 @@ #pragma GCC diagnostic pop } -extern bool g_test_mode; +#define VTE_TEST_FLAG_DECRQCRA (G_GUINT64_CONSTANT(1) << 0) + +extern uint64_t g_test_flags; diff -Nru vte2.91-0.52.2/src/vterowdata.cc vte2.91-0.54.0/src/vterowdata.cc --- vte2.91-0.52.2/src/vterowdata.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vterowdata.cc 2018-09-02 13:20:15.000000000 +0000 @@ -21,10 +21,20 @@ #include #include "debug.h" -#include "vterowdata.h" +#include "vterowdata.hh" #include +#include + +/* This will be true now that VteCell is POD, but make sure it'll be true + * once that changes. + */ +static_assert(std::is_trivially_copy_constructible::value, "VteCell is not copy constructible"); +static_assert(std::is_trivially_move_constructible::value, "VteCell is not move constructible"); +static_assert(std::is_trivially_copyable::value, "VteCell is not trivially copyable"); +static_assert(std::is_trivially_copy_assignable::value, "VteCell is not copy assignable"); +static_assert(std::is_trivially_move_assignable::value, "VteCell is not move assignable"); /* * VteCells: A row's cell array diff -Nru vte2.91-0.52.2/src/vterowdata.h vte2.91-0.54.0/src/vterowdata.h --- vte2.91-0.52.2/src/vterowdata.h 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vterowdata.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2002 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* The interfaces in this file are subject to change at any time. */ - -#ifndef vterowdata_h_included -#define vterowdata_h_included - -#include - -#include "vteunistr.h" -#include "vtemacros.h" -#include "vtedefines.hh" - -#include "attr.hh" -#include "color-triple.hh" - -G_BEGIN_DECLS - -#define VTE_TAB_WIDTH_MAX ((1 << VTE_ATTR_COLUMNS_BITS) - 1) - -#define VTE_CELL_ATTR_COMMON_BYTES 12 /* The number of common bytes in VteCellAttr and VteStreamCellAttr */ - -/* - * VteCellAttr: A single cell style attributes - * - * When adding new attributes, keep in sync with VteStreamCellAttr and - * update VTE_CELL_ATTR_COMMON_BYTES accordingly. - * Also don't forget to update basic_cell below! - */ - -#define CELL_ATTR_BOOL(lname,uname) \ - inline void set_##lname(bool value) \ - { \ - vte_attr_set_bool(&attr, VTE_ATTR_##uname##_MASK, value); \ - } \ - \ - inline constexpr bool lname() const \ - { \ - return vte_attr_get_bool(attr, VTE_ATTR_##uname##_SHIFT); \ - } - -#define CELL_ATTR_UINT(lname,uname) \ - inline void set_##lname(unsigned int value) \ - { \ - vte_attr_set_value(&attr, VTE_ATTR_##uname##_MASK, VTE_ATTR_##uname##_SHIFT, value); \ - } \ - \ - inline constexpr uint32_t lname() const \ - { \ - return vte_attr_get_value(attr, VTE_ATTR_##uname##_VALUE_MASK, VTE_ATTR_##uname##_SHIFT); \ - } - -typedef struct _VTE_GNUC_PACKED VteCellAttr { - uint32_t attr; - - /* 4-byte boundary (8-byte boundary in VteCell) */ - uint64_t m_colors; /* fore, back and deco (underline) colour */ - - /* 12-byte boundary (16-byte boundary in VteCell) */ - uint32_t hyperlink_idx; /* a unique hyperlink index at a time for the ring's cells, - 0 means not a hyperlink, VTE_HYPERLINK_IDX_TARGET_IN_STREAM - means the target is irrelevant/unknown at the moment. - If bitpacking, choose a size big enough to hold a different idx - for every cell in the ring but not yet in the stream - (currently the height rounded up to the next power of two, times width) - for supported VTE sizes, and update VTE_HYPERLINK_IDX_TARGET_IN_STREAM. */ - - /* Methods */ - - inline constexpr uint64_t colors() const { return m_colors; } - - inline void copy_colors(VteCellAttr const& other) - { - m_colors = vte_color_triple_copy(other.colors()); - } - -#define CELL_ATTR_COLOR(name) \ - inline void set_##name(uint32_t value) \ - { \ - vte_color_triple_set_##name(&m_colors, value); \ - } \ - \ - inline constexpr uint32_t name() const \ - { \ - return vte_color_triple_get_##name(m_colors); \ - } - - CELL_ATTR_COLOR(fore) - CELL_ATTR_COLOR(back) - CELL_ATTR_COLOR(deco) -#undef CELL_ATTR_COLOR - - inline constexpr bool has_any(uint32_t mask) const - { - return !!(attr & mask); - } - - inline constexpr bool has_all(uint32_t mask) const - { - return (attr & mask) == mask; - } - - inline constexpr bool has_none(uint32_t mask) const - { - return !(attr & mask); - } - - inline void unset(uint32_t mask) - { - attr &= ~mask; - } - - CELL_ATTR_UINT(columns, COLUMNS) - CELL_ATTR_BOOL(fragment, FRAGMENT) - CELL_ATTR_BOOL(bold, BOLD) - CELL_ATTR_BOOL(italic, ITALIC) - CELL_ATTR_UINT(underline, UNDERLINE) - CELL_ATTR_BOOL(strikethrough, STRIKETHROUGH) - CELL_ATTR_BOOL(overline, OVERLINE) - CELL_ATTR_BOOL(reverse, REVERSE) - CELL_ATTR_BOOL(blink, BLINK) - CELL_ATTR_BOOL(dim, DIM) - CELL_ATTR_BOOL(invisible, INVISIBLE) - /* ATTR_BOOL(boxed, BOXED) */ -} VteCellAttr; -G_STATIC_ASSERT (sizeof (VteCellAttr) == 16); -G_STATIC_ASSERT (offsetof (VteCellAttr, hyperlink_idx) == VTE_CELL_ATTR_COMMON_BYTES); - -/* - * VteStreamCellAttr: Variant of VteCellAttr to be stored in attr_stream. - * - * When adding new attributes, keep in sync with VteCellAttr and - * update VTE_CELL_ATTR_COMMON_BYTES accordingly. - */ - -typedef struct _VTE_GNUC_PACKED _VteStreamCellAttr { - uint32_t attr; /* Same as VteCellAttr. We only access columns - * and fragment, however. - */ - /* 4-byte boundary */ - uint64_t colors; - /* 12-byte boundary */ - guint16 hyperlink_length; /* make sure it fits VTE_HYPERLINK_TOTAL_LENGTH_MAX */ - - /* Methods */ - CELL_ATTR_UINT(columns, COLUMNS) - CELL_ATTR_BOOL(fragment, FRAGMENT) -} VteStreamCellAttr; -G_STATIC_ASSERT (sizeof (VteStreamCellAttr) == 14); -G_STATIC_ASSERT (offsetof (VteStreamCellAttr, hyperlink_length) == VTE_CELL_ATTR_COMMON_BYTES); - -#undef CELL_ATTR_BOOL -#undef CELL_ATTR_UINT - -/* - * VteCell: A single cell's data - */ - -typedef struct _VTE_GNUC_PACKED _VteCell { - vteunistr c; - VteCellAttr attr; -} VteCell; -G_STATIC_ASSERT (sizeof (VteCell) == 20); - -static const VteCell basic_cell = { - 0, - { - VTE_ATTR_DEFAULT, /* attr */ - VTE_COLOR_TRIPLE_INIT_DEFAULT, /* colors */ - 0, /* hyperlink_idx */ - } -}; - - -/* - * VteRowAttr: A single row's attributes - */ - -typedef struct _VteRowAttr { - guint8 soft_wrapped: 1; -} VteRowAttr; -G_STATIC_ASSERT (sizeof (VteRowAttr) == 1); - -/* - * VteRowData: A single row's data - */ - -typedef struct _VteRowData { - VteCell *cells; - guint16 len; - VteRowAttr attr; -} VteRowData; - - -#define _vte_row_data_length(__row) ((__row)->len + 0) - -static inline const VteCell * -_vte_row_data_get (const VteRowData *row, gulong col) -{ - if (G_UNLIKELY (row->len <= col)) - return NULL; - - return &row->cells[col]; -} - -static inline VteCell * -_vte_row_data_get_writable (VteRowData *row, gulong col) -{ - if (G_UNLIKELY (row->len <= col)) - return NULL; - - return &row->cells[col]; -} - -/* - * Copy the common attributes from VteCellAttr to VteStreamCellAttr or vice versa. - */ -static inline void -_attrcpy (void *dst, void *src) -{ - memcpy(dst, src, VTE_CELL_ATTR_COMMON_BYTES); -} - -void _vte_row_data_init (VteRowData *row); -void _vte_row_data_clear (VteRowData *row); -void _vte_row_data_fini (VteRowData *row); -void _vte_row_data_insert (VteRowData *row, gulong col, const VteCell *cell); -void _vte_row_data_append (VteRowData *row, const VteCell *cell); -void _vte_row_data_remove (VteRowData *row, gulong col); -void _vte_row_data_fill (VteRowData *row, const VteCell *cell, gulong len); -void _vte_row_data_shrink (VteRowData *row, gulong max_len); - - -G_END_DECLS - -#endif diff -Nru vte2.91-0.52.2/src/vterowdata.hh vte2.91-0.54.0/src/vterowdata.hh --- vte2.91-0.52.2/src/vterowdata.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/vterowdata.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2002 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* The interfaces in this file are subject to change at any time. */ + +#pragma once + +#include + +#include "vteunistr.h" +#include "vtemacros.h" +#include "vtedefines.hh" + +#include "attr.hh" +#include "cell.hh" + +G_BEGIN_DECLS + +/* + * VteRowAttr: A single row's attributes + */ + +typedef struct _VteRowAttr { + guint8 soft_wrapped: 1; +} VteRowAttr; +static_assert(sizeof (VteRowAttr) == 1, "VteRowAttr has wrong size"); + +/* + * VteRowData: A single row's data + */ + +typedef struct _VteRowData { + VteCell *cells; + guint16 len; + VteRowAttr attr; +} VteRowData; + + +#define _vte_row_data_length(__row) ((__row)->len + 0) + +static inline const VteCell * +_vte_row_data_get (const VteRowData *row, gulong col) +{ + if (G_UNLIKELY (row->len <= col)) + return NULL; + + return &row->cells[col]; +} + +static inline VteCell * +_vte_row_data_get_writable (VteRowData *row, gulong col) +{ + if (G_UNLIKELY (row->len <= col)) + return NULL; + + return &row->cells[col]; +} + +void _vte_row_data_init (VteRowData *row); +void _vte_row_data_clear (VteRowData *row); +void _vte_row_data_fini (VteRowData *row); +void _vte_row_data_insert (VteRowData *row, gulong col, const VteCell *cell); +void _vte_row_data_append (VteRowData *row, const VteCell *cell); +void _vte_row_data_remove (VteRowData *row, gulong col); +void _vte_row_data_fill (VteRowData *row, const VteCell *cell, gulong len); +void _vte_row_data_shrink (VteRowData *row, gulong max_len); + +G_END_DECLS diff -Nru vte2.91-0.52.2/src/vteseq.cc vte2.91-0.54.0/src/vteseq.cc --- vte2.91-0.52.2/src/vteseq.cc 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vteseq.cc 2018-09-02 13:20:15.000000000 +0000 @@ -1,10 +1,12 @@ /* - * Copyright (C) 2001-2004 Red Hat, Inc. + * Copyright © 2001-2004 Red Hat, Inc. + * Copyright © 2015 David Herrmann + * Copyright © 2008-2018 Christian Persch * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,44 +33,101 @@ #include #include "vteinternal.hh" #include "vtegtk.hh" -#include "vteutils.h" /* for strchrnul on non-GNU systems */ #include "caps.hh" #include "debug.h" -#define BEL "\007" -#define ST _VTE_CAP_ST +#define BEL_C0 "\007" +#define ST_C0 _VTE_CAP_ST #include +using namespace std::literals; + void -vte::parser::Params::print() const +vte::parser::Sequence::print() const noexcept { #ifdef VTE_DEBUG - g_printerr("("); - auto n_params = size(); - for (unsigned int i = 0; i < n_params; i++) { - auto value = value_at_unchecked(i); - if (i > 0) { - g_printerr(", "); - } - if (G_VALUE_HOLDS_LONG(value)) { - auto l = g_value_get_long(value); - g_printerr("LONG(%ld)", l); - } else if (G_VALUE_HOLDS_STRING(value)) { - auto const s = g_value_get_string(value); - g_printerr("STRING(\"%s\")", s); - } else if (G_VALUE_HOLDS_POINTER(value)) { - auto w = (const gunichar *)g_value_get_pointer(value); - g_printerr("WSTRING(\"%ls\")", (const wchar_t*) w); - } else if (G_VALUE_HOLDS_BOXED(value)) { - vte::parser::Params subparams{(GValueArray*)g_value_get_boxed(value)}; - subparams.print(); + auto c = m_seq != nullptr ? terminator() : 0; + char c_buf[7]; + g_snprintf(c_buf, sizeof(c_buf), "%lc", c); + g_printerr("%s:%s [%s]", type_string(), command_string(), + g_unichar_isprint(c) ? c_buf : _vte_debug_sequence_to_string(c_buf, -1)); + if (m_seq != nullptr && m_seq->n_args > 0) { + g_printerr("[ "); + for (unsigned int i = 0; i < m_seq->n_args; i++) { + if (i > 0) + g_print(", "); + g_printerr("%d", vte_seq_arg_value(m_seq->args[i])); } - } - g_printerr(")\n"); + g_printerr(" ]"); + } + if (m_seq->type == VTE_SEQ_OSC) { + char* str = string_param(); + g_printerr(" \"%s\"", str); + g_free(str); + } + g_printerr("\n"); #endif } +char const* +vte::parser::Sequence::type_string() const +{ + if (G_UNLIKELY(m_seq == nullptr)) + return "(nil)"; + + switch (type()) { + case VTE_SEQ_NONE: return "NONE"; + case VTE_SEQ_IGNORE: return "IGNORE"; + case VTE_SEQ_GRAPHIC: return "GRAPHIC"; + case VTE_SEQ_CONTROL: return "CONTROL"; + case VTE_SEQ_ESCAPE: return "ESCAPE"; + case VTE_SEQ_CSI: return "CSI"; + case VTE_SEQ_DCS: return "DCS"; + case VTE_SEQ_OSC: return "OSC"; + default: + g_assert(false); + return nullptr; + } +} + +char const* +vte::parser::Sequence::command_string() const +{ + if (G_UNLIKELY(m_seq == nullptr)) + return "(nil)"; + + switch (command()) { +#define _VTE_CMD(cmd) case VTE_CMD_##cmd: return #cmd; +#define _VTE_NOP(cmd) +#include "parser-cmd.hh" +#undef _VTE_CMD +#undef _VTE_NOP + default: + static char buf[32]; + snprintf(buf, sizeof(buf), "NOP OR UNKOWN(%u)", command()); + return buf; + } +} + +// FIXMEchpe optimise this +std::string +vte::parser::Sequence::string_utf8() const noexcept +{ + std::string str; + + size_t len; + auto buf = vte_seq_string_get(&m_seq->arg_str, &len); + + char u[6]; + for (size_t i = 0; i < len; ++i) { + auto ulen = g_unichar_to_utf8(buf[i], u); + str.append((char const*)u, ulen); + } + + return str; +} + /* A couple are duplicated from vte.c, to keep them static... */ /* Check how long a string of unichars is. Slow version. */ @@ -85,9 +144,11 @@ * length instead of walking the input twice. */ char* -vte::parser::Params::ucs4_to_utf8(gunichar const* str) const +vte::parser::Sequence::ucs4_to_utf8(gunichar const* str, + ssize_t len) const noexcept { - auto len = vte_unichar_strlen(str); + if (len < 0) + len = vte_unichar_strlen(str); auto outlen = (len * VTE_UTF8_BPC) + 1; auto result = (char*)g_try_malloc(outlen); @@ -103,18 +164,20 @@ return result; } +namespace vte { +namespace terminal { + /* Emit a "bell" signal. */ void -VteTerminalPrivate::emit_bell() +Terminal::emit_bell() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `bell'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_BELL], 0); } - /* Emit a "deiconify-window" signal. */ void -VteTerminalPrivate::emit_deiconify_window() +Terminal::emit_deiconify_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `deiconify-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_DEICONIFY_WINDOW], 0); @@ -122,7 +185,7 @@ /* Emit a "iconify-window" signal. */ void -VteTerminalPrivate::emit_iconify_window() +Terminal::emit_iconify_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `iconify-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_ICONIFY_WINDOW], 0); @@ -130,7 +193,7 @@ /* Emit a "raise-window" signal. */ void -VteTerminalPrivate::emit_raise_window() +Terminal::emit_raise_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `raise-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_RAISE_WINDOW], 0); @@ -138,7 +201,7 @@ /* Emit a "lower-window" signal. */ void -VteTerminalPrivate::emit_lower_window() +Terminal::emit_lower_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `lower-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_LOWER_WINDOW], 0); @@ -146,7 +209,7 @@ /* Emit a "maximize-window" signal. */ void -VteTerminalPrivate::emit_maximize_window() +Terminal::emit_maximize_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `maximize-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_MAXIMIZE_WINDOW], 0); @@ -154,7 +217,7 @@ /* Emit a "refresh-window" signal. */ void -VteTerminalPrivate::emit_refresh_window() +Terminal::emit_refresh_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `refresh-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_REFRESH_WINDOW], 0); @@ -162,7 +225,7 @@ /* Emit a "restore-window" signal. */ void -VteTerminalPrivate::emit_restore_window() +Terminal::emit_restore_window() { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `restore-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_RESTORE_WINDOW], 0); @@ -170,7 +233,7 @@ /* Emit a "move-window" signal. (Pixels.) */ void -VteTerminalPrivate::emit_move_window(guint x, +Terminal::emit_move_window(guint x, guint y) { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `move-window'.\n"); @@ -179,105 +242,15 @@ /* Emit a "resize-window" signal. (Grid size.) */ void -VteTerminalPrivate::emit_resize_window(guint columns, +Terminal::emit_resize_window(guint columns, guint rows) { _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `resize-window'.\n"); g_signal_emit(m_terminal, signals[SIGNAL_RESIZE_WINDOW], 0, columns, rows); } - /* Some common functions */ -void -VteTerminalPrivate::seq_checksum_rectangular_area(vte::parser::Params const& params) -{ - /* - * DECRQCRA - request checksum of rectangular area - * Computes a simple checksum of the characters in the rectangular - * area. args[0] is an identifier, which the response must use. - * args[1] is the page number; if it's 0 or default then the - * checksum is computed over all pages; if it's greater than the - * number of pages, then the checksum is computed only over the - * last page. args[2]..args[5] describe the area to compute the - * checksum from, denoting the top, left, bottom, right, resp - * (1-based). It's required that top ≤ bottom, and left ≤ right. - * These coordinates are interpreted according to origin mode. - * - * NOTE: Since this effectively allows to read the screen - * (by using a 1x1 rectangle on each cell), we normally only - * send a dummy reply, and only reply with the actual checksum - * when in test mode. - * - * Defaults: - * args[0]: no default - * args[1]: 0 - * args[2]: 1 - * args[3]: no default (?) - * args[4]: height of current page - * args[5]: width of current page - * - * Reply: DECCKSR - * @args[0]: the identifier from the request - * DATA: the checksum as a 4-digit hex number - * - * References: VT525 - * XTERM - */ - - char buf[32]; - gsize len; - - int id = params.number_or_default_at(0, 0); - -#ifndef VTE_DEBUG - /* Send a dummy reply */ - len = g_snprintf(buf, sizeof(buf), "\eP%d!~%04X\e\\", id, 0); - feed_child(buf, len); -#else - - /* Not in test mode? Send a dummy reply */ - if (!g_test_mode) { - len = g_snprintf(buf, sizeof(buf), "\eP%d!~%04X\e\\", id, 0); - feed_child(buf, len); - return; - } - - /* We only support 1 'page', so ignore args[1] */ - - int top = params.number_or_default_at(2, 1); - int left = params.number_or_default_at(3, 1); /* use 1 as default here */ - int bottom = params.number_or_default_at(4, m_row_count); - int right = params.number_or_default_at(5, m_column_count); - - top = CLAMP(top, 1, m_row_count); - left = CLAMP(left, 1, m_column_count); - bottom = CLAMP(bottom, 1, m_row_count); - right = CLAMP (right, 1, m_column_count); - - if (m_origin_mode && - m_scrolling_restricted) { - top += m_scrolling_region.start; - - bottom += m_scrolling_region.start; - bottom = MIN(bottom, m_scrolling_region.end); - - } - - unsigned int checksum; - if (bottom < top || right < left) - checksum = 0; /* empty area */ - else - checksum = checksum_area(top -1 + m_screen->insert_delta, - left - 1, - bottom - 1 + m_screen->insert_delta, - right - 1); - - len = g_snprintf(buf, sizeof(buf), "\eP%d!~%04X\e\\", id, checksum); - feed_child(buf, len); -#endif /* VTE_DEBUG */ -} - /* In Xterm, upon printing a character in the last column the cursor doesn't * advance. It's special cased that printing the following letter will first * wrap to the next row. @@ -294,20 +267,20 @@ * sequences that disable the special cased mode in xterm). (Bug 731155.) */ void -VteTerminalPrivate::ensure_cursor_is_onscreen() +Terminal::ensure_cursor_is_onscreen() { if (G_UNLIKELY (m_screen->cursor.col >= m_column_count)) m_screen->cursor.col = m_column_count - 1; } void -VteTerminalPrivate::home_cursor() +Terminal::home_cursor() { set_cursor_coords(0, 0); } void -VteTerminalPrivate::clear_screen() +Terminal::clear_screen() { auto row = m_screen->cursor.row - m_screen->insert_delta; auto initial = _vte_ring_next(m_screen->row_data); @@ -327,7 +300,7 @@ /* Clear the current line. */ void -VteTerminalPrivate::clear_current_line() +Terminal::clear_current_line() { VteRowData *rowdata; @@ -353,7 +326,7 @@ /* Clear above the current line. */ void -VteTerminalPrivate::clear_above_current() +Terminal::clear_above_current() { /* If the cursor is actually on the screen, clear data in the row * which corresponds to the cursor. */ @@ -377,7 +350,7 @@ /* Scroll the text, but don't move the cursor. Negative = up, positive = down. */ void -VteTerminalPrivate::scroll_text(vte::grid::row_t scroll_amount) +Terminal::scroll_text(vte::grid::row_t scroll_amount) { vte::grid::row_t start, end; if (m_scrolling_restricted) { @@ -414,42 +387,28 @@ m_text_deleted_flag = TRUE; } -/* Restore cursor. */ -void -VteTerminalPrivate::seq_restore_cursor(vte::parser::Params const& params) -{ - restore_cursor(); -} - void -VteTerminalPrivate::restore_cursor() +Terminal::restore_cursor() { restore_cursor(m_screen); ensure_cursor_is_onscreen(); } -/* Save cursor. */ -void -VteTerminalPrivate::seq_save_cursor(vte::parser::Params const& params) -{ - save_cursor(); -} - void -VteTerminalPrivate::save_cursor() +Terminal::save_cursor() { save_cursor(m_screen); } /* Switch to normal screen. */ void -VteTerminalPrivate::switch_normal_screen() +Terminal::switch_normal_screen() { switch_screen(&m_normal_screen); } void -VteTerminalPrivate::switch_screen(VteScreen *new_screen) +Terminal::switch_screen(VteScreen *new_screen) { /* if (new_screen == m_screen) return; ? */ @@ -475,576 +434,229 @@ /* Switch to alternate screen. */ void -VteTerminalPrivate::switch_alternate_screen() +Terminal::switch_alternate_screen() { switch_screen(&m_alternate_screen); } -/* Switch to normal screen and restore cursor (in this order). */ -void -VteTerminalPrivate::switch_normal_screen_and_restore_cursor() -{ - switch_normal_screen(); - restore_cursor(); -} - -/* Save cursor and switch to alternate screen (in this order). */ -void -VteTerminalPrivate::save_cursor_and_switch_alternate_screen() -{ - save_cursor(); - switch_alternate_screen(); -} - -/* Set icon/window titles. */ -void -VteTerminalPrivate::set_title_internal(vte::parser::Params const& params, - bool change_icon_title, - bool change_window_title) -{ - if (change_icon_title == FALSE && change_window_title == FALSE) - return; - - /* Get the string parameter's value. */ - char* title; - if (!params.string_at(0, title)) - return; - - char *p, *validated; - const char *end; - - //FIXMEchpe why? it's guaranteed UTF-8 already - /* Validate the text. */ - g_utf8_validate(title, strlen(title), &end); - validated = g_strndup(title, end - title); - - /* No control characters allowed. */ - for (p = validated; *p != '\0'; p++) { - if ((*p & 0x1f) == *p) { - *p = ' '; - } - } - - /* Emit the signal */ - if (change_window_title) { - g_free(m_window_title_changed); - m_window_title_changed = g_strdup(validated); - } - - if (change_icon_title) { - g_free(m_icon_title_changed); - m_icon_title_changed = g_strdup(validated); - } - - g_free (validated); - - g_free(title); -} - -/* Toggle a terminal mode. */ void -VteTerminalPrivate::set_mode(vte::parser::Params const& params, - bool value) +Terminal::set_mode_ecma(vte::parser::Sequence const& seq, + bool set) noexcept { - auto n_params = params.size(); - if (n_params == 0) - return; + auto const n_params = seq.size(); + for (unsigned int i = 0; i < n_params; i = seq.next(i)) { + auto const param = seq.collect1(i); + auto const mode = m_modes_ecma.mode_from_param(param); + + _vte_debug_print(VTE_DEBUG_MODES, + "Mode %d (%s) %s\n", + param, m_modes_ecma.mode_to_cstring(mode), + set ? "set" : "reset"); - for (unsigned int i = 0; i < n_params; i++) { - long setting; - if (!params.number_at_unchecked(i, setting)) + if (mode < 0) continue; - switch (setting) { - case 2: /* keyboard action mode (?) */ - break; - case 4: /* insert/overtype mode */ - m_insert_mode = value; - break; - case 12: /* send/receive mode (local echo) */ - m_sendrecv_mode = value; - break; - case 20: /* automatic newline / normal linefeed mode */ - m_linefeed_mode = value; - break; - default: - break; - } + m_modes_ecma.set(mode, set); } } void -VteTerminalPrivate::reset_mouse_smooth_scroll_delta() +Terminal::update_mouse_protocol() noexcept { - m_mouse_smooth_scroll_delta = 0.0; -} - -typedef void (VteTerminalPrivate::* decset_handler_t)(); + if (m_modes_private.XTERM_MOUSE_ANY_EVENT()) + m_mouse_tracking_mode = MOUSE_TRACKING_ALL_MOTION_TRACKING; + else if (m_modes_private.XTERM_MOUSE_BUTTON_EVENT()) + m_mouse_tracking_mode = MOUSE_TRACKING_CELL_MOTION_TRACKING; + else if (m_modes_private.XTERM_MOUSE_VT220_HIGHLIGHT()) + m_mouse_tracking_mode = MOUSE_TRACKING_HILITE_TRACKING; + else if (m_modes_private.XTERM_MOUSE_VT220()) + m_mouse_tracking_mode = MOUSE_TRACKING_SEND_XY_ON_BUTTON; + else if (m_modes_private.XTERM_MOUSE_X10()) + m_mouse_tracking_mode = MOUSE_TRACKING_SEND_XY_ON_CLICK; + else + m_mouse_tracking_mode = MOUSE_TRACKING_NONE; -struct decset_t { - gint16 setting; - /* offset in VteTerminalPrivate (> 0) or VteScreen (< 0) */ - gint16 boffset; - gint16 ioffset; - gint16 poffset; - gint16 fvalue; - gint16 tvalue; - decset_handler_t reset, set; -}; + m_mouse_smooth_scroll_delta = 0.0; -static int -decset_cmp(const void *va, - const void *vb) -{ - const struct decset_t *a = (const struct decset_t *)va; - const struct decset_t *b = (const struct decset_t *)vb; + /* Mouse pointer might change */ + apply_mouse_cursor(); - return a->setting < b->setting ? -1 : a->setting > b->setting; + _vte_debug_print(VTE_DEBUG_MODES, + "Mouse protocol is now %d\n", m_mouse_tracking_mode); } -/* Manipulate certain terminal attributes. */ void -VteTerminalPrivate::decset(vte::parser::Params const& params, - bool restore, - bool save, - bool set) +Terminal::set_mode_private(int mode, + bool set) noexcept { + /* Pre actions */ + switch (mode) { + default: + break; + } - auto n_params = params.size(); - for (unsigned int i = 0; i < n_params; i++) { - long setting; + m_modes_private.set(mode, set); - if (!params.number_at(i, setting)) - continue; + /* Post actions */ + switch (mode) { + case vte::terminal::modes::Private::eDEC_132_COLUMN: + /* DECCOLM: set/reset to 132/80 columns mode, clear screen and cursor home */ + // FIXMEchpe don't do clear screen if DECNCSM is set + /* FIXMEchpe!!! + * Changing this mode resets the top, bottom, left, right margins; + * clears the screen (unless DECNCSM is set); resets DECLRMM; and clears + * the status line if host-writable. + */ + if (m_modes_private.XTERM_DECCOLM()) { + emit_resize_window(set ? 132 : 80, m_row_count); + clear_screen(); + home_cursor(); + } + break; - decset(setting, restore, save, set); - } -} + case vte::terminal::modes::Private::eDEC_REVERSE_IMAGE: + invalidate_all(); + break; -void -VteTerminalPrivate::decset(long setting, - bool restore, - bool save, - bool set) -{ - static const struct decset_t settings[] = { -#define PRIV_OFFSET(member) (G_STRUCT_OFFSET(VteTerminalPrivate, member)) -#define SCREEN_OFFSET(member) (-G_STRUCT_OFFSET(VteScreen, member)) - /* 1: Application/normal cursor keys. */ - {1, 0, PRIV_OFFSET(m_cursor_mode), 0, - VTE_KEYMODE_NORMAL, - VTE_KEYMODE_APPLICATION, - nullptr, nullptr,}, - /* 2: disallowed, we don't do VT52. */ - {2, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 3: DECCOLM set/reset to and from 132/80 columns */ - {3, 0, 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 5: Reverse video. */ - {5, PRIV_OFFSET(m_reverse_mode), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 6: Origin mode: when enabled, cursor positioning is - * relative to the scrolling region. */ - {6, PRIV_OFFSET(m_origin_mode), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 7: Wraparound mode. */ - {7, PRIV_OFFSET(m_autowrap), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 8: disallowed, keyboard repeat is set by user. */ - {8, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 9: Send-coords-on-click. */ - {9, 0, PRIV_OFFSET(m_mouse_tracking_mode), 0, - 0, - MOUSE_TRACKING_SEND_XY_ON_CLICK, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta,}, - /* 12: disallowed, cursor blinks is set by user. */ - {12, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 18: print form feed. */ - /* 19: set print extent to full screen. */ - /* 25: Cursor visible. */ - {25, PRIV_OFFSET(m_cursor_visible), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 30/rxvt: disallowed, scrollbar visibility is set by user. */ - {30, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 35/rxvt: disallowed, fonts set by user. */ - {35, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 38: enter Tektronix mode. */ - /* 40: Enable DECCOLM mode. */ - {40, PRIV_OFFSET(m_deccolm_mode), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 41: more(1) fix. */ - /* 42: Enable NLS replacements. */ - /* 44: Margin bell. */ - /* 47: Alternate screen. */ - {47, 0, 0, 0, - 0, - 0, - &VteTerminalPrivate::switch_normal_screen, - &VteTerminalPrivate::switch_alternate_screen,}, - /* 66: Keypad mode. */ - {66, PRIV_OFFSET(m_keypad_mode), 0, 0, - VTE_KEYMODE_NORMAL, - VTE_KEYMODE_APPLICATION, - nullptr, nullptr,}, - /* 67: disallowed, backspace key policy is set by user. */ - {67, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 1000: Send-coords-on-button. */ - {1000, 0, PRIV_OFFSET(m_mouse_tracking_mode), 0, - 0, - MOUSE_TRACKING_SEND_XY_ON_BUTTON, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta,}, - /* 1001: Hilite tracking. */ - {1001, 0, PRIV_OFFSET(m_mouse_tracking_mode), 0, - (0), - (MOUSE_TRACKING_HILITE_TRACKING), - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta,}, - /* 1002: Cell motion tracking. */ - {1002, 0, PRIV_OFFSET(m_mouse_tracking_mode), 0, - (0), - (MOUSE_TRACKING_CELL_MOTION_TRACKING), - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta,}, - /* 1003: All motion tracking. */ - {1003, 0, PRIV_OFFSET(m_mouse_tracking_mode), 0, - (0), - (MOUSE_TRACKING_ALL_MOTION_TRACKING), - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta, - &VteTerminalPrivate::reset_mouse_smooth_scroll_delta,}, - /* 1004: Focus tracking. */ - {1004, PRIV_OFFSET(m_focus_tracking_mode), 0, 0, - FALSE, - TRUE, - nullptr, - &VteTerminalPrivate::feed_focus_event_initial,}, - /* 1006: Extended mouse coordinates. */ - {1006, PRIV_OFFSET(m_mouse_xterm_extension), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 1007: Alternate screen scroll. */ - {1007, PRIV_OFFSET(m_alternate_screen_scroll), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 1010/rxvt: disallowed, scroll-on-output is set by user. */ - {1010, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 1011/rxvt: disallowed, scroll-on-keypress is set by user. */ - {1011, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 1015/urxvt: Extended mouse coordinates. */ - {1015, PRIV_OFFSET(m_mouse_urxvt_extension), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 1035: disallowed, don't know what to do with it. */ - {1035, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 1036: Meta-sends-escape. */ - {1036, PRIV_OFFSET(m_meta_sends_escape), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, - /* 1037: disallowed, delete key policy is set by user. */ - {1037, 0, 0, 0, 0, 0, nullptr, nullptr,}, - /* 1047: Use alternate screen buffer. */ - {1047, 0, 0, 0, - 0, - 0, - &VteTerminalPrivate::switch_normal_screen, - &VteTerminalPrivate::switch_alternate_screen,}, - /* 1048: Save/restore cursor position. */ - {1048, 0, 0, 0, - 0, - 0, - &VteTerminalPrivate::restore_cursor, - &VteTerminalPrivate::save_cursor,}, - /* 1049: Use alternate screen buffer, saving the cursor - * position. */ - {1049, 0, 0, 0, - 0, - 0, - &VteTerminalPrivate::switch_normal_screen_and_restore_cursor, - &VteTerminalPrivate::save_cursor_and_switch_alternate_screen,}, - /* 2004: Bracketed paste mode. */ - {2004, PRIV_OFFSET(m_bracketed_paste_mode), 0, 0, - FALSE, - TRUE, - nullptr, nullptr,}, -#undef PRIV_OFFSET -#undef SCREEN_OFFSET - }; - struct decset_t key; - struct decset_t *found; - - /* Handle the setting. */ - key.setting = setting; - found = (struct decset_t *)bsearch(&key, settings, G_N_ELEMENTS(settings), sizeof(settings[0]), decset_cmp); - if (!found) { - _vte_debug_print (VTE_DEBUG_MISC, - "DECSET/DECRESET mode %ld not recognized, ignoring.\n", - setting); - return; - } + case vte::terminal::modes::Private::eDEC_ORIGIN: + /* Reposition the cursor in its new home position. */ + home_cursor(); + break; - key = *found; - do { - gboolean *bvalue = NULL; - gint *ivalue = NULL; - gpointer *pvalue = NULL, pfvalue = NULL, ptvalue = NULL; - gpointer p; - - /* Handle settings we want to ignore. */ - if ((key.fvalue == key.tvalue) && - (!key.set) && - (!key.reset)) { - break; - } + case vte::terminal::modes::Private::eDEC_TEXT_CURSOR: + /* No need to invalidate the cursor here, this is done + * in process_incoming(). + */ + break; -#define STRUCT_MEMBER_P(type,total_offset) \ - (type) (total_offset >= 0 ? G_STRUCT_MEMBER_P(this, total_offset) : G_STRUCT_MEMBER_P(m_screen, -total_offset)) + case vte::terminal::modes::Private::eXTERM_ALTBUF: + /* [[fallthrough]]; */ + case vte::terminal::modes::Private::eXTERM_OPT_ALTBUF: + /* [[fallthrough]]; */ + case vte::terminal::modes::Private::eXTERM_OPT_ALTBUF_SAVE_CURSOR: + if (set) { + if (mode == vte::terminal::modes::Private::eXTERM_OPT_ALTBUF_SAVE_CURSOR) + save_cursor(); + + switch_alternate_screen(); + + /* Clear the alternate screen */ + if (mode == vte::terminal::modes::Private::eXTERM_OPT_ALTBUF_SAVE_CURSOR) + clear_screen(); + } else { + if (mode == vte::terminal::modes::Private::eXTERM_OPT_ALTBUF && + m_screen == &m_alternate_screen) + clear_screen(); - if (key.boffset) { - bvalue = STRUCT_MEMBER_P(gboolean*, key.boffset); - } else if (key.ioffset) { - ivalue = STRUCT_MEMBER_P(int*, key.ioffset); - } else if (key.poffset) { - pvalue = STRUCT_MEMBER_P(gpointer*, key.poffset); - pfvalue = STRUCT_MEMBER_P(gpointer, key.fvalue); - ptvalue = STRUCT_MEMBER_P(gpointer, key.tvalue); - } -#undef STRUCT_MEMBER_P - - /* Read the old setting. */ - if (restore) { - p = g_hash_table_lookup(m_dec_saved, - GINT_TO_POINTER(setting)); - set = (p != NULL); - _vte_debug_print(VTE_DEBUG_PARSE, - "Setting %ld was %s.\n", - setting, set ? "set" : "unset"); - } - /* Save the current setting. */ - if (save) { - if (bvalue) { - set = *(bvalue) != FALSE; - } else - if (ivalue) { - set = *(ivalue) == (int)key.tvalue; - } else - if (pvalue) { - set = *(pvalue) == ptvalue; - } - _vte_debug_print(VTE_DEBUG_PARSE, - "Setting %ld is %s, saving.\n", - setting, set ? "set" : "unset"); - g_hash_table_insert(m_dec_saved, - GINT_TO_POINTER(setting), - GINT_TO_POINTER(set)); - } - /* Change the current setting to match the new/saved value. */ - if (!save) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Setting %ld to %s.\n", - setting, set ? "set" : "unset"); - if (key.set && set) { - (this->*key.set)(); - } - if (bvalue) { - *(bvalue) = set; - } else - if (ivalue) { - *(ivalue) = set ? (int)key.tvalue : (int)key.fvalue; - } else - if (pvalue) { - *(pvalue) = set ? ptvalue : pfvalue; - } - if (key.reset && !set) { - (this->*key.reset)(); - } - } - } while (0); + switch_normal_screen(); - /* Do whatever's necessary when the setting changes. */ - switch (setting) { - case 1: - _vte_debug_print(VTE_DEBUG_KEYBOARD, set ? - "Entering application cursor mode.\n" : - "Leaving application cursor mode.\n"); - break; - case 3: - /* 3: DECCOLM set/reset to 132/80 columns mode, clear screen and cursor home */ - if (m_deccolm_mode) { - emit_resize_window(set ? 132 : 80, - m_row_count); - clear_screen(); - home_cursor(); + if (mode == vte::terminal::modes::Private::eXTERM_OPT_ALTBUF_SAVE_CURSOR) + restore_cursor(); } - break; - case 5: - /* Repaint everything in reverse mode. */ - invalidate_all(); - break; - case 6: - /* Reposition the cursor in its new home position. */ - home_cursor(); - break; - case 47: - case 1047: - case 1049: - /* Clear the alternate screen if we're switching to it */ - if (set) { - clear_screen(); - } - /* Reset scrollbars and repaint everything. */ - gtk_adjustment_set_value(m_vadjustment, - m_screen->scroll_delta); - set_scrollback_lines(m_scrollback_lines); + + /* Reset scrollbars and repaint everything. */ + gtk_adjustment_set_value(m_vadjustment, + m_screen->scroll_delta); + set_scrollback_lines(m_scrollback_lines); queue_contents_changed(); invalidate_all(); - break; - case 9: - case 1000: - case 1001: - case 1002: - case 1003: - /* Mouse pointer might change. */ - apply_mouse_cursor(); - break; - case 66: - _vte_debug_print(VTE_DEBUG_KEYBOARD, set ? - "Entering application keypad mode.\n" : - "Leaving application keypad mode.\n"); - break; - default: - break; - } -} - -/* THE HANDLERS */ + break; -/* Do nothing. */ -void -VteTerminalPrivate::seq_nop(vte::parser::Params const& params) -{ -} + case vte::terminal::modes::Private::eXTERM_SAVE_CURSOR: + if (set) + save_cursor(); + else + restore_cursor(); + break; -void -VteTerminalPrivate::set_character_replacements(unsigned slot, - VteCharacterReplacement replacement) -{ - g_assert(slot < G_N_ELEMENTS(m_character_replacements)); - m_character_replacements[slot] = replacement; -} + case vte::terminal::modes::Private::eXTERM_MOUSE_X10: + case vte::terminal::modes::Private::eXTERM_MOUSE_VT220: + case vte::terminal::modes::Private::eXTERM_MOUSE_VT220_HIGHLIGHT: + case vte::terminal::modes::Private::eXTERM_MOUSE_BUTTON_EVENT: + case vte::terminal::modes::Private::eXTERM_MOUSE_ANY_EVENT: + case vte::terminal::modes::Private::eXTERM_MOUSE_EXT: + case vte::terminal::modes::Private::eXTERM_MOUSE_EXT_SGR: + case vte::terminal::modes::Private::eURXVT_MOUSE_EXT: + update_mouse_protocol(); + break; -/* G0 character set is a pass-thru (no mapping). */ -void -VteTerminalPrivate::seq_designate_g0_plain(vte::parser::Params const& params) -{ - set_character_replacements(0, VTE_CHARACTER_REPLACEMENT_NONE); -} + case vte::terminal::modes::Private::eXTERM_FOCUS: + if (set) + feed_focus_event_initial(); + break; -/* G0 character set is DEC Special Character and Line Drawing Set. */ -void -VteTerminalPrivate::seq_designate_g0_line_drawing(vte::parser::Params const& params) -{ - set_character_replacements(0, VTE_CHARACTER_REPLACEMENT_LINE_DRAWING); + default: + break; + } } -/* G0 character set is British (# is converted to £). */ void -VteTerminalPrivate::seq_designate_g0_british(vte::parser::Params const& params) +Terminal::set_mode_private(vte::parser::Sequence const& seq, + bool set) noexcept { - set_character_replacements(0, VTE_CHARACTER_REPLACEMENT_BRITISH); -} + auto const n_params = seq.size(); + for (unsigned int i = 0; i < n_params; i = seq.next(i)) { + auto const param = seq.collect1(i); + auto const mode = m_modes_private.mode_from_param(param); + + _vte_debug_print(VTE_DEBUG_MODES, + "Private mode %d (%s) %s\n", + param, m_modes_private.mode_to_cstring(mode), + set ? "set" : "reset"); -/* G1 character set is a pass-thru (no mapping). */ -void -VteTerminalPrivate::seq_designate_g1_plain(vte::parser::Params const& params) -{ - set_character_replacements(1, VTE_CHARACTER_REPLACEMENT_NONE); -} + if (mode < 0) + continue; -/* G1 character set is DEC Special Character and Line Drawing Set. */ -void -VteTerminalPrivate::seq_designate_g1_line_drawing(vte::parser::Params const& params) -{ - set_character_replacements(1, VTE_CHARACTER_REPLACEMENT_LINE_DRAWING); + set_mode_private(mode, set); + } } -/* G1 character set is British (# is converted to £). */ void -VteTerminalPrivate::seq_designate_g1_british(vte::parser::Params const& params) +Terminal::save_mode_private(vte::parser::Sequence const& seq, + bool save) noexcept { - set_character_replacements(1, VTE_CHARACTER_REPLACEMENT_BRITISH); -} + auto const n_params = seq.size(); + for (unsigned int i = 0; i < n_params; i = seq.next(i)) { + auto const param = seq.collect1(i); + auto const mode = m_modes_private.mode_from_param(param); + + if (mode < 0) { + _vte_debug_print(VTE_DEBUG_MODES, + "Saving private mode %d (%s)\n", + param, m_modes_private.mode_to_cstring(mode)); + continue; + } -void -VteTerminalPrivate::set_character_replacement(unsigned slot) -{ - g_assert(slot < G_N_ELEMENTS(m_character_replacements)); - m_character_replacement = &m_character_replacements[slot]; -} + if (save) { + _vte_debug_print(VTE_DEBUG_MODES, + "Saving private mode %d (%s) is %s\n", + param, m_modes_private.mode_to_cstring(mode), + m_modes_private.get(mode) ? "set" : "reset"); -/* SI (shift in): switch to G0 character set. */ -void -VteTerminalPrivate::seq_shift_in(vte::parser::Params const& params) -{ - set_character_replacement(0); -} + m_modes_private.push_saved(mode); + } else { + bool const set = m_modes_private.pop_saved(mode); -/* SO (shift out): switch to G1 character set. */ -void -VteTerminalPrivate::seq_shift_out(vte::parser::Params const& params) -{ - set_character_replacement(1); -} + _vte_debug_print(VTE_DEBUG_MODES, + "Restoring private mode %d (%s) to %s\n", + param, m_modes_private.mode_to_cstring(mode), + set ? "set" : "reset"); -/* Beep. */ -void -VteTerminalPrivate::seq_bell(vte::parser::Params const& params) -{ - m_bell_pending = true; + set_mode_private(mode, set); + } + } } -/* Backtab. */ void -VteTerminalPrivate::seq_cursor_back_tab(vte::parser::Params const& params) +Terminal::set_character_replacement(unsigned slot) { - /* Calculate which column is the previous tab stop. */ - auto newcol = m_screen->cursor.col; - - if (m_tabstops) { - /* Find the next tabstop. */ - while (newcol > 0) { - newcol--; - if (get_tabstop(newcol % m_column_count)) { - break; - } - } - } - - /* Warp the cursor. */ - _vte_debug_print(VTE_DEBUG_PARSE, - "Moving cursor to column %ld.\n", (long)newcol); - set_cursor_column(newcol); + g_assert(slot < G_N_ELEMENTS(m_character_replacements)); + m_character_replacement = &m_character_replacements[slot]; } /* Clear from the cursor position (inclusive!) to the beginning of the line. */ void -VteTerminalPrivate::clear_to_bol() +Terminal::clear_to_bol() { ensure_cursor_is_onscreen(); @@ -1076,7 +688,7 @@ /* Clear to the right of the cursor and below the current line. */ void -VteTerminalPrivate::clear_below_current() +Terminal::clear_below_current() { ensure_cursor_is_onscreen(); @@ -1133,7 +745,7 @@ /* Clear from the cursor position to the end of the line. */ void -VteTerminalPrivate::clear_to_eol() +Terminal::clear_to_eol() { /* If we were to strictly emulate xterm, we'd ensure the cursor is onscreen. * But due to https://bugzilla.gnome.org/show_bug.cgi?id=740789 we intentionally @@ -1167,38 +779,38 @@ m_screen->cursor.row, 1); } -/* Move the cursor to the given column (horizontal position), 1-based. */ -void -VteTerminalPrivate::seq_cursor_character_absolute(vte::parser::Params const& params) -{ - auto value = params.number_or_default_at(0, 1) - 1; - set_cursor_column(value); -} - /* - * VteTerminalPrivate::set_cursor_column: + * Terminal::set_cursor_column: * @col: the column. 0-based from 0 to m_column_count - 1 * * Sets the cursor column to @col, clamped to the range 0..m_column_count-1. */ void -VteTerminalPrivate::set_cursor_column(vte::grid::column_t col) +Terminal::set_cursor_column(vte::grid::column_t col) { + _vte_debug_print(VTE_DEBUG_PARSER, + "Moving cursor to column %ld.\n", col); m_screen->cursor.col = CLAMP(col, 0, m_column_count - 1); } +void +Terminal::set_cursor_column1(vte::grid::column_t col) +{ + set_cursor_column(col - 1); +} + /* - * VteTerminalPrivate::set_cursor_row: + * Terminal::set_cursor_row: * @row: the row. 0-based and relative to the scrolling region * * Sets the cursor row to @row. @row is relative to the scrolling region * (0 if restricted scrolling is off). */ void -VteTerminalPrivate::set_cursor_row(vte::grid::row_t row) +Terminal::set_cursor_row(vte::grid::row_t row) { vte::grid::row_t start_row, end_row; - if (m_origin_mode && + if (m_modes_private.DEC_ORIGIN() && m_scrolling_restricted) { start_row = m_scrolling_region.start; end_row = m_scrolling_region.end; @@ -1212,17 +824,23 @@ m_screen->cursor.row = row + m_screen->insert_delta; } +void +Terminal::set_cursor_row1(vte::grid::row_t row) +{ + set_cursor_row(row - 1); +} + /* - * VteTerminalPrivate::get_cursor_row: + * Terminal::get_cursor_row: * * Returns: the relative cursor row, 0-based and relative to the scrolling region * if set (regardless of origin mode). */ vte::grid::row_t -VteTerminalPrivate::get_cursor_row() const +Terminal::get_cursor_row_unclamped() const { auto row = m_screen->cursor.row - m_screen->insert_delta; - /* Note that we do NOT check m_origin_mode here! */ + /* Note that we do NOT check DEC_ORIGIN mode here! */ if (m_scrolling_restricted) { row -= m_scrolling_region.start; } @@ -1230,13 +848,13 @@ } vte::grid::column_t -VteTerminalPrivate::get_cursor_column() const +Terminal::get_cursor_column_unclamped() const { return m_screen->cursor.col; } /* - * VteTerminalPrivate::set_cursor_coords: + * Terminal::set_cursor_coords: * @row: the row. 0-based and relative to the scrolling region * @col: the column. 0-based from 0 to m_column_count - 1 * @@ -1246,116 +864,24 @@ * Sets the cursor column to @col, clamped to the range 0..m_column_count-1. */ void -VteTerminalPrivate::set_cursor_coords(vte::grid::row_t row, +Terminal::set_cursor_coords(vte::grid::row_t row, vte::grid::column_t column) { set_cursor_column(column); set_cursor_row(row); } -/* Move the cursor to the given position, 1-based. */ void -VteTerminalPrivate::seq_cursor_position(vte::parser::Params const& params) -{ - /* The first is the row, the second is the column. */ - auto rowval = params.number_or_default_at(0, 1) - 1; - auto colval = params.number_or_default_at(1, 1) - 1; - set_cursor_coords(rowval, colval); -} - -/* Carriage return. */ -void -VteTerminalPrivate::seq_carriage_return(vte::parser::Params const& params) -{ - set_cursor_column(0); -} - -void -VteTerminalPrivate::reset_scrolling_region() -{ - m_scrolling_restricted = FALSE; - home_cursor(); -} - -/* Restrict scrolling and updates to a subset of the visible lines. */ -void -VteTerminalPrivate::seq_set_scrolling_region(vte::parser::Params const& params) -{ - /* We require two parameters. Anything less is a reset. */ - if (params.size() < 2) - return reset_scrolling_region(); - - auto start = params.number_or_default_at_unchecked(0) - 1; - auto end = params.number_or_default_at_unchecked(1) - 1; - set_scrolling_region(start, end); -} - -void -VteTerminalPrivate::set_scrolling_region(vte::grid::row_t start /* relative */, - vte::grid::row_t end /* relative */) -{ - /* A (1-based) value of 0 means default. */ - if (start == -1) { - start = 0; - } - if (end == -1) { - end = m_row_count - 1; - } - /* Bail out on garbage, require at least 2 rows, as per xterm. */ - if (start < 0 || start >= m_row_count - 1 || end < start + 1) { - return; - } - if (end >= m_row_count) { - end = m_row_count - 1; - } - - /* Set the right values. */ - m_scrolling_region.start = start; - m_scrolling_region.end = end; - m_scrolling_restricted = TRUE; - if (m_scrolling_region.start == 0 && - m_scrolling_region.end == m_row_count - 1) { - /* Special case -- run wild, run free. */ - m_scrolling_restricted = FALSE; - } else { - /* Maybe extend the ring -- bug 710483 */ - while (_vte_ring_next(m_screen->row_data) < m_screen->insert_delta + m_row_count) - _vte_ring_insert(m_screen->row_data, _vte_ring_next(m_screen->row_data)); - } - - home_cursor(); -} - -/* Move the cursor to the beginning of the Nth next line, no scrolling. */ -void -VteTerminalPrivate::seq_cursor_next_line(vte::parser::Params const& params) -{ - set_cursor_column(0); - seq_cursor_down(params); -} - -/* Move the cursor to the beginning of the Nth previous line, no scrolling. */ -void -VteTerminalPrivate::seq_cursor_preceding_line(vte::parser::Params const& params) -{ - set_cursor_column(0); - seq_cursor_up(params); -} - -/* Move the cursor to the given row (vertical position), 1-based. */ -void -VteTerminalPrivate::seq_line_position_absolute(vte::parser::Params const& params) +Terminal::set_cursor_coords1(vte::grid::row_t row, + vte::grid::column_t column) { - // FIXMEchpe shouldn't we ensure_cursor_is_onscreen AFTER setting the new cursor row? - ensure_cursor_is_onscreen(); - - auto val = params.number_or_default_at(0, 1) - 1; - set_cursor_row(val); + set_cursor_column1(column); + set_cursor_row1(row); } /* Delete a character at the current cursor position. */ void -VteTerminalPrivate::delete_character() +Terminal::delete_character() { VteRowData *rowdata; long col; @@ -1391,27 +917,8 @@ m_text_deleted_flag = TRUE; } -/* Delete N characters at the current cursor position. */ -void -VteTerminalPrivate::seq_delete_characters(vte::parser::Params const& params) -{ - auto val = std::max(std::min(params.number_or_default_at(0, 1), - m_column_count - m_screen->cursor.col), - long(1)); - for (auto i = 0; i < val; i++) - delete_character(); -} - -/* Cursor down N lines, no scrolling. */ -void -VteTerminalPrivate::seq_cursor_down(vte::parser::Params const& params) -{ - auto val = params.number_or_default_at(0, 1); - move_cursor_down(val); -} - void -VteTerminalPrivate::move_cursor_down(vte::grid::row_t rows) +Terminal::move_cursor_down(vte::grid::row_t rows) { rows = CLAMP(rows, 1, m_row_count); @@ -1419,7 +926,7 @@ ensure_cursor_is_onscreen(); vte::grid::row_t end; - // FIXMEchpe why not check m_origin_mode here? + // FIXMEchpe why not check DEC_ORIGIN here? if (m_scrolling_restricted) { end = m_screen->insert_delta + m_scrolling_region.end; } else { @@ -1429,18 +936,8 @@ m_screen->cursor.row = MIN(m_screen->cursor.row + rows, end); } -/* Erase characters starting at the cursor position (overwriting N with - * spaces, but not moving the cursor). */ -void -VteTerminalPrivate::seq_erase_characters(vte::parser::Params const& params) -{ - /* If we got a parameter, use it. */ - auto count = std::min(params.number_or_default_at(0, 1), long(65535)); - erase_characters(count); -} - void -VteTerminalPrivate::erase_characters(long count) +Terminal::erase_characters(long count) { VteCell *cell; long col, i; @@ -1478,16 +975,9 @@ m_text_deleted_flag = TRUE; } -/* Form-feed / next-page. */ -void -VteTerminalPrivate::seq_form_feed(vte::parser::Params const& params) -{ - line_feed(); -} - /* Insert a blank character. */ void -VteTerminalPrivate::insert_blank_character() +Terminal::insert_blank_character() { ensure_cursor_is_onscreen(); @@ -1496,1779 +986,7588 @@ m_screen->cursor = save; } -/* Insert N blank characters. */ -/* TODOegmont: Insert them in a single run, so that we call cleanup_fragments only once. */ -void -VteTerminalPrivate::seq_insert_blank_characters(vte::parser::Params const& params) -{ - auto val = std::max(std::min(params.number_or_default_at(0, 1), - m_column_count - m_screen->cursor.col), - long(1)); - for (auto i = 0; i < val; i++) - insert_blank_character(); -} - -/* REP: Repeat the last graphic character n times. */ -void -VteTerminalPrivate::seq_repeat(vte::parser::Params const& params) -{ - auto val = std::min(params.number_or_default_at(0, 1), - long(65535)); // FIXMEchpe maybe limit more, to m_column_count - m_screen->cursor.col ? - for (auto i = 0; i < val; i++) { - // FIXMEchpe can't we move that check out of the loop? - if (m_last_graphic_character == 0) - break; - insert_char(m_last_graphic_character, false, true); - } -} - -/* Cursor down 1 line, with scrolling. */ -void -VteTerminalPrivate::seq_index(vte::parser::Params const& params) -{ - line_feed(); -} - -/* Cursor left. */ -void -VteTerminalPrivate::seq_backspace(vte::parser::Params const& params) -{ - ensure_cursor_is_onscreen(); - - if (m_screen->cursor.col > 0) { - /* There's room to move left, so do so. */ - m_screen->cursor.col--; - } -} - -/* Cursor left N columns. */ -void -VteTerminalPrivate::seq_cursor_backward(vte::parser::Params const& params) -{ - auto val = params.number_or_default_at(0, 1); - move_cursor_backward(val); -} - void -VteTerminalPrivate::move_cursor_backward(vte::grid::column_t columns) +Terminal::move_cursor_backward(vte::grid::column_t columns) { ensure_cursor_is_onscreen(); - auto col = get_cursor_column(); + auto col = get_cursor_column_unclamped(); columns = CLAMP(columns, 1, col); set_cursor_column(col - columns); } -/* Cursor right N columns. */ -void -VteTerminalPrivate::seq_cursor_forward(vte::parser::Params const& params) -{ - auto val = params.number_or_default_at(0, 1); - move_cursor_forward(val); -} - void -VteTerminalPrivate::move_cursor_forward(vte::grid::column_t columns) +Terminal::move_cursor_forward(vte::grid::column_t columns) { columns = CLAMP(columns, 1, m_column_count); ensure_cursor_is_onscreen(); /* The cursor can be further to the right, don't move in that case. */ - auto col = get_cursor_column(); + auto col = get_cursor_column_unclamped(); if (col < m_column_count) { /* There's room to move right. */ set_cursor_column(col + columns); } } -/* Move the cursor to the beginning of the next line, scrolling if necessary. */ void -VteTerminalPrivate::seq_next_line(vte::parser::Params const& params) +Terminal::line_feed() { - set_cursor_column(0); + ensure_cursor_is_onscreen(); cursor_down(true); } -/* Scroll the text down N lines, but don't move the cursor. */ -void -VteTerminalPrivate::seq_scroll_down(vte::parser::Params const& params) -{ - /* No ensure_cursor_is_onscreen() here as per xterm */ - auto val = std::max(params.number_or_default_at(0, 1), long(1)); - scroll_text(val); -} - -/* Internal helper for changing color in the palette */ void -VteTerminalPrivate::change_color(vte::parser::Params const& params, - const char *terminator) +Terminal::move_cursor_tab_backward(int count) { - char **pairs; - { - char* str; - if (!params.string_at(0, str)) - return; - - pairs = g_strsplit (str, ";", 0); - g_free(str); - } - - if (!pairs) + if (count == 0) return; - vte::color::rgb color; - guint idx, i; - - for (i = 0; pairs[i] && pairs[i + 1]; i += 2) { - idx = strtoul (pairs[i], (char **) NULL, 10); - - if (idx >= VTE_DEFAULT_FG && idx != 256) - continue; - - if (color.parse(pairs[i + 1])) { - set_color(idx == 256 ? VTE_BOLD_FG : idx, VTE_COLOR_SOURCE_ESCAPE, color); - } else if (strcmp (pairs[i + 1], "?") == 0) { - gchar buf[128]; - auto c = get_color(idx == 256 ? VTE_BOLD_FG : idx); - if (c == NULL && idx == 256) - c = get_color(VTE_DEFAULT_FG); - g_assert(c != NULL); - g_snprintf (buf, sizeof (buf), - _VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x%s", - idx, c->red, c->green, c->blue, terminator); - feed_child(buf, -1); - } - } - - g_strfreev (pairs); - - /* emit the refresh as the palette has changed and previous - * renders need to be updated. */ - emit_refresh_window(); -} - -/* Change color in the palette, BEL terminated */ -void -VteTerminalPrivate::seq_change_color_bel(vte::parser::Params const& params) -{ - change_color(params, BEL); + auto const newcol = m_tabstops.get_previous(get_cursor_column(), count, 0); + set_cursor_column(newcol); } -/* Change color in the palette, ST terminated */ void -VteTerminalPrivate::seq_change_color_st(vte::parser::Params const& params) +Terminal::move_cursor_tab_forward(int count) { - change_color(params, ST); -} + if (count == 0) + return; -/* Reset color in the palette */ -void -VteTerminalPrivate::seq_reset_color(vte::parser::Params const& params) -{ - auto n_params = params.size(); - if (n_params) { - for (unsigned int i = 0; i < n_params; i++) { - long value; - if (!params.number_at_unchecked(i, value)) - continue; + auto const col = get_cursor_column(); - if ((value < 0 || value >= VTE_DEFAULT_FG) && value != 256) - continue; + /* Find the next tabstop, but don't go beyond the end of the line */ + int const newcol = m_tabstops.get_next(col, count, m_column_count - 1); - reset_color(value == 256 ? VTE_BOLD_FG : value, VTE_COLOR_SOURCE_ESCAPE); - } - } else { - for (unsigned int idx = 0; idx < VTE_DEFAULT_FG; idx++) { - reset_color(idx, VTE_COLOR_SOURCE_ESCAPE); - } - } -} + /* Make sure we don't move cursor back (see bug #340631) */ + // FIXMEchpe how could this happen!? + if (col >= newcol) + return; -/* Scroll the text up N lines, but don't move the cursor. */ -void -VteTerminalPrivate::seq_scroll_up(vte::parser::Params const& params) -{ - /* No ensure_cursor_is_onscreen() here as per xterm */ + /* Smart tab handling: bug 353610 + * + * If we currently don't have any cells in the space this + * tab creates, we try to make the tab character copyable, + * by appending a single tab char with lots of fragment + * cells following it. + * + * Otherwise, just append empty cells that will show up + * as a space each. + */ - auto val = std::max(params.number_or_default_at(0, 1), long(1)); - scroll_text(-val); -} + VteRowData *rowdata = ensure_row(); + auto const old_len = _vte_row_data_length (rowdata); + _vte_row_data_fill (rowdata, &basic_cell, newcol); + + /* Insert smart tab if there's nothing in the line after + * us, not even empty cells (with non-default background + * color for example). + * + * Notable bugs here: 545924, 597242, 764330 + */ + if (col >= old_len && (newcol - col) <= VTE_TAB_WIDTH_MAX) { + glong i; + VteCell *cell = _vte_row_data_get_writable (rowdata, col); + VteCell tab = *cell; + tab.attr.set_columns(newcol - col); + tab.c = '\t'; + /* Save tab char */ + *cell = tab; + /* And adjust the fragments */ + for (i = col + 1; i < newcol; i++) { + cell = _vte_row_data_get_writable (rowdata, i); + cell->c = '\t'; + cell->attr.set_columns(1); + cell->attr.set_fragment(true); + } + } -/* Cursor down 1 line, with scrolling. */ -void -VteTerminalPrivate::seq_line_feed(vte::parser::Params const& params) -{ - line_feed(); + invalidate_cells(m_screen->cursor.col, newcol - m_screen->cursor.col, + m_screen->cursor.row, 1); + m_screen->cursor.col = newcol; } void -VteTerminalPrivate::line_feed() +Terminal::move_cursor_up(vte::grid::row_t rows) { - ensure_cursor_is_onscreen(); - cursor_down(true); -} + // FIXMEchpe allow 0 as no-op? + rows = CLAMP(rows, 1, m_row_count); -/* Cursor up 1 line, with scrolling. */ -void -VteTerminalPrivate::seq_reverse_index(vte::parser::Params const& params) -{ + //FIXMEchpe why not do this afterward? ensure_cursor_is_onscreen(); - vte::grid::row_t start, end; + vte::grid::row_t start; + //FIXMEchpe why not check DEC_ORIGIN mode here? if (m_scrolling_restricted) { - start = m_scrolling_region.start + m_screen->insert_delta; - end = m_scrolling_region.end + m_screen->insert_delta; + start = m_screen->insert_delta + m_scrolling_region.start; } else { - start = m_screen->insert_delta; - end = start + m_row_count - 1; + start = m_screen->insert_delta; } - if (m_screen->cursor.row == start) { - /* If we're at the top of the scrolling region, add a - * line at the top to scroll the bottom off. */ - ring_remove(end); - ring_insert(start, true); - /* Update the display. */ - scroll_region(start, end - start + 1, 1); - invalidate_cells(0, m_column_count, - start, 2); - } else { - /* Otherwise, just move the cursor up. */ - m_screen->cursor.row--; - } - /* Adjust the scrollbars if necessary. */ - adjust_adjustments(); - /* We modified the display, so make a note of it. */ - m_text_modified_flag = TRUE; + m_screen->cursor.row = MAX(m_screen->cursor.row - rows, start); } -/* Set tab stop in the current column. */ -void -VteTerminalPrivate::seq_tab_set(vte::parser::Params const& params) +/* + * Parse parameters of SGR 38, 48 or 58, starting at @index within @seq. + * Returns %true if @seq contained colour parameters at @index, or %false otherwise. + * In each case, @idx is set to last consumed parameter, + * and the colour is returned in @color. + * + * The format looks like: + * - 256 color indexed palette: + * - ^[[38:5:INDEXm (de jure standard: ITU-T T.416 / ISO/IEC 8613-6; we also allow and ignore further parameters) + * - ^[[38;5;INDEXm (de facto standard, understood by probably all terminal emulators that support 256 colors) + * - true colors: + * - ^[[38:2:[id]:RED:GREEN:BLUE[:...]m (de jure standard: ITU-T T.416 / ISO/IEC 8613-6) + * - ^[[38:2:RED:GREEN:BLUEm (common misinterpretation of the standard, FIXME: stop supporting it at some point) + * - ^[[38;2;RED;GREEN;BLUEm (de facto standard, understood by probably all terminal emulators that support true colors) + * See bugs 685759 and 791456 for details. + */ +template +bool +Terminal::seq_parse_sgr_color(vte::parser::Sequence const& seq, + unsigned int &idx, + uint32_t& color) const noexcept { - if (m_tabstops == NULL) { - m_tabstops = g_hash_table_new(NULL, NULL); - } - set_tabstop(m_screen->cursor.col); -} + /* Note that we don't have to check if the index is after the end of + * the parameters list, since dereferencing is safe and returns -1. + */ -/* Tab. */ -void -VteTerminalPrivate::seq_tab(vte::parser::Params const& params) -{ - move_cursor_tab(); -} + if (seq.param_nonfinal(idx)) { + /* Colon version */ + switch (seq.param(++idx)) { + case VTE_SGR_COLOR_SPEC_RGB: { + auto const n = seq.next(idx) - idx; + if (n < 4) + return false; + if (n > 4) { + /* Consume a colourspace parameter; it must be default */ + if (!seq.param_default(++idx)) + return false; + } -void -VteTerminalPrivate::move_cursor_tab() -{ - long old_len; - vte::grid::column_t newcol, col; + int red = seq.param(++idx); + int green = seq.param(++idx); + int blue = seq.param(++idx); + if ((red & 0xff) != red || + (green & 0xff) != green || + (blue & 0xff) != blue) + return false; - /* Calculate which column is the next tab stop. */ - newcol = col = m_screen->cursor.col; + color = VTE_RGB_COLOR(redbits, greenbits, bluebits, red, green, blue); + return true; + } + case VTE_SGR_COLOR_SPEC_LEGACY: { + auto const n = seq.next(idx) - idx; + if (n < 2) + return false; + + int v = seq.param(++idx); + if (v < 0 || v >= 256) + return false; + + color = (uint32_t)v; + return true; + } + } + } else { + /* Semicolon version */ - g_assert (col >= 0); + idx = seq.next(idx); + switch (seq.param(idx)) { + case VTE_SGR_COLOR_SPEC_RGB: { + /* Consume 3 more parameters */ + idx = seq.next(idx); + int red = seq.param(idx); + idx = seq.next(idx); + int green = seq.param(idx); + idx = seq.next(idx); + int blue = seq.param(idx); + + if ((red & 0xff) != red || + (green & 0xff) != green || + (blue & 0xff) != blue) + return false; - if (m_tabstops != NULL) { - /* Find the next tabstop. */ - for (newcol++; newcol < VTE_TAB_MAX; newcol++) { - if (get_tabstop(newcol)) { - break; - } - } - } + color = VTE_RGB_COLOR(redbits, greenbits, bluebits, red, green, blue); + return true; + } + case VTE_SGR_COLOR_SPEC_LEGACY: { + /* Consume 1 more parameter */ + idx = seq.next(idx); + int v = seq.param(idx); - /* If we have no tab stops or went past the end of the line, stop - * at the right-most column. */ - if (newcol >= m_column_count) { - newcol = m_column_count - 1; - } - - /* but make sure we don't move cursor back (bug #340631) */ - if (col < newcol) { - VteRowData *rowdata = ensure_row(); - - /* Smart tab handling: bug 353610 - * - * If we currently don't have any cells in the space this - * tab creates, we try to make the tab character copyable, - * by appending a single tab char with lots of fragment - * cells following it. - * - * Otherwise, just append empty cells that will show up - * as a space each. - */ - - old_len = _vte_row_data_length (rowdata); - _vte_row_data_fill (rowdata, &basic_cell, newcol); - - /* Insert smart tab if there's nothing in the line after - * us, not even empty cells (with non-default background - * color for example). - * - * Notable bugs here: 545924, 597242, 764330 */ - if (col >= old_len && newcol - col <= VTE_TAB_WIDTH_MAX) { - glong i; - VteCell *cell = _vte_row_data_get_writable (rowdata, col); - VteCell tab = *cell; - tab.attr.set_columns(newcol - col); - tab.c = '\t'; - /* Save tab char */ - *cell = tab; - /* And adjust the fragments */ - for (i = col + 1; i < newcol; i++) { - cell = _vte_row_data_get_writable (rowdata, i); - cell->c = '\t'; - cell->attr.set_columns(1); - cell->attr.set_fragment(true); - } - } + if ((v & 0xff) != v) + return false; - invalidate_cells(m_screen->cursor.col, newcol - m_screen->cursor.col, - m_screen->cursor.row, 1); - m_screen->cursor.col = newcol; - } -} + color = (uint32_t)v; + return true; + } + } + } -void -VteTerminalPrivate::seq_cursor_forward_tabulation(vte::parser::Params const& params) -{ - auto val = std::max(std::min(params.number_or_default_at(0, 1), - m_column_count - m_screen->cursor.col), - long(1)); - for (auto i = 0; i < val; i++) - move_cursor_tab(); + return false; } -/* Clear tabs selectively. */ void -VteTerminalPrivate::seq_tab_clear(vte::parser::Params const& params) +Terminal::erase_in_display(vte::parser::Sequence const& seq) { - auto param = params.number_or_default_at(0, 0); + /* We don't implement the protected attribute, so we can ignore selective: + * bool selective = (seq.command() == VTE_CMD_DECSED); + */ - if (param == 0) { - clear_tabstop(m_screen->cursor.col); - } else if (param == 3) { - if (m_tabstops != nullptr) { - g_hash_table_destroy(m_tabstops); - m_tabstops = nullptr; - } + switch (seq.collect1(0)) { + case -1: /* default */ + case 0: + /* Clear below the current line. */ + clear_below_current(); + break; + case 1: + /* Clear above the current line. */ + clear_above_current(); + /* Clear everything to the left of the cursor, too. */ + /* FIXME: vttest. */ + clear_to_bol(); + break; + case 2: + /* Clear the entire screen. */ + clear_screen(); + break; + case 3: + /* Drop the scrollback. */ + drop_scrollback(); + break; + default: + break; } -} - -/* Cursor up N lines, no scrolling. */ -void -VteTerminalPrivate::seq_cursor_up(vte::parser::Params const& params) -{ - auto val = params.number_or_default_at(0, 1); - move_cursor_up(val); + /* We've modified the display. Make a note of it. */ + m_text_deleted_flag = TRUE; } void -VteTerminalPrivate::move_cursor_up(vte::grid::row_t rows) +Terminal::erase_in_line(vte::parser::Sequence const& seq) { - rows = CLAMP(rows, 1, m_row_count); + /* We don't implement the protected attribute, so we can ignore selective: + * bool selective = (seq.command() == VTE_CMD_DECSEL); + */ - //FIXMEchpe why not do this afterward? - ensure_cursor_is_onscreen(); + switch (seq.collect1(0)) { + case -1: /* default */ + case 0: + /* Clear to end of the line. */ + clear_to_eol(); + break; + case 1: + /* Clear to start of the line. */ + clear_to_bol(); + break; + case 2: + /* Clear the entire line. */ + clear_current_line(); + break; + default: + break; + } + /* We've modified the display. Make a note of it. */ + m_text_deleted_flag = TRUE; +} - vte::grid::row_t start; - //FIXMEchpe why not check m_origin_mode here? +void +Terminal::insert_lines(vte::grid::row_t param) +{ + vte::grid::row_t end, i; + + /* Find the region we're messing with. */ + auto row = m_screen->cursor.row; if (m_scrolling_restricted) { - start = m_screen->insert_delta + m_scrolling_region.start; + end = m_screen->insert_delta + m_scrolling_region.end; } else { - start = m_screen->insert_delta; + end = m_screen->insert_delta + m_row_count - 1; } - m_screen->cursor.row = MAX(m_screen->cursor.row - rows, start); + /* Only allow to insert as many lines as there are between this row + * and the end of the scrolling region. See bug #676090. + */ + auto limit = end - row + 1; + param = MIN (param, limit); + + for (i = 0; i < param; i++) { + /* Clear a line off the end of the region and add one to the + * top of the region. */ + ring_remove(end); + ring_insert(row, true); + } + m_screen->cursor.col = 0; + /* Update the display. */ + scroll_region(row, end - row + 1, param); + /* Adjust the scrollbars if necessary. */ + adjust_adjustments(); + /* We've modified the display. Make a note of it. */ + m_text_inserted_flag = TRUE; } -/* Vertical tab. */ void -VteTerminalPrivate::seq_vertical_tab(vte::parser::Params const& params) +Terminal::delete_lines(vte::grid::row_t param) { - line_feed(); -} + vte::grid::row_t end, i; -/* Parse parameters of SGR 38, 48 or 58, starting at @index within @params. - * If @might_contain_color_space_id, a true color sequence sequence is started, and after - * its leading number "2" at least 4 more parameters are present, then there's an (ignored) - * color_space_id before the three color components. See the comment below in - * seq_character_attributes() to understand the different accepted formats. - * Returns the color index, or -1 on error. - * Increments @index to point to the last consumed parameter (not beyond). */ + /* Find the region we're messing with. */ + auto row = m_screen->cursor.row; + if (m_scrolling_restricted) { + end = m_screen->insert_delta + m_scrolling_region.end; + } else { + end = m_screen->insert_delta + m_row_count - 1; + } -template -int32_t -VteTerminalPrivate::parse_sgr_38_48_parameters(vte::parser::Params const& params, - unsigned int *index, - bool might_contain_color_space_id) -{ - auto n_params = params.size(); - if (*index < n_params) { - long param0; - if (G_UNLIKELY(!params.number_at_unchecked(*index, param0))) - return -1; - - switch (param0) { - case 2: { - if (G_UNLIKELY(*index + 3 >= n_params)) - return -1; - if (might_contain_color_space_id && *index + 5 <= n_params) - *index += 1; - - long param1, param2, param3; - if (G_UNLIKELY(!params.number_at_unchecked(*index + 1, param1) || - !params.number_at_unchecked(*index + 2, param2) || - !params.number_at_unchecked(*index + 3, param3))) - return -1; - - if (G_UNLIKELY (param1 < 0 || param1 >= 256 || param2 < 0 || param2 >= 256 || param3 < 0 || param3 >= 256)) - return -1; - *index += 3; - - return VTE_RGB_COLOR(redbits, greenbits, bluebits, param1, param2, param3); - } - case 5: { - long param1; - if (G_UNLIKELY(!params.number_at(*index + 1, param1))) - return -1; - - if (G_UNLIKELY(param1 < 0 || param1 >= 256)) - return -1; - *index += 1; - return param1; - } - } + /* Only allow to delete as many lines as there are between this row + * and the end of the scrolling region. See bug #676090. + */ + auto limit = end - row + 1; + param = MIN (param, limit); + + /* Clear them from below the current cursor. */ + for (i = 0; i < param; i++) { + /* Insert a line at the end of the region and remove one from + * the top of the region. */ + ring_remove(row); + ring_insert(end, true); } - return -1; + m_screen->cursor.col = 0; + /* Update the display. */ + scroll_region(row, end - row + 1, -param); + /* Adjust the scrollbars if necessary. */ + adjust_adjustments(); + /* We've modified the display. Make a note of it. */ + m_text_deleted_flag = TRUE; } -/* Handle ANSI color setting and related stuffs (SGR). - * @params contains the values split at semicolons, with sub arrays splitting at colons - * wherever colons were encountered. */ -void -VteTerminalPrivate::seq_character_attributes(vte::parser::Params const& params) -{ - /* Step through each numeric parameter. */ - auto n_params = params.size(); - unsigned int i; - for (i = 0; i < n_params; i++) { - /* If this parameter is an array, it can be a fully colon separated 38 or 48 - * (see below for details). */ - if (G_UNLIKELY(params.has_subparams_at_unchecked(i))) { - auto subparams = params.subparams_at_unchecked(i); - - long param0, param1; - if (G_UNLIKELY(!subparams.number_at(0, param0))) - continue; - - switch (param0) { - case 4: - if (subparams.number_at(1, param1) && param1 >= 0 && param1 <= 3) - m_defaults.attr.set_underline(param1); - break; - case 38: { - unsigned int index = 1; - auto color = parse_sgr_38_48_parameters<8, 8, 8>(subparams, &index, true); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_fore(color); - break; - } - case 48: { - unsigned int index = 1; - auto color = parse_sgr_38_48_parameters<8, 8, 8>(subparams, &index, true); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_back(color); - break; - } - case 58: { - unsigned int index = 1; - auto color = parse_sgr_38_48_parameters<4, 5, 4>(subparams, &index, true); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_deco(color); - break; - } - } +bool +Terminal::get_osc_color_index(int osc, + int value, + int& index) const noexcept +{ + if (value < 0) + return false; + + if (osc == VTE_OSC_XTERM_SET_COLOR || + osc == VTE_OSC_XTERM_RESET_COLOR) { + if (value < VTE_DEFAULT_FG) { + index = value; + return true; + } - continue; - } - /* If this parameter is not a number either, skip it. */ - long param; - if (!params.number_at_unchecked(i, param)) - continue; + index = value - VTE_DEFAULT_FG; + } else { + index = value; + } - switch (param) { - case 0: - reset_default_attributes(false); - break; - case 1: - m_defaults.attr.set_bold(true); - break; - case 2: - m_defaults.attr.set_dim(true); - break; - case 3: - m_defaults.attr.set_italic(true); - break; - case 4: - m_defaults.attr.set_underline(1); - break; - case 5: - m_defaults.attr.set_blink(true); - break; - case 7: - m_defaults.attr.set_reverse(true); - break; - case 8: - m_defaults.attr.set_invisible(true); - break; - case 9: - m_defaults.attr.set_strikethrough(true); - break; - case 21: - m_defaults.attr.set_underline(2); - break; - case 22: /* ECMA 48. */ - m_defaults.attr.unset(VTE_ATTR_BOLD_MASK | VTE_ATTR_DIM_MASK); - break; - case 23: - m_defaults.attr.set_italic(false); - break; - case 24: - m_defaults.attr.set_underline(0); - break; - case 25: - m_defaults.attr.set_blink(false); - break; - case 27: - m_defaults.attr.set_reverse(false); - break; - case 28: - m_defaults.attr.set_invisible(false); - break; - case 29: - m_defaults.attr.set_strikethrough(false); - break; - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - m_defaults.attr.set_fore(VTE_LEGACY_COLORS_OFFSET + (param - 30)); - break; - case 38: - case 48: - case 58: - { - /* The format looks like: - * - 256 color indexed palette: - * - ^[[38:5:INDEXm (de jure standard: ITU-T T.416 / ISO/IEC 8613-6; we also allow and ignore further parameters) - * - ^[[38;5;INDEXm (de facto standard, understood by probably all terminal emulators that support 256 colors) - * - true colors: - * - ^[[38:2:[id]:RED:GREEN:BLUE[:...]m (de jure standard: ITU-T T.416 / ISO/IEC 8613-6) - * - ^[[38:2:RED:GREEN:BLUEm (common misinterpretation of the standard, FIXME: stop supporting it at some point) - * - ^[[38;2;RED;GREEN;BLUEm (de facto standard, understood by probably all terminal emulators that support true colors) - * See bugs 685759 and 791456 for details. - * The colon version was handled above separately. - * This branch here is reached when the separators are semicolons. */ - if ((i + 1) < n_params) { - ++i; - int32_t color; - switch (param) { - case 38: - color = parse_sgr_38_48_parameters<8 ,8 ,8>(params, &i, false); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_fore(color); - break; - case 48: - color = parse_sgr_38_48_parameters<8, 8, 8>(params, &i, false); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_back(color); - break; - case 58: - color = parse_sgr_38_48_parameters<4, 5, 4>(params, &i, false); - g_printerr("Parsed semicoloned deco colour: %x\n", color); - if (G_LIKELY (color != -1)) - m_defaults.attr.set_deco(color); - break; - } - } - break; - } - case 39: - /* default foreground */ - m_defaults.attr.set_fore(VTE_DEFAULT_FG); - break; - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - m_defaults.attr.set_back(VTE_LEGACY_COLORS_OFFSET + (param - 40)); - break; - /* case 48: was handled above at 38 to avoid code duplication */ - case 49: - /* default background */ - m_defaults.attr.set_back(VTE_DEFAULT_BG); - break; - case 53: - m_defaults.attr.set_overline(true); - break; - case 55: - m_defaults.attr.set_overline(false); - break; - /* case 58: was handled above at 38 to avoid code duplication */ - case 59: - /* default decoration color, that is, same as the cell's foreground */ - m_defaults.attr.set_deco(VTE_DEFAULT_FG); - break; - case 90: - case 91: - case 92: - case 93: - case 94: - case 95: - case 96: - case 97: - m_defaults.attr.set_fore(VTE_LEGACY_COLORS_OFFSET + (param - 90) + - VTE_COLOR_BRIGHT_OFFSET); - break; - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - m_defaults.attr.set_back(VTE_LEGACY_COLORS_OFFSET + (param - 100) + - VTE_COLOR_BRIGHT_OFFSET); - break; - } - } - /* If we had no parameters, default to the defaults. */ - if (i == 0) { - reset_default_attributes(false); - } - /* Save the new colors. */ - m_color_defaults.attr.copy_colors(m_defaults.attr); - m_fill_defaults.attr.copy_colors(m_defaults.attr); + /* Translate OSC 5 numbers to color index. + * + * We return -1 for known but umimplemented special colors + * so that we can send a dummy reply when queried. + */ + switch (index) { + case 0: index = VTE_BOLD_FG; return true; /* Bold */ + case 1: index = -1; return true; /* Underline */ + case 2: index = -1; return true; /* Blink */ + case 3: index = -1; return true; /* Reverse */ + case 4: index = -1; return true; /* Italic */ + default: return false; + } } -/* Move the cursor to the given column in the top row, 1-based. */ void -VteTerminalPrivate::seq_cursor_position_top_row(vte::parser::Params const& params) -{ - auto colval = params.number_or_default_at(0, 1) - 1; - set_cursor_coords(0, colval); +Terminal::set_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int osc) noexcept +{ + while (token != endtoken) { + int value; + bool has_value = token.number(value); -} + if (++token == endtoken) + break; -/* Request terminal attributes. */ -void -VteTerminalPrivate::seq_request_terminal_parameters(vte::parser::Params const& params) -{ - feed_child("\e[?x", -1); -} + int index; + if (!has_value || + !get_osc_color_index(osc, value, index)) { + ++token; + continue; + } -/* Request terminal attributes. */ -void -VteTerminalPrivate::seq_return_terminal_status(vte::parser::Params const& params) -{ - feed_child("", 0); + set_color_index(seq, token, endtoken, value, index, -1, osc); + ++token; + } } -/* Send primary device attributes. */ void -VteTerminalPrivate::seq_send_primary_device_attributes(vte::parser::Params const& params) -{ - /* Claim to be a VT220 with only national character set support. */ - feed_child("\e[?62;c", -1); -} +Terminal::set_color_index(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int number, + int index, + int index_fallback, + int osc) noexcept +{ + auto const str = *token; + + if (str == "?"s) { + vte::color::rgb color{0, 0, 0}; + if (index != -1) { + auto const* c = get_color(index); + if (c == nullptr && index_fallback != -1) + c = get_color(index_fallback); + if (c != nullptr) + color = *c; + } -/* Send terminal ID. */ -void -VteTerminalPrivate::seq_return_terminal_id(vte::parser::Params const& params) -{ - seq_send_primary_device_attributes(params); -} + if (number != -1) + reply(seq, VTE_REPLY_OSC, {}, "%d;%d;rgb:%04x/%04x/%04x", + osc, number, color.red, color.green, color.blue); + else + reply(seq, VTE_REPLY_OSC, {}, "%d;rgb:%04x/%04x/%04x", + osc, color.red, color.green, color.blue); + } else { + vte::color::rgb color; -/* Send secondary device attributes. */ -void -VteTerminalPrivate::seq_send_secondary_device_attributes(vte::parser::Params const& params) -{ - char **version; - char buf[128]; - long ver = 0, i; - /* Claim to be a VT220, more or less. The '>' in the response appears - * to be undocumented. */ - version = g_strsplit(VERSION, ".", 0); - if (version != NULL) { - for (i = 0; version[i] != NULL; i++) { - ver = ver * 100; - ver += atol(version[i]); - } - g_strfreev(version); - } - g_snprintf(buf, sizeof (buf), _VTE_CAP_ESC "[>1;%ld;0c", ver); - feed_child(buf, -1); + if (index != -1 && + color.parse(str.data())) { + set_color(index, VTE_COLOR_SOURCE_ESCAPE, color); + } + } } -/* Set one or the other. */ void -VteTerminalPrivate::seq_set_icon_title(vte::parser::Params const& params) +Terminal::set_special_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int index, + int index_fallback, + int osc) noexcept { - set_title_internal(params, true, false); -} + if (token == endtoken) + return; -void -VteTerminalPrivate::seq_set_window_title(vte::parser::Params const& params) -{ - set_title_internal(params, false, true); + set_color_index(seq, token, endtoken, -1, index, index_fallback, osc); } -/* Set both the window and icon titles to the same string. */ void -VteTerminalPrivate::seq_set_icon_and_window_title(vte::parser::Params const& params) +Terminal::reset_color(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken, + int osc) noexcept { - set_title_internal(params, true, true); + /* Empty param? Reset all */ + if (token == endtoken || + token.size_remaining() == 0) { + if (osc == VTE_OSC_XTERM_RESET_COLOR) { + for (unsigned int idx = 0; idx < VTE_DEFAULT_FG; idx++) + reset_color(idx, VTE_COLOR_SOURCE_ESCAPE); + } + + reset_color(VTE_BOLD_FG, VTE_COLOR_SOURCE_ESCAPE); + /* Add underline/blink/reverse/italic here if/when implemented */ + + return; + } + + while (token != endtoken) { + int value; + if (!token.number(value)) + continue; + + int index; + if (get_osc_color_index(osc, value, index) && + index != -1) { + reset_color(index, VTE_COLOR_SOURCE_ESCAPE); + } + + ++token; + } } void -VteTerminalPrivate::seq_set_current_directory_uri(vte::parser::Params const& params) -{ - char* uri = nullptr; - if (params.string_at(0, uri)) { - /* Validate URI */ - if (uri[0]) { - auto filename = g_filename_from_uri (uri, nullptr, nullptr); - if (filename == nullptr) { - /* invalid URI */ - g_free (uri); - uri = nullptr; - } else { - g_free (filename); - } +Terminal::set_current_directory_uri(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept +{ + std::string uri; + if (token != endtoken && token.size_remaining() > 0) { + uri = token.string_remaining(); + + auto filename = g_filename_from_uri(uri.data(), nullptr, nullptr); + if (filename != nullptr) { + g_free(filename); } else { - g_free(uri); - uri = nullptr; + /* invalid URI */ + uri.clear(); } } - g_free(m_current_directory_uri_changed); - m_current_directory_uri_changed = uri /* adopt */; + m_current_directory_uri_pending.swap(uri); + m_current_directory_uri_changed = true; } void -VteTerminalPrivate::seq_set_current_file_uri(vte::parser::Params const& params) +Terminal::set_current_file_uri(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept + { - char* uri = nullptr; - if (params.string_at(0, uri)) { - /* Validate URI */ - if (uri[0]) { - auto filename = g_filename_from_uri (uri, nullptr, nullptr); - if (filename == nullptr) { - /* invalid URI */ - g_free (uri); - uri = nullptr; - } else { - g_free (filename); - } + std::string uri; + if (token != endtoken && token.size_remaining() > 0) { + uri = token.string_remaining(); + + auto filename = g_filename_from_uri(uri.data(), nullptr, nullptr); + if (filename != nullptr) { + g_free(filename); } else { - g_free(uri); - uri = nullptr; + /* invalid URI */ + uri.clear(); } } - g_free(m_current_file_uri_changed); - m_current_file_uri_changed = uri /* adopt */; + m_current_file_uri_pending.swap(uri); + m_current_file_uri_changed = true; } -/* Handle OSC 8 hyperlinks. - * See bug 779734 and https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda. */ void -VteTerminalPrivate::seq_set_current_hyperlink(vte::parser::Params const& params) +Terminal::set_current_hyperlink(vte::parser::Sequence const& seq, + vte::parser::StringTokeniser::const_iterator& token, + vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept { + if (token == endtoken) + return; // FIXMEchpe or should we treat this as a reset? + + /* Handle OSC 8 hyperlinks. + * See bug 779734 and https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda + */ + + if (!m_allow_hyperlink) + return; + + /* The hyperlink, as we carry around and store in the streams, is "id;uri" */ + std::string hyperlink; + + /* First, find the ID */ + auto tokenstr = *token; + vte::parser::StringTokeniser subtokeniser{tokenstr, ':'}; + for (auto subtoken : subtokeniser) { + auto const len = subtoken.size(); + if (len < 3) + continue; + + if (subtoken[0] != 'i' || subtoken[1] != 'd' || subtoken[2] != '=') + continue; + + if (len > 3 + VTE_HYPERLINK_ID_LENGTH_MAX) { + _vte_debug_print (VTE_DEBUG_HYPERLINK, "Overlong \"id\" ignored: \"%s\"\n", + subtoken.data()); + break; + } - char* hyperlink_params = nullptr; - char* uri = nullptr; - if (params.size() >= 2) { - params.string_at_unchecked(0, hyperlink_params); - params.string_at_unchecked(1, uri); + hyperlink = subtoken.substr(3); + break; } - set_current_hyperlink(hyperlink_params, uri); -} + if (hyperlink.size() == 0) { + /* Automatically generate a unique ID string. The colon makes sure + * it cannot conflict with an explicitly specified one. + */ + char idbuf[24]; + auto len = g_snprintf(idbuf, sizeof(idbuf), ":%ld", m_hyperlink_auto_id++); + hyperlink.append(idbuf, len); + _vte_debug_print (VTE_DEBUG_HYPERLINK, "Autogenerated id=\"%s\"\n", hyperlink.data()); + } -void -VteTerminalPrivate::set_current_hyperlink(char *hyperlink_params /* adopted */, - char* uri /* adopted */) -{ + /* Now get the URI */ + if (++token == endtoken) + return; // FIXMEchpe or should we treat this the same as 0-length URI ? + + hyperlink.push_back(';'); guint idx; - char *id = NULL; - char idbuf[24]; + auto const len = token.size_remaining(); + if (len > 0 && len <= VTE_HYPERLINK_URI_LENGTH_MAX) { + token.append_remaining(hyperlink); - if (!m_allow_hyperlink) - return; + _vte_debug_print (VTE_DEBUG_HYPERLINK, "OSC 8: id;uri=\"%s\"\n", hyperlink.data()); - /* Get the "id" parameter */ - if (hyperlink_params) { - if (strncmp(hyperlink_params, "id=", 3) == 0) { - id = hyperlink_params + 3; - } else { - id = strstr(hyperlink_params, ":id="); - if (id) - id += 4; - } - } - if (id) { - *strchrnul(id, ':') = '\0'; - } - _vte_debug_print (VTE_DEBUG_HYPERLINK, - "OSC 8: id=\"%s\" uri=\"%s\"\n", - id, uri); - - if (uri && strlen(uri) > VTE_HYPERLINK_URI_LENGTH_MAX) { - _vte_debug_print (VTE_DEBUG_HYPERLINK, - "Overlong URI ignored: \"%s\"\n", - uri); - uri[0] = '\0'; - } - - if (id && strlen(id) > VTE_HYPERLINK_ID_LENGTH_MAX) { - _vte_debug_print (VTE_DEBUG_HYPERLINK, - "Overlong \"id\" ignored: \"%s\"\n", - id); - id[0] = '\0'; - } - - if (uri && uri[0]) { - /* The hyperlink, as we carry around and store in the streams, is "id;uri" */ - char *hyperlink; - - if (!id || !id[0]) { - /* Automatically generate a unique ID string. The colon makes sure - * it cannot conflict with an explicitly specified one. */ - sprintf(idbuf, ":%ld", m_hyperlink_auto_id++); - id = idbuf; - _vte_debug_print (VTE_DEBUG_HYPERLINK, - "Autogenerated id=\"%s\"\n", - id); - } - hyperlink = g_strdup_printf("%s;%s", id, uri); - idx = _vte_ring_get_hyperlink_idx(m_screen->row_data, hyperlink); - g_free (hyperlink); + idx = _vte_ring_get_hyperlink_idx(m_screen->row_data, hyperlink.data()); } else { + if (G_UNLIKELY(len > VTE_HYPERLINK_URI_LENGTH_MAX)) + _vte_debug_print (VTE_DEBUG_HYPERLINK, "Overlong URI ignored (len %" G_GSIZE_FORMAT ")\n", len); + /* idx = 0; also remove the previous current_idx so that it can be GC'd now. */ - idx = _vte_ring_get_hyperlink_idx(m_screen->row_data, NULL); + idx = _vte_ring_get_hyperlink_idx(m_screen->row_data, nullptr); } m_defaults.attr.hyperlink_idx = idx; - - g_free(hyperlink_params); - g_free(uri); } -/* Restrict the scrolling region. */ +/* + * Command Handlers + * This is the unofficial documentation of all the VTE_CMD_* definitions. + * Each handled command has a separate function with an extensive comment on + * the semantics of the command. + * Note that many semantics are unknown and need to be verified. This is mostly + * about error-handling, though. Applications rarely rely on those features. + */ + void -VteTerminalPrivate::seq_set_scrolling_region_from_start(vte::parser::Params const& params) +Terminal::NONE(vte::parser::Sequence const& seq) { - /* We require a parameters. Anything less is a reset. */ - if (params.size() < 1) - return reset_scrolling_region(); - - auto end = params.number_or_default_at(1) - 1; - set_scrolling_region(-1, end); - } void -VteTerminalPrivate::seq_set_scrolling_region_to_end(vte::parser::Params const& params) +Terminal::GRAPHIC(vte::parser::Sequence const& seq) { - /* We require a parameters. Anything less is a reset. */ - if (params.size() < 1) - return reset_scrolling_region(); +#if 0 + struct vte_char ch = VTE_CHAR_NULL; - auto start = params.number_or_default_at(0) - 1; - set_scrolling_region(start, -1); + if (screen->state.cursor_x + 1 == screen->page->width + && screen->flags & VTE_FLAG_PENDING_WRAP + && screen->state.auto_wrap) { + screen_cursor_down(screen, 1, true); + screen_cursor_set(screen, 0, screen->state.cursor_y); + } -} + screen_cursor_clear_wrap(screen); -void -VteTerminalPrivate::set_keypad_mode(VteKeymode mode) -{ - m_keypad_mode = mode; + ch = vte_char_merge(ch, screen_map(screen, seq->terminator)); + vte_page_write(screen->page, + screen->state.cursor_x, + screen->state.cursor_y, + ch, + 1, + &screen->state.attr, + screen->age, + false); + + if (screen->state.cursor_x + 1 == screen->page->width) + screen->flags |= VTE_FLAG_PENDING_WRAP; + else + screen_cursor_right(screen, 1); + + return 0; +#endif + + insert_char(seq.terminator(), false, false); } -/* Set the application or normal keypad. */ void -VteTerminalPrivate::seq_application_keypad(vte::parser::Params const& params) +Terminal::ACK(vte::parser::Sequence const& seq) { - _vte_debug_print(VTE_DEBUG_KEYBOARD, - "Entering application keypad mode.\n"); - set_keypad_mode(VTE_KEYMODE_APPLICATION); + /* + * ACK - acknowledge + * + * References: ECMA-48 § 8.3.1 + */ + + m_bell_pending = true; } void -VteTerminalPrivate::seq_normal_keypad(vte::parser::Params const& params) +Terminal::ACS(vte::parser::Sequence const& seq) { - _vte_debug_print(VTE_DEBUG_KEYBOARD, - "Leaving application keypad mode.\n"); - set_keypad_mode(VTE_KEYMODE_NORMAL); + /* ACS - announce-code-structure + * + * The final byte of the sequence identifies the facility number + * from 1 to 62 starting with 4/01. + * + * References: ECMA-35 § 15.2 + */ + + /* Since we mostly don't implement ECMA-35 anymore, we can mostly ignore this */ + + switch (seq.terminator() - 0x40) { + case 6: + /* + * This causes the terminal to start sending C1 controls as 7bit + * sequences instead of 8bit C1 controls. + * This is ignored if the terminal is below level-2 emulation mode + * (VT100 and below), the terminal already sends 7bit controls then. + * + * References: ECMA-35 + * VT525 + */ +#if 0 + if (screen->conformance_level > VTE_CONFORMANCE_LEVEL_VT100) + screen->flags |= VTE_FLAG_7BIT_MODE; +#endif + break; + + case 7: + /* + * This causes the terminal to start sending C1 controls as 8bit C1 + * control instead of 7bit sequences. + * This is ignored if the terminal is below level-2 emulation mode + * (VT100 and below). The terminal always sends 7bit controls in those + * modes. + * + * References: ECMA-35 + * VT525 + */ +#if 0 + if (screen->conformance_level > VTE_CONFORMANCE_LEVEL_VT100) + screen->flags &= ~VTE_FLAG_7BIT_MODE; +#endif + break; + + case 12: + /* Use Level 1 of ECMA-43 + * + * Probably not worth implementing. + */ + break; + case 13: + /* Use Level 2 of ECMA-43 + * + * Probably not worth implementing. + * + * On a VTxxx, both levels 1 and 2 designate as follows: + * G0 = ASCII (IR #6) + * G1 = ISO_LATIN1_SUPPLEMENTAL + * with G0 mapped to GL, G1 to GR. + * + * References: VT525 + */ + break; + case 14: + /* Use Level 3 of ECMA-43 + * + * Probably not worth implementing. + * + * On a VTxxx, this designates as follows: + * G0 = ASCII (IR #6) + * with G0 mapped to GL. + * + * + * References: VT525 + */ + break; + } } -/* Same as cursor_character_absolute, not widely supported. */ void -VteTerminalPrivate::seq_character_position_absolute(vte::parser::Params const& params) +Terminal::BEL(vte::parser::Sequence const& seq) { - seq_cursor_character_absolute (params); + /* + * BEL - sound bell tone + * This command should trigger an acoustic bell. + * + * References: ECMA-48 § 8.3.3 + */ + + m_bell_pending = true; } -/* Set certain terminal attributes. */ void -VteTerminalPrivate::seq_set_mode(vte::parser::Params const& params) +Terminal::BPH(vte::parser::Sequence const& seq) { - set_mode(params, true); + /* + * BPH - break permitted here + * + * References: ECMA-48 § 8.3.4 + * + * Not worth implementing. + */ } -/* Unset certain terminal attributes. */ void -VteTerminalPrivate::seq_reset_mode(vte::parser::Params const& params) +Terminal::BS(vte::parser::Sequence const& seq) { - set_mode(params, false); + /* + * BS - backspace + * Move cursor one cell to the left. If already at the left margin, + * nothing happens. + * + * References: ECMA-48 § 8.3.5 + */ + +#if 0 + screen_cursor_clear_wrap(screen); + screen_cursor_left(screen, 1); +#endif + + ensure_cursor_is_onscreen(); + + if (m_screen->cursor.col > 0) { + /* There's room to move left, so do so. */ + m_screen->cursor.col--; + } +} + +void +Terminal::CBT(vte::parser::Sequence const& seq) +{ + /* + * CBT - cursor-backward-tabulation + * Move the cursor @args[0] tabs backwards (to the left). The + * current cursor cell, in case it's a tab, is not counted. + * Furthermore, the cursor cannot be moved beyond position 0 and + * it will stop there. + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.7 + */ +#if 0 + screen_cursor_clear_wrap(screen); +#endif + + move_cursor_tab_backward(seq.collect1(0, 1)); +} + +void +Terminal::CCH(vte::parser::Sequence const& seq) +{ + /* + * CCH - cancel character + * Indicates that the CCH and the preceding graphic character + * (including SPACE (2/0)) in the data stream should be ignored. + * If CCH is not preceded by a graphic character but by a + * control function instead, CCH is ignored. + * + * References: ECMA-48 § 8.3.8 + * + * Not worth implementing. + */ +} + +void +Terminal::CHA(vte::parser::Sequence const& seq) +{ + /* + * CHA - cursor-horizontal-absolute + * Move the cursor to position @args[0] in the current line + * (presentation). + * The cursor cannot be moved beyond the rightmost cell; it will + * stop there. + * + * Arguments: + * args[0]: column + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.9 + */ + +#if 0 + unsigned int pos = 1; + + if (seq->args[0] > 0) + pos = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_set(screen, pos - 1, screen->state.cursor_y); +#endif + + auto value = seq.collect1(0, 1, 1, m_column_count); + set_cursor_column1(value); +} + +void +Terminal::CHT(vte::parser::Sequence const& seq) +{ + /* + * CHT - cursor-horizontal-forward-tabulation + * Move the cursor @args[0] tabs forward (to the right) (presentation). + * The current cursor cell, in case it's a tab, is not counted. + * Furthermore, the cursor cannot be moved beyond the rightmost cell + * and will stop there. + * + * Arguments: + * args[0]: count + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.10 + */ +#if 0 + screen_cursor_clear_wrap(screen); +#endif + + move_cursor_tab_forward(seq.collect1(0, 1)); +} + +void +Terminal::CMD(vte::parser::Sequence const& seq) +{ + /* + * CMD - coding method delimiter + * + * References: ECMA-35 § 15.3 + * ECMA-48 § 8.3.11 + * + * Not worth implementing. + */ +} + +void +Terminal::CNL(vte::parser::Sequence const& seq) +{ + /* + * CNL - cursor-next-line + * Move the cursor @args[0] lines down. + * + * TODO: Does this stop at the bottom or cause a scroll-up? + * + * Arguments: + * args[0]: number of lines + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 §8.3.12 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_down(screen, num, false); +#endif + + set_cursor_column1(1); + + auto value = seq.collect1(0, 1); + move_cursor_down(value); +} + +void +Terminal::CPL(vte::parser::Sequence const& seq) +{ + /* + * CPL - cursor-preceding-line + * Move the cursor @args[0] lines up, without scrolling. + * + * Arguments: + * args[0]: number of lines + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.13 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_up(screen, num, false); +#endif + + set_cursor_column(0); + + auto const value = seq.collect1(0, 1); + move_cursor_up(value); +} + +void +Terminal::CR(vte::parser::Sequence const& seq) +{ + /* + * CR - carriage-return + * Move the cursor to the left margin on the current line. + * + * References: ECMA-48 § 8.3.15 + */ +#if 0 + screen_cursor_clear_wrap(screen); + screen_cursor_set(screen, 0, screen->state.cursor_y); +#endif + + set_cursor_column(0); +} + +void +Terminal::CTC(vte::parser::Sequence const& seq) +{ + /* + * CTC - cursor tabulation control + * Set/clear tabstops. + * + * For the cases @args[0] = 0, 2, 4, the effect depends on TSM mode. + * + * References: ECMA-48 § 8.3.17 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + /* Set tabstop at the current cursor position */ + m_tabstops.set(get_cursor_column()); + break; + + case 1: + /* Sets line tabstop in the ative line (presentation) */ + break; + + case 2: + /* Clear tabstop at the current cursor position */ + m_tabstops.unset(get_cursor_column()); + break; + + case 3: + /* Clear line tabstop in the active line */ + break; + + case 4: + /* Clear all tabstops in the active line */ + /* [[fallthrough]]; */ + case 5: + /* Clear all tabstops */ + m_tabstops.clear(); + break; + + case 6: + /* Clear all line tabstops */ + break; + + default: + break; + } +} + +void +Terminal::CUB(vte::parser::Sequence const& seq) +{ + /* + * CUB - cursor-backward + * Move the cursor @args[0] positions to the left. The cursor stops + * at the left-most position. (presentation) + * + * Arguments: + * args[0]: number of positions + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.18 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_left(screen, num); +#endif + + auto value = seq.collect1(0, 1); + move_cursor_backward(value); +} + +void +Terminal::CUD(vte::parser::Sequence const& seq) +{ + /* + * CUD - cursor-down + * Move the cursor @args[0] positions down. The cursor stops at the + * bottom margin. If it was already moved further, it stops at the + * bottom line. (presentation) + * + * Arguments: + * args[0]: number of positions + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.19 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_down(screen, num, false); +#endif + + auto value = seq.collect1(0, 1); + move_cursor_down(value); +} + +void +Terminal::CUF(vte::parser::Sequence const& seq) +{ + /* + * CUF -cursor-forward + * Move the cursor @args[0] positions to the right. The cursor stops + * at the right-most position. (presentation) + * + * Arguments: + * args[0]: number of positions + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.20 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_right(screen, num); +#endif + + auto value = seq.collect1(0, 1); + move_cursor_forward(value); +} + +void +Terminal::CUP(vte::parser::Sequence const& seq) +{ + /* + * CUP - cursor-position + * Moves the cursor to position @args[1] x @args[0]. If either is 0, it + * is treated as 1. The positions are subject to the origin-mode and + * clamped to the addressable width/height. (presentation) + * + * Arguments: + * args[0]: line + * args[0]: column + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * + * References: ECMA-48 § 8.3.21 + */ +#if 0 + unsigned int x = 1, y = 1; + + if (seq->args[0] > 0) + y = seq->args[0]; + if (seq->args[1] > 0) + x = seq->args[1]; + + screen_cursor_clear_wrap(screen); + screen_cursor_set_rel(screen, x - 1, y - 1); +#endif + + /* The first is the row, the second is the column. */ + auto rowvalue = seq.collect1(0, 1, 1, m_row_count); + auto colvalue = seq.collect1(seq.next(0), 1, 1, m_column_count); + set_cursor_coords1(rowvalue, colvalue); +} + +void +Terminal::CUU(vte::parser::Sequence const& seq) +{ + /* + * CUU - cursor-up + * Move the cursor @args[0] positions up. The cursor stops at the + * top margin. If it was already moved further, it stops at the + * top line. (presentation) + * + * Arguments: + * args[0]: number of positions + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.22 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_up(screen, num, false); +#endif + + auto const value = seq.collect1(0, 1); + move_cursor_up(value); +} + +void +Terminal::CVT(vte::parser::Sequence const& seq) +{ + /* + * CVT - cursor line tabulation + * Move the cursor @args[0] positions down. The cursor stops at the + * bottom margin. If it was already moved further, it stops at the + * bottom line. (presentation) + * + * Arguments: + * args[0]: number of positions + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.23 + */ + + /* FIXME: implement this? */ +} + +void +Terminal::CnD(vte::parser::Sequence const& seq) +{ + /* + * CnD - Cn-designate + * + * Designate a set of control functions. + * + * References: ECMA-35 § 14.2 + * ISO 2375 IR + */ + + /* Since we mostly don't implement ECMA-35 anymore, we can ignore this */ +} + +void +Terminal::DA1(vte::parser::Sequence const& seq) +{ + /* + * DA1 - primary-device-attributes + * The primary DA asks for basic terminal features. We simply return + * a hard-coded list of features we implement. + * Note that the primary DA asks for supported features, not currently + * enabled features. + * + * Reply: DECDA1R (CSI ? 65 ; ARGS c) + * + * The first argument, 65, is fixed and denotes a VT520 (a Level 5 + * terminal), the last DEC-term that extended this number. + * All following arguments denote supported features. Note + * that at most 15 features can be sent (max CSI args). It is safe to + * send more, but clients might not be able to parse them. This is a + * client's problem and we shouldn't care. There is no other way to + * send those feature lists, so we have to extend them beyond 15 in + * those cases. + * + * Known modes: + * 1: 132 column mode + * The 132 column mode is supported by the terminal. + * 2: printer port + * A priner-port is supported and can be addressed via + * control-codes. + * 3: ReGIS graphics + * Support for ReGIS graphics is available. The ReGIS routines + * provide the "remote graphics instruction set" and allow basic + * vector-rendering. + * 4: Sixel + * Support of Sixel graphics is available. This provides access + * to the sixel bitmap routines. + * 6: selective erase + * The terminal supports DECSCA and related selective-erase + * functions. This allows to protect specific cells from being + * erased, if specified. + * 7: soft character set (DRCS) + * TODO: ? + * 8: user-defined keys (UDKs) + * TODO: ? + * 9: national-replacement character sets (NRCS) + * National-replacement character-sets are available. + * 12: Serbo-Croatian (SCS) + * TODO: ? + * 15: technical character set + * The DEC technical-character-set is available. + * 18: windowing capability + * TODO: ? + * 19: sessions capability + * TODO: ? + * 21: horizontal scrolling + * TODO: ? + * 22: ANSI color + * TODO: ? + * 23: Greek + * TODO: ? + * 24: Turkish + * TODO: ? + * 29: DECterm text locator + * TODO: ? + * 42: ISO Latin-2 character set + * TODO: ? + * 44: PCTerm + * TODO: ? + * 45: soft key mapping + * TODO: ? + * 46: ASCII emulation + * TODO: ? + * + * Extensions which are implied by the level are not reported explicity + * (e.g. 6, 8, 15 in level 5). + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.24 + * VT525 + */ + + if (seq.collect1(0, 0) != 0) + return; + + reply(seq, VTE_REPLY_DECDA1R, {65, 1, 9}); +} + +void +Terminal::DA2(vte::parser::Sequence const& seq) +{ + /* + * DA2 - secondary-device-attributes + * The secondary DA asks for the terminal-ID, firmware versions and + * other non-primary attributes. All these values are + * informational-only and should not be used by the host to detect + * terminal features. + * + * Reply: DECDA2R (CSI > 65 ; FIRMWARE ; KEYBOARD c) + * where 65 is fixed for VT525 color terminals, the last terminal-line that + * increased this number (64 for VT520). FIRMWARE is the firmware + * version encoded as major/minor (20 == 2.0) and KEYBOARD is 0 for STD + * keyboard and 1 for PC keyboards. + * + * We replace the firmware-version with the VTE version so clients + * can decode it again. + * + * References: VT525 + */ + + /* Param != 0 means this is a reply, not a request */ + if (seq.collect1(0, 0) != 0) + return; + + int const version = (VTE_MAJOR_VERSION * 100 + VTE_MINOR_VERSION) * 100 + VTE_MICRO_VERSION; + reply(seq, VTE_REPLY_DECDA2R, {65, version, 1}); +} + +void +Terminal::DA3(vte::parser::Sequence const& seq) +{ + /* + * DA3 - tertiary-device-attributes + * The tertiary DA is used to query the terminal-ID. + * + * Reply: DECRPTUI + * DATA: four pairs of are hexadecimal number, encoded 4 bytes. + * The first byte denotes the manufacturing site, the remaining + * three is the terminal's ID. + * + * We always reply with '~VTE' encoded in hex. + */ + + if (seq.collect1(0, 0) != 0) + return; + + reply(seq, VTE_REPLY_DECRPTUI, {}); +} + +void +Terminal::DAQ(vte::parser::Sequence const& seq) +{ + /* + * DAQ - define area qualification + * + * Arguments: + * args[0]: type + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.25, § 6.5.2 + */ +} + +void +Terminal::DC1(vte::parser::Sequence const& seq) +{ + /* + * DC1 - device-control-1 or XON + * This clears any previous XOFF and resumes terminal-transmission. + * + * References: ECMA-48 § 8.3.28 + */ + + /* we do not support XON */ +} + +void +Terminal::DC2(vte::parser::Sequence const& seq) +{ + /* + * DC2 - device-control-2 + * + * References: ECMA-48 § 8.3.29 + * + * Not implemented. + */ +} + +void +Terminal::DC3(vte::parser::Sequence const& seq) +{ + /* + * DC3 - device-control-3 or XOFF + * Stops terminal transmission. No further characters are sent until + * an XON is received. + * + * References: ECMA-48 § 8.3.30 + */ + + /* we do not support XOFF */ +} + +void +Terminal::DC4(vte::parser::Sequence const& seq) +{ + /* + * DC4 - device-control-4 + * + * References: ECMA-48 § 8.3.31 + * + * Not implemented. + */ +} + +void +Terminal::DCH(vte::parser::Sequence const& seq) +{ + /* + * DCH - delete-character + * This deletes @argv[0] characters at the current cursor position. + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.26 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + vte_page_delete_cells(screen->page, + screen->state.cursor_x, + screen->state.cursor_y, + num, + &screen->state.attr, + screen->age); +#endif + + auto const value = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col)); + + // FIXMEchpe pass count to delete_character() and simplify + // to only cleanup fragments once + for (auto i = 0; i < value; i++) + delete_character(); +} + +void +Terminal::DECAC(vte::parser::Sequence const& seq) +{ + /* + * DECAC - assign color + * Assign the color used for normal text. + * + * Arguments: + * @args[0]: item; 1 for normal text, 2 for the text in the window frame + * @args[1]: foreground color palette index (0..15) + * @args[2]: background color palette index (0..15) + * + * References: VT525 + */ + + // FIXMEchpe maybe implement this, allowing our extended color + // format instead of just palette colors +} + +void +Terminal::DECALN(vte::parser::Sequence const& seq) +{ + /* + * DECALN - screen-alignment-pattern + * Resets the margins, homes the cursor, and fills the screen + * with 'E's. + * + * References: VT525 + */ + + // FIXMEchpe! reset margins and home cursor + + for (auto row = m_screen->insert_delta; + row < m_screen->insert_delta + m_row_count; + row++) { + /* Find this row. */ + while (_vte_ring_next(m_screen->row_data) <= row) + ring_append(false); + adjust_adjustments(); + auto rowdata = _vte_ring_index_writable (m_screen->row_data, row); + g_assert(rowdata != NULL); + /* Clear this row. */ + _vte_row_data_shrink (rowdata, 0); + + emit_text_deleted(); + /* Fill this row. */ + VteCell cell; + cell.c = 'E'; + cell.attr = basic_cell.attr; + cell.attr.set_columns(1); + _vte_row_data_fill(rowdata, &cell, m_column_count); + emit_text_inserted(); + } + invalidate_all(); + + /* We modified the display, so make a note of it for completeness. */ + m_text_modified_flag = TRUE; +} + +void +Terminal::DECARR(vte::parser::Sequence const& seq) +{ + /* + * DECARR - auto repeat rate + * Sets the key autorepeat rate in from @args[0] in keys/s. + * 0…5 are mapped to 0/s, 6…15 to 10/s, 16…30 to 30/s. + * Other values are ignored. The default is 30. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECATC(vte::parser::Sequence const& seq) +{ + /* + * DECATC - alternate text color + * Assign the color used for attribute combinations text. + * + * Arguments: + * @args[0]: selects the attribute combinations from a + * value table (0 = normal, 1 = bold, 2 = reverse, + * 3 = (single) underline, 4 = blink; then 5…15 + * encode the combinations) + * @args[1]: foreground color palette index (0..15) + * @args[2]: background color palette index (0..15) + * + * References: VT525 + */ + + // FIXMEchpe maybe implement this, allowing our extended color + // format instead of just palette colors +} + +void +Terminal::DECAUPSS(vte::parser::Sequence const& seq) +{ + /* + * DECAUPSS - assign user preferred supplemental sets + * Sets a supplemental charset as user preferred. + * Arguments: + * @args[0]: charset designator: + * 0 = DEC, Latin 1/2 + * 1 = Latin 5/7, ISO Cyrillic, ISO Hebrew + * DATA: the charset, as in a ECMA-35 charset designation + * sequence (sans the ESC); but only some charsets are + * supported. + * + * Default: DEC Supplemental Graphic set. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECBI(vte::parser::Sequence const& seq) +{ + /* + * DECBI - back-index + * This control function moves the cursor backward one column. If the + * cursor is at the left margin, then all screen data within the margin + * moves one column to the right. The column that shifted past the right + * margin is lost. + * DECBI adds a new column at the left margin with no visual attributes. + * DECBI does not affect the margins. If the cursor is beyond the + * left-margin at the left border, then the terminal ignores DECBI. + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECCARA(vte::parser::Sequence const& seq) +{ + /* + * DECCARA - change-attributes-in-rectangular-area + * Change some character attributes (bold, blink, reverse, + * (single) underline) in the specified rectangle. + * The characters in the area are unchanged. + * + * Arguments; + * args[0..3]: top, left, bottom, right of the rectangle (1-based) + * args[4:]: the character attributes to change; values as in SGR + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * args[4:]: no defaults + * + * If the top > bottom or left > right, the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECCKD(vte::parser::Sequence const& seq) +{ + /* + * DECCKD - copy key default + * Copy the defaults from one key to another. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECCRA(vte::parser::Sequence const& seq) +{ + /* + * DECCRA - copy-rectangular-area + * Copies characters and their attributes from one rectangle to + * another. + * + * Arguments; + * args[0..3]: top, left, bottom, right of the source rectangle (1-based) + * args[4..7]: top, left, bottom, right of the target rectangle (1-based) + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * args[4]: 1 + * args[5]: 1 + * args[6]: height of current page + * args[7]: width of current page + * + * If the top > bottom or left > right for either of the rectangles, + * the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECCRTST(vte::parser::Sequence const& seq) +{ + /* + * DECCRTST - CRT saver time + * Sets the CRT saver timer. When DECCRTSM is set, the + * screen blanks when the time elapsed since the last + * keystroke or output is greater than the time set here. + * + * Arguments: + * args[0]: the time in minutes (0…60) (0 = never) + * + * Default: 15 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDC(vte::parser::Sequence const& seq) +{ + /* + * DECDC - delete-column + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDHL_BH(vte::parser::Sequence const& seq) +{ + /* + * DECDHL_BH - double-width-double-height-line: bottom half + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDHL_TH(vte::parser::Sequence const& seq) +{ + /* + * DECDHL_TH - double-width-double-height-line: top half + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDLD(vte::parser::Sequence const& seq) +{ + /* + * DECDLD - dynamically redefinable character sets extension + * Loads a soft font for a DRCS charset from SIXEL data + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDLDA(vte::parser::Sequence const& seq) +{ + /* + * DECDLD - down line load allocation + * Sets the number of DRCSes allowed per sesion + * (monochrome terminals only). + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECDMAC(vte::parser::Sequence const& seq) +{ + /* + * DECDMAC - define-macro + * Define a macro that can be executed by DECINVM. + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECDWL(vte::parser::Sequence const& seq) +{ + /* + * DECDWL - double-width-single-height-line + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECEFR(vte::parser::Sequence const& seq) +{ + /* + * DECEFR - enable-filter-rectangle + * Defines the coordinates of a filter rectangle (top, left, bottom, + * right as @args[0] to @args[3]) and activates it. + * Anytime the locator is detected outside of the filter rectangle, an + * outside rectangle event is generated and the rectangle is disabled. + * Filter rectangles are always treated as "one-shot" events. Any + * parameters that are omitted default to the current locator position. + * If all parameters are omitted, any locator motion will be reported. + * DECELR always cancels any prevous rectangle definition. + * + * The locator is usually associated with the mouse-cursor, but based + * on cells instead of pixels. See DECELR how to initialize and enable + * it. DECELR can also enable pixel-mode instead of cell-mode. + * + * References: VT525 + * + * TODO: implement + */ +} + +void +Terminal::DECELF(vte::parser::Sequence const& seq) +{ + /* + * DECELF - enable-local-functions + * Enable or disable keys to perform local functions like + * copy/paster, panning and window resize. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECELR(vte::parser::Sequence const& seq) +{ + /* + * DECELR - enable-locator-reporting + * This changes the locator-reporting mode. @args[0] specifies the mode + * to set, 0 disables locator-reporting, 1 enables it continuously, 2 + * enables it for a single report. @args[1] specifies the + * precision-mode. 0 and 2 set the reporting to cell-precision, 1 sets + * pixel-precision. + * + * Defaults: + * args[0]: 0 + * args[1]: 0 + * + * References: VT525 + * + * TODO: implement + */ +} + +void +Terminal::DECERA(vte::parser::Sequence const& seq) +{ + /* + * DECERA - erase-rectangular-area + * Erases characters in the specified rectangle, replacing + * them with SPACE (2/0). Character attributes are erased + * too, but not line attributes (DECDHL, DECDWL). + * + * Arguments; + * args[0..3]: top, left, bottom, right of the rectangle (1-based) + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * + * If the top > bottom or left > right, the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECES(vte::parser::Sequence const& seq) +{ + /* + * DECES - enable session + * Makes this session active as if by the Session key; + * that is, makes the session receiving this command the + * session receiving keyboard input. + * + * References: VT525 + * + * VTE does not support sessions. + */ +} + +void +Terminal::DECFI(vte::parser::Sequence const& seq) +{ + /* + * DECFI - forward-index + * This control function moves the cursor forward one column. If the + * cursor is at the right margin, then all screen data within the + * margins moves one column to the left. The column shifted past the + * left margin is lost. + * DECFI adds a new column at the right margin, with no visual + * attributes. DECFI does not affect margins. If the cursor is beyond + * the right margin at the border of the page when the terminal + * receives DECFI, then the terminal ignores DECFI. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECFRA(vte::parser::Sequence const& seq) +{ + /* + * DECFRA - fill-rectangular-area + * Fills the specified rectangle with the specified character, + * replacing the current characters in it. Character attributes + * are replaced by the current default SGR. Does not change + * line attributes (DECDHL, DECDWL). + * + * Arguments; + * args[0]: the decimal value of the replacement character (GL or GR) + * args[0..3]: top, left, bottom, right of the rectangle (1-based) + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * + * If the top > bottom or left > right, the command is ignored. + * If the character is not in the GL or GR area, the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + * + * *If* we were to implement it, we should find a way to allow any + * UTF-8 character, perhaps by using subparams to encode it. E.g. + * either each UTF-8 byte in a subparam of its own, or just split + * the unicode plane off into the leading subparam (plane:remaining 16 bits). + * Or by using the last graphic character for it, like REP. + */ +} + +void +Terminal::DECIC(vte::parser::Sequence const& seq) +{ + /* + * DECIC - insert-column + * + * Defaults: + * args[0]: 1 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECINVM(vte::parser::Sequence const& seq) +{ + /* + * DECINVM - invoke-macro + * Invokes a macro defined by DECDMAC. + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECKBD(vte::parser::Sequence const& seq) +{ + /* + * DECKBD - keyboard-language-selection + * Selects a keyboard language. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECKPAM(vte::parser::Sequence const& seq) +{ + /* + * DECKPAM - keypad-application-mode + * Enables the keypad-application mode. If enabled, the keypad sends + * special characters instead of the printed characters. This way, + * applications can detect whether a numeric key was pressed on the + * top-row or on the keypad. + * Default is keypad-numeric-mode. + * + * References: VT525 + */ + + set_mode_private(vte::terminal::modes::Private::eDEC_APPLICATION_KEYPAD, true); +} + +void +Terminal::DECKPNM(vte::parser::Sequence const& seq) +{ + /* + * DECKPNM - keypad-numeric-mode + * This disables the keypad-application-mode (DECKPAM) and returns to + * the keypad-numeric-mode. Keypresses on the keypad generate the same + * sequences as corresponding keypresses on the main keyboard. + * Default is keypad-numeric-mode. + * + * References: VT525 + */ + set_mode_private(vte::terminal::modes::Private::eDEC_APPLICATION_KEYPAD, false); +} + +void +Terminal::DECLANS(vte::parser::Sequence const& seq) +{ + /* + * DECLANS - load answerback message + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECLBAN(vte::parser::Sequence const& seq) +{ + /* + * DECLBAN - load banner message + * Loads a banner message that will be displayed in double size + * characters when the terminal powers up. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECLBD(vte::parser::Sequence const& seq) +{ + /* + * DECLBD - locator button define + * + * References: VT330 + */ +} + +void +Terminal::DECLFKC(vte::parser::Sequence const& seq) +{ + /* + * DECLFKC - local-function-key-control + * Select the action for local function keys. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECLL(vte::parser::Sequence const& seq) +{ + /* + * DECLL - load-leds + * Sets the keyboard LEDs when in DECKLHIM mode. + * + * Arguments: + * args[0]: which LED to change to which state + * 0: NumLock, CapsLock, ScrollLock off + * 1, 21: NumLock on/off + * 2, 22: CapsLock on/off + * 3, 23: ScrollLock on/off + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECLTOD(vte::parser::Sequence const& seq) +{ + /* + * DECLTOD - load-time-of-day + * Sets the clock. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECPAK(vte::parser::Sequence const& seq) +{ + /* + * DECPAK - program alphanumeric key + * Program alphanumeric keys to send different codes or perform actions. + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECPCTERM(vte::parser::Sequence const& seq) +{ + /* + * DECPCTERM - pcterm-mode + * This enters/exits the PCTerm mode. Default mode is VT-mode. It can + * also select parameters for scancode/keycode mappings in SCO mode. + * + * References: VT525 + * + * Definitely not worth implementing. + */ +} + +void +Terminal::DECPCTERM_OR_XTERM_RPM(vte::parser::Sequence const& seq) +{ + /* + * There's a conflict between DECPCTERM and XTERM-RPM. + * XTERM-RPM takes a single argument, DECPCTERM takes 2. + * Note that since both admit default values (which may be + * omitted at the end of the sequence), this only an approximation. + */ + if (seq.size_final() <= 1) + XTERM_RPM(seq); + #ifdef PARSER_INCLUDE_NOP + else + DECPCTERM(seq); + #endif +} + +void +Terminal::DECPFK(vte::parser::Sequence const& seq) +{ + /* + * DECPFK - program function key + * Program function keys to send different codes or perform actions. + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECPKA(vte::parser::Sequence const& seq) +{ + /* + * DECPKA - program-key-action + * Sets whether DECPFK, DECPAK, DECCD, DECUDK can reprogram keys. + * + * Arguments: + * args[0]: + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECPKFMR(vte::parser::Sequence const& seq) +{ + /* + * DECPKFMR - program-key-free-memory-report + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECPS(vte::parser::Sequence const& seq) +{ + /* + * DECPS - play sound + * Plays a note. Arguments: + * @args[0]: the volume. 0 = off, 1…3 = low, 4…7 = high + * @args[1]: the duration, in multiples of 1s/32 + * @args[2]: the note; from 1 = C5, 2 = C♯5 … to 25 = C7 + * + * Defaults: + * @args[0]: no default + * @args[1]: no default + * @args[2]: no default + * + * Note that a VT525 is specified to store only 16 notes at a time. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECRARA(vte::parser::Sequence const& seq) +{ + /* + * DECRARA - reverse-attributes-in-rectangular-area + * Reverse some character attributes (bold, blink, reverse, + * (single) underline) in the specified rectangle. + * The characters in the area are unchanged, as are the + * other character attributes. + * + * Arguments; + * args[0..3]: top, left, bottom, right of the rectangle (1-based) + * args[4:]: the character attributes to change; values as in SGR + * except that only bold, blink, reverse, (single) underline are + * supported; 0 to reverse all of these. + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * args[4:]: no defaults + * + * If the top > bottom or left > right, the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECRC(vte::parser::Sequence const& seq) +{ + /* + * DECRC - restore-cursor + * Restores the terminal to the state saved by the save cursor (DECSC) + * function. If there was not a previous DECSC, then this does: + * * Home the cursor + * * Resets DECOM + * * Resets the SGR attributes + * * Designates ASCII (IR #6) to GL, and DEC Supplemental Graphics to GR + * + * Note that the status line has its own DECSC buffer. + * + * References: VT525 + */ +#if 0 + screen_restore_state(screen, &screen->saved); +#endif + + restore_cursor(); +} + +void +Terminal::DECREGIS(vte::parser::Sequence const& seq) +{ + /* + * DECREGIS - ReGIS graphics + * + * References: VT330 + */ +} + +void +Terminal::DECREQTPARM(vte::parser::Sequence const& seq) +{ + /* + * DECREQTPARM - request-terminal-parameters + * The sequence DECREPTPARM is sent by the terminal controller to notify + * the host of the status of selected terminal parameters. The status + * sequence may be sent when requested by the host or at the terminal's + * discretion. DECREPTPARM is sent upon receipt of a DECREQTPARM. + * + * If @args[0] is 0, this marks a request and the terminal is allowed + * to send DECREPTPARM messages without request. If it is 1, the same + * applies but the terminal should no longer send DECREPTPARM + * unrequested. + * 2 and 3 mark a report, but 3 is only used if the terminal answers as + * an explicit request with @args[0] == 1. + * + * The other arguments are ignored in requests, but have the following + * meaning in responses: + * args[1]: 1=no-parity-set 4=parity-set-and-odd 5=parity-set-and-even + * args[2]: 1=8bits-per-char 2=7bits-per-char + * args[3]: transmission-speed + * args[4]: receive-speed + * args[5]: 1=bit-rate-multiplier-is-16 + * args[6]: This value communicates the four switch values in block 5 + * of SETUP B, which are only visible to the user when an STP + * option is installed. These bits may be assigned for an STP + * device. The four bits are a decimal-encoded binary number. + * Value between 0-15. + * + * The transmission/receive speeds have mappings for number => bits/s + * which are quite weird. Examples are: 96->3600, 112->9600, 120->19200 + * + * Defaults: + * args[0]: 0 + * + * References: VT100 + * + * Alternatively: + * + * WYCDIR - set current character color and attributes + * + * References: WY370 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + #if 0 + screen->flags &= ~VTE_FLAG_INHIBIT_TPARM; + #endif + reply(seq, VTE_REPLY_DECREPTPARM, + {2, 1, 1, 120, 120, 1, 0}); + break; + case 1: + #if 0 + screen->flags |= VTE_FLAG_INHIBIT_TPARM; + #endif + reply(seq, VTE_REPLY_DECREPTPARM, + {3, 1, 1, 120, 120, 1, 0}); + break; + case 2: + case 3: + /* This is a report, not a request */ + default: + break; + } +} + +void +Terminal::DECRQCRA(vte::parser::Sequence const& seq) +{ + /* + * DECRQCRA - request checksum of rectangular area + * Computes a simple checksum of the characters in the rectangular + * area. args[0] is an identifier, which the response must use. + * args[1] is the page number; if it's 0 or default then the + * checksum is computed over all pages; if it's greater than the + * number of pages, then the checksum is computed only over the + * last page. args[2]..args[5] describe the area to compute the + * checksum from, denoting the top, left, bottom, right, resp + * (1-based). It's required that top ≤ bottom, and left ≤ right. + * These coordinates are interpreted according to origin mode. + * + * NOTE: Since this effectively allows to read the screen + * (by using a 1x1 rectangle on each cell), we normally only + * send a dummy reply, and only reply with the actual checksum + * when in test mode. + * + * Defaults: + * args[0]: no default + * args[1]: 0 + * args[2]: 1 + * args[3]: no default (?) + * args[4]: height of current page + * args[5]: width of current page + * + * Reply: DECCKSR + * @args[0]: the identifier from the request + * DATA: the checksum as a 4-digit hex number + * + * References: VT525 + * XTERM + */ + + unsigned int idx = 0; + int id = seq.collect1(idx); + +#ifndef VTE_DEBUG + /* Send a dummy reply */ + return reply(seq, VTE_REPLY_DECCKSR, {id}, "0000"); +#else + + /* Not in test mode? Send a dummy reply */ + if ((g_test_flags & VTE_TEST_FLAG_DECRQCRA) == 0) { + return reply(seq, VTE_REPLY_DECCKSR, {id}, "0000"); + } + + idx = seq.next(idx); + + /* We only support 1 'page', so ignore args[1] */ + idx = seq.next(idx); + + int top = seq.collect1(idx, 1, 1, m_row_count); + idx = seq.next(idx); + int left = seq.collect1(idx, 1, 1, m_column_count); /* use 1 as default here */ + idx = seq.next(idx); + int bottom = seq.collect1(idx, m_row_count, 1, m_row_count); + idx = seq.next(idx); + int right = seq.collect1(idx, m_column_count, 1, m_column_count); + + if (m_modes_private.DEC_ORIGIN() && + m_scrolling_restricted) { + top += m_scrolling_region.start; + + bottom += m_scrolling_region.start; + bottom = std::min(bottom, m_scrolling_region.end); + + } + + unsigned int checksum; + if (bottom < top || right < left) + checksum = 0; /* empty area */ + else + checksum = checksum_area(top -1 + m_screen->insert_delta, + left - 1, + bottom - 1 + m_screen->insert_delta, + right - 1); + + reply(seq, VTE_REPLY_DECCKSR, {id}, "%04X", checksum); +#endif /* VTE_DEBUG */ +} + +void +Terminal::DECRQDE(vte::parser::Sequence const& seq) +{ + /* + * DECRQDE - request-display-extent + * Request how much of the curren tpage is shown on screen. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECRQKT(vte::parser::Sequence const& seq) +{ + /* + * DECRQKT - request-key-type + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECRQLP(vte::parser::Sequence const& seq) +{ + /* + * DECRQLP - request-locator-position + * See DECELR for locator-information. + * + * References: VT525 + * + * TODO: document and implement + */ +} + +void +Terminal::DECRQM_ECMA(vte::parser::Sequence const& seq) +{ + /* + * DECRQM_ECMA - request-mode-ecma + * The host sends this control function to find out if a particular mode + * is set or reset. The terminal responds with a report mode function. + * @args[0] contains the mode to query. + * + * Response is DECRPM with the first argument set to the mode that was + * queried, second argument is 0 if mode is invalid, 1 if mode is set, + * 2 if mode is not set (reset), 3 if mode is permanently set and 4 if + * mode is permanently not set (reset): + * ECMA: ^[ MODE ; VALUE $ y + * DEC: ^[ ? MODE ; VALUE $ y + * + * References: VT525 + */ + + auto const param = seq.collect1(0); + auto const mode = m_modes_ecma.mode_from_param(param); + + int value; + switch (mode) { + case vte::terminal::modes::ECMA::eUNKNOWN: value = 0; break; + case vte::terminal::modes::ECMA::eALWAYS_SET: value = 3; break; + case vte::terminal::modes::ECMA::eALWAYS_RESET: value = 4; break; + default: assert(mode >= 0); value = m_modes_ecma.get(mode) ? 1 : 2; break; + } + + _vte_debug_print(VTE_DEBUG_MODES, + "Reporting mode %d (%s) is %d\n", + param, m_modes_ecma.mode_to_cstring(mode), + value); + + reply(seq, VTE_REPLY_DECRPM_ECMA, {param, value}); +} + +void +Terminal::DECRQM_DEC(vte::parser::Sequence const& seq) +{ + /* + * DECRQM_DEC - request-mode-dec + * Same as DECRQM_ECMA but for DEC modes. + * + * References: VT525 + */ + + auto const param = seq.collect1(0); + auto const mode = m_modes_private.mode_from_param(param); + + int value; + switch (mode) { + case vte::terminal::modes::ECMA::eUNKNOWN: value = 0; break; + case vte::terminal::modes::ECMA::eALWAYS_SET: value = 3; break; + case vte::terminal::modes::ECMA::eALWAYS_RESET: value = 4; break; + default: assert(mode >= 0); value = m_modes_private.get(mode) ? 1 : 2; break; + } + + _vte_debug_print(VTE_DEBUG_MODES, + "Reporting private mode %d (%s) is %d\n", + param, m_modes_private.mode_to_cstring(mode), + value); + + reply(seq, VTE_REPLY_DECRPM_DEC, {param, value}); +} + +void +Terminal::DECRQPKFM(vte::parser::Sequence const& seq) +{ + /* + * DECRQPKFM - request-program-key-free-memory + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECRQPSR(vte::parser::Sequence const& seq) +{ + /* + * DECRQPSR - request-presentation-state-report + * Requests a report of the terminal state, that can later + * be restored with DECRSPS. + * + * References: VT525 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + /* Error; ignore request */ + break; + + case 1: + /* Cursor information report. This contains: + * - the cursor position, including character attributes and + * character protection attribute, + * - origin mode (DECOM), + * - the character sets designated to the G0, G1, G2, and G3 sets. + * + * Reply: DECCIR + * DATA: the report in a unspecified format + * See WY370 for a possible format to use. + */ + break; + + case 2: + /* Tabstop report. + * + * Reply: DECTABSR + */ + break; + + default: + break; + } +} + +void +Terminal::DECRQSS(vte::parser::Sequence const& seq) +{ + /* + * DECRQSS - request selection or setting + * The DATA string contains the intermediate(s) and final + * character of a CSI sequence that codes for which + * selection or setting to report. + * + * Reply: DECRPSS + * @args[0]: 1 if the request was valid, otherwise 0 + * DATA: the current value of the selection or setting + * + * Note that the VT525 documentation is buggy, is says it + * sends 0 for a valid and 1 or an invalid request; we + * follow the STD 070 and XTERM behaviour. + * + * References: VT525 + */ + + /* Use a subparser to get the command from the request */ + vte::parser::Parser parser{}; + parser.feed(0x9b); /* CSI */ + + int rv = VTE_SEQ_NONE; + + /* If at the end, the parser returns a VTE_SEQ_CSI sequence, + * we interpret that; otherwise we ignore the request and + * send only a dummy reply. + * Note that this makes sure there is only one setting + * requested; if there were more than one, the parser would + * parse them as GRAPHIC and thus we reply 'invalid'. + */ + auto const str = seq.string(); + size_t i; + for (i = 0; i < str.size(); ++i) { + auto const c = str[i]; + if (c < 0x20 || c >= 0x7f) + break; + rv = parser.feed(c); + } + + vte::parser::Sequence request{parser}; + /* If not the whole string was parsed, or the sequence + * is not a CSI sequence, or it has parameters, reject + * the request as invalid. + */ + if (i != str.size() || rv != VTE_SEQ_CSI || request.size() > 0 /* any parameters */) + return reply(seq, VTE_REPLY_DECRPSS, {0}); + + switch (request.command()) { + + case VTE_CMD_DECSCUSR: + return reply(seq, VTE_REPLY_DECRPSS, {1}, {VTE_REPLY_DECSCUSR, {m_cursor_style}}); + + case VTE_CMD_DECSTBM: + if (m_scrolling_restricted) + return reply(seq, VTE_REPLY_DECRPSS, {1}, + {VTE_REPLY_DECSTBM, + {m_scrolling_region.start + 1, + m_scrolling_region.end + 1}}); + else + return reply(seq, VTE_REPLY_DECRPSS, {1}, {VTE_REPLY_DECSTBM, {}}); + + case VTE_CMD_DECAC: + case VTE_CMD_DECARR: + case VTE_CMD_DECATC: + case VTE_CMD_DECCRTST: + case VTE_CMD_DECDLDA: + case VTE_CMD_DECSACE: + case VTE_CMD_DECSASD: + case VTE_CMD_DECSCA: + case VTE_CMD_DECSCL: + case VTE_CMD_DECSCP: + case VTE_CMD_DECSCPP: + case VTE_CMD_DECSCS: + case VTE_CMD_DECSDDT: + case VTE_CMD_DECSDPT: + case VTE_CMD_DECSEST: + case VTE_CMD_DECSFC: + case VTE_CMD_DECSKCV: + case VTE_CMD_DECSLCK: + case VTE_CMD_DECSLPP: + case VTE_CMD_DECSLRM: + case VTE_CMD_DECSMBV: + case VTE_CMD_DECSNLS: + case VTE_CMD_DECSPMA: + case VTE_CMD_DECSPP: + case VTE_CMD_DECSPPCS: + case VTE_CMD_DECSPRTT: + case VTE_CMD_DECSSCLS: + case VTE_CMD_DECSSDT: + case VTE_CMD_DECSSL: + case VTE_CMD_DECSTGLT: + case VTE_CMD_DECSTRL: + case VTE_CMD_DECSWBV: + case VTE_CMD_DECSZS: + case VTE_CMD_DECTME: + case VTE_CMD_SGR: + default: + return reply(seq, VTE_REPLY_DECRPSS, {0}); + } +} + +void +Terminal::DECRQTSR(vte::parser::Sequence const& seq) +{ + /* + * DECRQTSR - request-terminal-state-report + * Requests a report of the terminal state, that can later + * be restored by DECRSTS. + * + * References: VT525 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + /* Ignore */ + break; + + case 1: + /* Terminal state report. + * + * Reply: DECTSR + * DATA: the report in an unspecified format + */ + /* return reply(seq, VTE_REPLY_DECTSR, {1}, "FIXME"); */ + break; + + case 2: + /* Color table report. + * + * Arguments: + * args[1]: color coordinate system + * 0: invalid + * 1: HLS (0…360, 0…100, 0…100) + * 2: RGB (0…100, 0…100, 0…100) (yes, really!) + * + * Reply: DECTSR + * DATA: the report + */ + /* return reply(seq, VTE_REPLY_DECTSR, {2}, "FIXME"); */ + break; + + default: + break; + } +} + +void +Terminal::DECRQUPSS(vte::parser::Sequence const& seq) +{ + /* + * DECRQUPSS - request-user-preferred-supplemental-set + * Requests the user-preferred supplemental set. + * + * Reply: DECAUPSS + * + * References: VT525 + * + * Probably not worth implementing. + */ + + // FIXMEchpe send a dummy reply? +} + +void +Terminal::DECRSPS(vte::parser::Sequence const& seq) +{ + /* + * DECRSPS - restore presentation state + * Restores terminal state from a DECRQPSR response. + * + * References: VT525 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + /* Error; ignore */ + break; + + case 1: + /* Cursor information report*/ + break; + + case 2: + /* Tabstop report */ + break; + + default: + break; + } +} + +void +Terminal::DECRSTS(vte::parser::Sequence const& seq) +{ + /* + * DECRSTS - restore terminal state + * Restore terminal state from a DECRQTSR response. + * + * References: VT525 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + /* Ignore */ + break; + + case 1: + /* Terminal state report */ + break; + + case 2: + /* Color table report */ + break; + + default: + break; + } +} + +void +Terminal::DECSACE(vte::parser::Sequence const& seq) +{ + /* + * DECSACE - select-attribute-change-extent + * Selects which positions a rectangle command (DECCARA, DECCRA, + * DECERA, DECFRA, DECRARA, DECSERA) affects. + * + * Arguments: + * args[0]: + * 0, 1: the stream of positions beginning at the + * (top, left) and ending at the (bottom, right) + * position + * 2: the positions in the rectangle with corners + * (top, left) and (bottom, right) + * + * Defaults; + * args[0]: 0 + * + * References: VT525 + * + * Not worth implementing unless we implement all the rectangle functions. + */ +} + +void +Terminal::DECSASD(vte::parser::Sequence const& seq) +{ + /* + * DECSASD - select-active-status-display + * Selects between main screen and status line. + * + * Arguments: + * args[0]: + * 0: main screen + * 1: status line + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSC(vte::parser::Sequence const& seq) +{ + /* + * DECSC - save-cursor + * Save cursor and terminal state so it can be restored later on. + * This stores: + * * Cursor position + * * SGR attributes + * * Charset designations for GL and GR + * * Wrap flag + * * DECOM state + * * Selective erase attribute + * * Any SS2 or SS3 sent + * + * References: VT525 + */ +#if 0 + screen_save_state(screen, &screen->saved); +#endif + + save_cursor(); +} + +void +Terminal::DECSCA(vte::parser::Sequence const& seq) +{ + /* + * DECSCA - select character protection attribute + * Sets whether characters inserted are protected or not. + * Protected characters will not be erased by DECSED or DECSEL. + * SGR attributes are unchanged. + * + * Arguments: + * args[0]: + * 0, 2: not protected + * 1: protected + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + */ +#if 0 + unsigned int mode = 0; + + if (seq->args[0] > 0) + mode = seq->args[0]; + + switch (mode) { + case 0: + case 2: + screen->state.attr.protect = 0; + break; + case 1: + screen->state.attr.protect = 1; + break; + } +#endif +} + +void +Terminal::DECSCL(vte::parser::Sequence const& seq) +{ + /* + * DECSCL - select-conformance-level + * Select the terminal's operating level. The factory default is + * level 4 (VT Level 4 mode, 7-bit controls). + * When you change the conformance level, the terminal performs a hard + * reset (RIS). + * + * @args[0] defines the conformance-level, valid values are: + * 61: Level 1 (VT100) + * 62: Level 2 (VT200) + * 63: Level 3 (VT300) + * 64: Level 4 (VT400) + * @args[1] defines the 8bit-mode, valid values are: + * 0: 8-bit controls + * 1: 7-bit controls + * 2: 8-bit controls (same as 0) + * + * If @args[0] is 61, then @args[1] is ignored and 7bit controls are + * enforced. + * + * Defaults: + * args[0]: 64 + * args[1]: 0 + * + * References: VT525 + */ +#if 0 + unsigned int level = 64, bit = 0; + + if (seq->n_args > 0) { + level = seq->args[0]; + if (seq->n_args > 1) + bit = seq->args[1]; + } + + vte_screen_hard_reset(screen); + + switch (level) { + case 61: + screen->conformance_level = VTE_CONFORMANCE_LEVEL_VT100; + screen->flags |= VTE_FLAG_7BIT_MODE; + break; + case 62 ... 69: + screen->conformance_level = VTE_CONFORMANCE_LEVEL_VT400; + if (bit == 1) + screen->flags |= VTE_FLAG_7BIT_MODE; + else + screen->flags &= ~VTE_FLAG_7BIT_MODE; + break; + } +#endif +} + +void +Terminal::DECSCP(vte::parser::Sequence const& seq) +{ + /* + * DECSCP - select-communication-port + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSCPP(vte::parser::Sequence const& seq) +{ + /* + * DECSCPP - select-columns-per-page + * Select columns per page. The number of rows is unaffected by this. + * @args[0] selectes the number of columns (width), DEC only defines 80 + * and 132, but we allow any integer here. 0 is equivalent to 80. + * Page content is *not* cleared and the cursor is left untouched. + * However, if the page is reduced in width and the cursor would be + * outside the visible region, it's set to the right border. Newly added + * cells are cleared. No data is retained outside the visible region. + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * FIXMEchpe: implement this instead of deprecated DECCOLM + */ +} + +void +Terminal::DECSCS(vte::parser::Sequence const& seq) +{ + /* + * DECSCS - select-communication-speed + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSCUSR(vte::parser::Sequence const& seq) +{ + /* + * DECSCUSR - set-cursor-style + * This changes the style of the cursor. @args[0] can be one of: + * 0, 1: blinking block + * 2: steady block + * 3: blinking underline + * 4: steady underline + * 5: blinking ibeam (XTERM) + * 6: steady ibeam (XTERM) + * Changing this setting does _not_ affect the cursor visibility itself. + * Use DECTCEM for that. + * + * Defaults: + * args[0]: 0 + * + * References: VT525 5–126 + * XTERM + */ + + auto param = seq.collect1(0, 0); + switch (param) { + case 0 ... 6: + set_cursor_style(VteCursorStyle(param)); + break; + default: + break; + } +} + +void +Terminal::DECSDDT(vte::parser::Sequence const& seq) +{ + /* + * DECSDDT - select-disconnect-delay-time + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSDPT(vte::parser::Sequence const& seq) +{ + /* + * DECSDPT - select-digital-printed-data-type + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSED(vte::parser::Sequence const& seq) +{ + /* + * DECSED - selective-erase-in-display + * This control function erases some or all of the erasable characters + * in the display. DECSED can only erase characters defined as erasable + * by the DECSCA control function. DECSED works inside or outside the + * scrolling margins. + * + * @args[0] defines which regions are erased. If it is 0, all cells from + * the cursor (inclusive) till the end of the display are erase. If it + * is 1, all cells from the start of the display till the cursor + * (inclusive) are erased. If it is 2, all cells are erased. + * + * Defaults: + * args[0]: 0 + */ + + erase_in_display(seq); +} + +void +Terminal::DECSEL(vte::parser::Sequence const& seq) +{ + /* + * DECSEL - selective-erase-in-line + * This control function erases some or all of the erasable characters + * in a single line of text. DECSEL erases only those characters defined + * as erasable by the DECSCA control function. DECSEL works inside or + * outside the scrolling margins. + * + * @args[0] defines the region to be erased. If it is 0, all cells from + * the cursor (inclusive) till the end of the line are erase. If it is + * 1, all cells from the start of the line till the cursor (inclusive) + * are erased. If it is 2, the whole line of the cursor is erased. + * + * Defaults: + * args[0]: 0 + */ + + erase_in_line(seq); +} + +void +Terminal::DECSERA(vte::parser::Sequence const& seq) +{ + /* + * DECSERA - selective-erase-rectangular-area + * Selectively erases characters in the specified rectangle, + * replacing them with SPACE (2/0). Character attributes, + * protection attribute (DECSCA) and line attributes (DECDHL, + * DECDWL) are unchanged. + * + * Arguments; + * args[0..3]: top, left, bottom, right of the source rectangle (1-based) + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * + * If the top > bottom or left > right the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). Current SGR defaults + * and cursor position are unchanged. + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSEST(vte::parser::Sequence const& seq) +{ + /* + * DECSEST - energy saver time + * Sets the enerty saver timer. When DECCRTSM is set, the + * screen switches to suspend mode when the time elapsed + * since the last keystroke or output is greater than the + * time set here. + * + * Arguments: + * args[0]: the time in minutes (0…60) (0 = never) + * + * Default: 15 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSFC(vte::parser::Sequence const& seq) +{ + /* + * DECSFC - select-flow-control + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSIXEL(vte::parser::Sequence const& seq) +{ + /* + * DECSIXEL - SIXEL graphics + * + * References: VT330 + */ +} + +void +Terminal::DECSKCV(vte::parser::Sequence const& seq) +{ + /* + * DECSKCV - set-key-click-volume + * Sets the key click volume. + * + * Arguments: + * args[0]: the volume setting + * 0, 5…8: high + * 1: off + * 2…4: low + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSLCK(vte::parser::Sequence const& seq) +{ + /* + * DECSLCK - set-lock-key-style + * Allow host control of the CapsLock key + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSLE(vte::parser::Sequence const& seq) +{ + /* + * DECSLE - select-locator-events + * + * References: VT330 + * + * TODO: implement + */ +} + +void +Terminal::DECSLPP(vte::parser::Sequence const& seq) +{ + /* + * DECSLPP - set-lines-per-page + * Set the number of lines per page. + * + * Arguments: + * args[0]: the number of lines per page + * + * Defaults: + * args[0]: 0 (meaning 24) + * + * Note that VT525 only allows a limited number of choices, + * (24, 25, 36, 41, 42, 48, 52, 53, 72); VTE is not so limited + * and supports any value >= 24. + * + * Top and bottom scrolling margins are unaffected, unless their + * current values exceed the new page size, in which case they are + * reset to the default. + * + * References: VT525 + */ + + auto param = seq.collect1(0); + if (param == 0) + param = 24; + else if (param < 24) + return; + + _vte_debug_print(VTE_DEBUG_EMULATION, "Resizing to %d rows.\n", param); + + emit_resize_window(m_column_count, param); +} + +void +Terminal::DECSLRM(vte::parser::Sequence const& seq) +{ + /* + * DECSLRM - set left and right margins + * Sets the left and right margins of the scrolling region. + * This is only applicable if the vertical split-screen mode + * (DECLRMM) is set. + * + * Arguments: + * args[0]: left margin + * args[1]: right margin + * + * Default: + * args[0]: 1 + * args[2]: page width + * + * If left > right, the command is ignored. + * The maximum of right is the page size (set with DECSCPP); + * the minimum size of the scrolling region is 2 columns. + * + * Homes to cursor to (1,1) of the page (scrolling region?). + * + * References: VT525 + * + * Note: There is a conflict between SCOSC and DECSLRM that both + * have final character 's' (7/3). SCOSC has 0 parameters, and + * DECSLRM has 2 parameters which both have default values, and + * my reading of ECMA-48 § 5.4.2h says that this allows for an + * empty parameter string to represent them. + * + * We could either fudge it by dispatching zero params to SCOSC + * and anything else to DECSLRM, or, since we already implement + * DECSC/DECRC, we can just drop support for the extra SCOSC/SCORC. + * Do the latter. + * + * FIXMEchpe: Consider implementing this. + */ +} + +void +Terminal::DECSMBV(vte::parser::Sequence const& seq) +{ + /* + * DECSMBV - set-margin-bell-volume + * Sets the margin bell volume. + * + * Arguments: + * args[0]: the volume setting + * 0, 1: off + * 2…4: low + * 5…8: high + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSMKR(vte::parser::Sequence const& seq) +{ + /* + * DECSMKR - select-modifier-key-reporting + * Make modifier keys send extended keyboard reports (DECEKBD) + * when pressed or released in key position mode (DECKPM). + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSNLS(vte::parser::Sequence const& seq) +{ + /* + * DECSNLS - set-lines-per-screen + * Sets the number of lines per screen. + * DEC only supports 26, 42, 53 lines here; but VTE has no + * such restriction. + * + * Arguments: + * args[0]: the number of lines + * + * Defaults: + * args[0]: no default + * + * References: VT525 + * + * FIXMEchpe: implement this + */ +} + +void +Terminal::DECSPMA(vte::parser::Sequence const& seq) +{ + /* + * DECSPMA - session page memory allocation + * Allocate pages of 25 lines to each session. + * + * References: VT525 + * + * VTE does not support sessions. + */ +} + +void +Terminal::DECSPP(vte::parser::Sequence const& seq) +{ + /* + * DECSPP - set-port-parameter + * Sets parameters for the communications or printer port. + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSPPCS(vte::parser::Sequence const& seq) +{ + /* + * DECSPPCS - select-pro-printer-character-set + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSPRTT(vte::parser::Sequence const& seq) +{ + /* + * DECSPRTT - select-printer-type + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSR(vte::parser::Sequence const& seq) +{ + /* + * DECSR - secure-reset + * Hard reset, with confirmation. + * Like RIS, but the terminal replies with the token. + * [long list of things this resets] + * + * Arguments: + * args[0]: a token + * + * Defaults: + * args[0]: no default + * + * Reply: DECSRC + * args[0]: the token + * + * References: VT525 + */ + + /* Note: reset() wipes out @seq, so we need to get the + * param beforehand, and use send() instead of reply(). + */ + auto const token = seq.collect1(0); + reset(true, true); + send(VTE_REPLY_DECSRC, {token}); +} + +void +Terminal::DECSRFR(vte::parser::Sequence const& seq) +{ + /* + * DECSRFR - select-refresh-rate + * [...] + * + * References: VT510 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSSCLS(vte::parser::Sequence const& seq) +{ + /* + * DECSSCLS - set-scroll-speed + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSSDT(vte::parser::Sequence const& seq) +{ + /* + * DECSSDT - select-status-display-line-type + * Sets the type of status line shown. + * + * Arguments: + * args[0]: the type + * 0: no status line + * 1: indicator status line + * 2: host-writable status line + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * Not worth implementing. + */ +} + +void +Terminal::DECSSL(vte::parser::Sequence const& seq) +{ + /* + * DECSSL - select-setup-language + * + * Selects set-up language + * + * References: VT525 + * + * VTE does not implement a set-up. + * + * or: + * + * WYDRBX - draw a box + * + * References: WY370 + */ +} + +void +Terminal::DECST8C(vte::parser::Sequence const& seq) +{ + /* + * DECST8C - set-tab-at-every-8-columns + * Clear the tab-ruler and reset it to a tab at every 8th column, + * starting at 9 (though, setting a tab at 1 is fine as it has no + * effect). + * + * References: VT525 + */ + + if (seq.collect1(0) != 5) + return; + + m_tabstops.reset(8); + m_tabstops.unset(0); +} + +void +Terminal::DECSTBM(vte::parser::Sequence const& seq) +{ + /* + * DECSTBM - set-top-and-bottom-margins + * Sets the top and bottom scrolling margins. + * Arguments: + * args[0]: the top margin + * args[1]: the bottom margin + * + * Defaults: + * args[0]: 1 + * args[1]: number of lines + * + * If top > bottom, the command is ignored. + * The maximum size of the scrolling region is the whole page. + * Homes the cursor to position (1,1) (of the scrolling region?). + * + * References: VT525 5–149 + */ +#if 0 + unsigned int top, bottom; + + top = 1; + bottom = screen->page->height; + + if (seq->args[0] > 0) + top = seq->args[0]; + if (seq->args[1] > 0) + bottom = seq->args[1]; + + if (top > screen->page->height) + top = screen->page->height; + if (bottom > screen->page->height) + bottom = screen->page->height; + + if (top >= bottom || + top > screen->page->height || + bottom > screen->page->height) { + top = 1; + bottom = screen->page->height; + } + + vte_page_set_scroll_region(screen->page, top - 1, bottom - top + 1); + screen_cursor_clear_wrap(screen); + screen_cursor_set(screen, 0, 0); +#endif + + int start, end; + seq.collect(0, {&start, &end}); + + /* Defaults */ + if (start <= 0) + start = 1; + if (end == -1) + end = m_row_count; + + if (start > m_row_count || + end <= start) { + m_scrolling_restricted = FALSE; + home_cursor(); + return; + } + + if (end > m_row_count) + end = m_row_count; + + /* Set the right values. */ + m_scrolling_region.start = start - 1; + m_scrolling_region.end = end - 1; + m_scrolling_restricted = TRUE; + if (m_scrolling_region.start == 0 && + m_scrolling_region.end == m_row_count - 1) { + /* Special case -- run wild, run free. */ + m_scrolling_restricted = FALSE; + } else { + /* Maybe extend the ring -- bug 710483 */ + while (_vte_ring_next(m_screen->row_data) < m_screen->insert_delta + m_row_count) + _vte_ring_insert(m_screen->row_data, _vte_ring_next(m_screen->row_data)); + } + + home_cursor(); +} + +void +Terminal::DECSTGLT(vte::parser::Sequence const& seq) +{ + /* + * DECSTGLT - select color lookup table + * Selects color mapping. + * + * Arguments: + * args[0]: mode + * 0: Text colors are shown in monochrome or grey levels + * 1: Text attributes (bold, blink, reverse, (single) underline, + * and any combinations thereof) are shown with alternate + * colors (defined by set-up), plus the attribute + * 2: Like 1, but attributes are only represented by the color + * 3: Text color as specified by SGR, and attributes + * as specified. + * + * Defaults: + * args[0]: 3 + * + * Set-up default: 3 + * + * References: VT525 + * + * Maybe worth implementing. + */ +} + +void +Terminal::DECSTR(vte::parser::Sequence const& seq) +{ + /* + * DECSTR - soft-terminal-reset + * Perform a soft reset to the default values. + * [list of default values] + * + * References: VT525 + */ + + reset(false, false); +} + +void +Terminal::DECSTRL(vte::parser::Sequence const& seq) +{ + /* + * DECSTRL - set-transmit-rate-limit + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSTUI(vte::parser::Sequence const& seq) +{ + /* + * DECSTUI - set terminal unit ID + * Sets the terminal unit ID that DA3 reports. + * + * References: VT525 + * + * VTE does not implement this. + */ +} + +void +Terminal::DECSWBV(vte::parser::Sequence const& seq) +{ + /* + * DECSWBV - set-warning-bell-volume + * Sets the warning bell volume. + * + * Arguments: + * args[0]: the volume setting + * 0, 5…8: high + * 1: off + * 2…4: low + * + * Defaults: + * args[0]: 0 + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSWL(vte::parser::Sequence const& seq) +{ + /* + * DECSWL - single-width-single-height-line + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECSZS(vte::parser::Sequence const& seq) +{ + /* + * DECSZS - select zero symbol + * Selects the zero glyph shape. + * + * Aguments: + * args[0]: shape + * 0: oval zero + * 1: zero with slash + * 2: zero with dot + * + * Default: + * args[0]: 0 + * + * References: VT525 + * + * Maybe worth implementing; could use the opentype "zero" feature + * to get the slashed zero. + */ +} + +void +Terminal::DECTID(vte::parser::Sequence const& seq) +{ + /* + * DECTID - select-terminal-id + * Selects the response to DA1. + * [...] + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DECTME(vte::parser::Sequence const& seq) +{ + /* + * DECTME - terminal-mode-emulation + * Selects the terminal emulation mode. + * Available values are various VTxxx, Wyse, TVI, ADDS, SCO + * terminals. + * Changing the emulation mode effects a soft reset. + * + * References: VT525 + * + * Not worth implementing. + */ +} + +void +Terminal::DECTST(vte::parser::Sequence const& seq) +{ + /* + * DECTST - invoke-confidence-test + * Executes self-tests. + * + * Arguments: + * args[0]: 4 + * args[1]: which test to perform + * + * References: VT525 + * + * Not worth implementing. + */ +} + +void +Terminal::DECUDK(vte::parser::Sequence const& seq) +{ + /* + * DECUDK - user define keys + * Loads key definitions. + * + * References: VT525 + * + * For security reasons, VTE does not implement this. + */ +} + +void +Terminal::DECUS(vte::parser::Sequence const& seq) +{ + /* + * DECUS - update session + * + * References: VT525 + * + * VTE does not support sessions. + */ +} + +void +Terminal::DL(vte::parser::Sequence const& seq) +{ + /* + * DL - delete-line + * Delete lines starting from the active line (presentation). + * + * This function is affected by the DCSM, TSM and VEM modes, + * and the SLH and SEE functions. + * + * Arguments: + * args[0]: number of lines to delete + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.32 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + vte_page_delete_lines(screen->page, + screen->state.cursor_y, + num, + &screen->state.attr, + screen->age); +#endif + + auto const count = seq.collect1(0, 1); + delete_lines(count); +} + +void +Terminal::DLE(vte::parser::Sequence const& seq) +{ + /* + * DLE - data link escape + * Supplementary transmission control functions. + * + * References: ECMA-48 § 8.3.33 + * ISO 1745 + * + * Not worth implementing. + */ +} + +void +Terminal::DMI(vte::parser::Sequence const& seq) +{ + /* + * DMI - disable manual input + * + * References: ECMA-48 § 8.3.34 + * + * Probably not worth implementing. + */ +} + +void +Terminal::DOCS(vte::parser::Sequence const& seq) +{ + /* + * DOCS - designate other coding systyem + * + * References: ECMA-35 § 15.4 + * ISO 2375 IR + * + * TODO: implement (bug #787228) + */ +} + +void +Terminal::DSR_ECMA(vte::parser::Sequence const& seq) +{ + /* + * DSR_ECMA - Device Status Report + * + * Reports status, or requests a status report. + * + * Arguments: + * args[0]: type + * + * Defaults: + * arg[0]: 0 + * + * References: ECMA-48 § 8.3.35 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + case 1: + case 2: + case 3: + case 4: + /* This is a status report */ + break; + + case 5: + /* Request operating status report. + * Reply: DSR + * @arg[0]: status + * 0 = ok + * 3 = malfunction + */ + reply(seq, VTE_REPLY_DSR, {0}); + break; + + case 6: + /* Request cursor position report + * Reply: CPR + * @arg[0]: line + * @arg[1]: column + */ + vte::grid::row_t rowval, origin, rowmax; + if (m_modes_private.DEC_ORIGIN() && + m_scrolling_restricted) { + origin = m_scrolling_region.start; + rowmax = m_scrolling_region.end; + } else { + origin = 0; + rowmax = m_row_count - 1; + } + // FIXMEchpe this looks wrong. shouldn't this first clamp to origin,rowmax and *then* subtract origin? + rowval = m_screen->cursor.row - m_screen->insert_delta - origin; + rowval = CLAMP(rowval, 0, rowmax); + + reply(seq, VTE_REPLY_CPR, + {int(rowval + 1), int(CLAMP(m_screen->cursor.col + 1, 1, m_column_count))}); + break; + + default: + break; + } +} + +void +Terminal::DSR_DEC(vte::parser::Sequence const& seq) +{ + /* + * DSR_DEC - device-status-report-dec + * + * Reports status, or requests a status report. + * + * Defaults: + * arg[0]: 0 + * + * References: VT525 5–173 + * VT330 + * XTERM + */ + + switch (seq.collect1(0)) { + case 6: + /* Request extended cursor position report + * Reply: DECXCPR + * @arg[0]: line + * @arg[1]: column + * @arg[2]: page + * Always report page 1 here (per XTERM source code). + */ + vte::grid::row_t rowval, origin, rowmax; + if (m_modes_private.DEC_ORIGIN() && + m_scrolling_restricted) { + origin = m_scrolling_region.start; + rowmax = m_scrolling_region.end; + } else { + origin = 0; + rowmax = m_row_count - 1; + } + // FIXMEchpe this looks wrong. shouldn't this first clamp to origin,rowmax and *then* subtract origin? + rowval = m_screen->cursor.row - m_screen->insert_delta - origin; + rowval = CLAMP(rowval, 0, rowmax); + + reply(seq, VTE_REPLY_DECXCPR, + {int(rowval + 1), int(CLAMP(m_screen->cursor.col + 1, 1, m_column_count)), 1}); + break; + + case 15: + /* Request printer port report + * Reply: DECDSR + * @arg[0]: status + * 10 = printer ready + * 11 = printer not ready + * 13 = no printer + * 18 = printer busy + * 19 = printer assigned to another session + */ + reply(seq, VTE_REPLY_DECDSR, {13}); + break; + + case 25: + /* Request user-defined keys report + * Reply: DECDSR + * @arg[0]: locked status + * 20 = UDK unlocked + * 21 = UDK locked + * + * Since we don't do UDK, we report them as locked. + */ + reply(seq, VTE_REPLY_DECDSR, {21}); + break; + + case 26: + /* Request keyboard report + * Reply: DECDSR + * @arg[0]: 27 + * @arg[1]: Keyboard language + * 0 = undetermined + * 1..40 + * + * @arg[2]: Keyboard status + * 0 = ready + * 3 = no keyboard + * 8 = keyboard busy (used by other session) + * + * @arg[3]: Keyboard type + * 0 = LK201 (XTERM response) + * 4 = LK411 + * 5 = PCXAL + */ + reply(seq, VTE_REPLY_DECDSR, {27, 0, 0, 5}); + break; + + case 53: + /* XTERM alias for 55 */ + /* [[fallthrough]]; */ + case 55: + /* Request locator status report + * Reply: DECDSR + * @arg[0]: status + * 50 = locator ready + * 53 = no locator + * + * Since we don't implement the DEC locator mode, + * we reply with 53. + */ + reply(seq, VTE_REPLY_DECDSR, {53}); + break; + + case 56: + /* Request locator type report + * Reply: DECDSR + * @arg[0]: 57 + * @arg[1]: status + * 0 = unknown + * 1 = mouse + * + * Since we don't implement the DEC locator mode, + * we reply with 0. + */ + reply(seq, VTE_REPLY_DECDSR, {57, 0}); + break; + + case 62: + /* Request macro space report + * Reply: DECMSR + * @arg[0]: floor((number of bytes available) / 16); we report 0 + */ + reply(seq, VTE_REPLY_DECMSR, {0}); + break; + + case 63: + /* Request memory checksum report + * Reply: DECCKSR + * @arg[0]: PID + * DATA: the checksum as a 4-digit hex number + * + * Reply with a dummy checksum. + */ + reply(seq, VTE_REPLY_DECCKSR, {seq.collect1(1)}, "0000"); + break; + + case 75: + /* Request data integrity report + * Reply: DECDSR + * @arg[0]: status + * 70 = no error, no power loss, no communication errors + * 71 = malfunction or communication error + * 73 = no data loss since last power-up + */ + reply(seq, VTE_REPLY_DECDSR, {70}); + break; + + case 85: + /* Request multi-session status report + * Reply: DECDSR + * @arg[0]: status + * ... + * 83 = not configured + */ + reply(seq, VTE_REPLY_DECDSR, {83}); + break; + + default: + break; + } +} + +void +Terminal::DTA(vte::parser::Sequence const& seq) +{ + /* + * DTA - dimension text area + * Set the dimension of the text area. + * + * Arguments: + * args[0]: + * args[1]: + * + * Defaults: + * args[0]: no default + * args[0]: no default + * + * References: ECMA-48 § 8.3.36 + */ +} + +void +Terminal::EA(vte::parser::Sequence const& seq) +{ + /* + * EA - erase in area + * Erase some/all character positions in the qualified area. + * + * Arguments: + * args[0]: type + * 0 = Erase the active position and all positions to the end + * of the qualified area (inclusive). + * 1 = Erase from the beginning of the qualified area to + * the active position (inclusive). + * 2 = Erase all of the qualified area. + * + * Defaults: + * args[0]: 0 + * + * If ERM is set, erases only non-protected areas; if + * ERM is reset, erases all areas. + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.37 + */ + + switch (seq.collect1(0)) { + case -1: + case 0: + break; + } +} + +void +Terminal::ECH(vte::parser::Sequence const& seq) +{ + /* + * ECH - erase-character + * Erase characters from the active position. + * + * DSCM mode controls whether this function operates on the + * presentation or data position. + * Also affected by ERM mode. + * + * Arguments: + * args[0]: number of characters to erase + * + * Defaults: + * args[0]: 1 + * + * If ERM is set, erases only non-protected characters; if + * ERM is reset, erases all characters. + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.38 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + vte_page_erase(screen->page, + screen->state.cursor_x, screen->state.cursor_y, + screen->state.cursor_x + num, screen->state.cursor_y, + &screen->state.attr, screen->age, false); +#endif + + /* Erase characters starting at the cursor position (overwriting N with + * spaces, but not moving the cursor). */ + + // FIXMEchpe limit to column_count - cursor.x ? + auto const count = seq.collect1(0, 1, 1, int(65535)); + erase_characters(count); +} + +void +Terminal::ED(vte::parser::Sequence const& seq) +{ + /* + * ED - erase-in-display + * Erases characters. + * Line attributes of completely erased lines are reset to + * single-width single-height, and all character attributes + * are reset to default. + * + * Arguments: + * args[0]: mode + * 0 = erase from the cursor position to the end of the screen + * 1 = erase from the beginning of the screen to the cursor + * position (inclusive) + * 2 = erase display + * 3 = erase scrollback (XTERM extension) + * + * Defaults: + * args[0]: 0 + * + * This function does not respect the scrolling margins. + * + * If ERM is set, erases only non-protected characters; if + * ERM is reset, erases all characters. + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.39 + * VT525 + */ + + erase_in_display(seq); +} + +void +Terminal::EF(vte::parser::Sequence const& seq) +{ + /* + * EF - erase in field + * Erases characters in the active field. + * + * Arguments: + * args[0]: mode + * 0 = Erase the active position and all positions to the end + * of the field (inclusive). + * 1 = Erase from the beginning of the field to + * the active position (inclusive). + * 2 = Erase all of the qualified area. + * + * Defaults: + * args[0]: 0 + * + * If ERM is set, erases only non-protected characters; if + * ERM is reset, erases all characters. + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.40 + */ +} + +void +Terminal::EL(vte::parser::Sequence const& seq) +{ + /* + * EL - erase-in-line + * Erases characters. + * + * Arguments: + * args[0]: mode + * 0 = erase from the cursor position to the end of the line + * 1 = erase from the beginning of the line to the cursor + * position (inclusive) + * 2 = erase line (FIXME: does this clear line attributes?) + * + * Defaults: + * args[0]: 0 + * + * This function does not respect the scrolling margins. + * + * If ERM is set, erases only non-protected characters; if + * ERM is reset, erases all characters. + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.41 + * VT525 + */ + + erase_in_line(seq); +} + +void +Terminal::EM(vte::parser::Sequence const& seq) +{ + /* + * EM - end of medium + * + * References: ECMA-48 § 8.3.42 + */ +} + +void +Terminal::EMI(vte::parser::Sequence const& seq) +{ + /* + * DMI - enable manual input + * + * References: ECMA-48 § 8.3.43 + * + * Probably not worth implementing. + */ +} + +void +Terminal::ENQ(vte::parser::Sequence const& seq) +{ + /* + * ENQ - enquiry + * Transmit the answerback-string. If none is set, do nothing. + * + * References: ECMA-48 § 8.3.44 + * ISO 1745 + */ + + /* No-op for security reasons */ +} + +void +Terminal::EOT(vte::parser::Sequence const& seq) +{ + /* + * EOT - end of transmission + * + * References: ECMA-48 § 8.3.45 + * ISO 1745 + * + * Not worth implementing. + */ +} + +void +Terminal::EPA(vte::parser::Sequence const& seq) +{ + /* + * EPA - end of guarded area + * Marks the end of an area of positions (presentation) + * that are protected; the beginning of the area was + * marked by SPA. + * + * The contents of the area will be protected against + * alteration, transfer (depending on the GATM setting), + * and erasure (depending on the ERM setting). + * + * References: ECMA-48 § 8.3.46 + */ +} + +void +Terminal::ESA(vte::parser::Sequence const& seq) +{ + /* + * ESA - end of selected area + * Marks the end of an area of positions (presentation) + * that are selected for transfer; the beginning of the area + * was marked by SSA. + * + * References: ECMA-48 § 8.3.47 + */ +} + +void +Terminal::ETB(vte::parser::Sequence const& seq) +{ + /* + * ETB - end of transmission block + * + * References: ECMA-48 § 8.3.49 + * ISO 1745 + * + * Not worth implementing. + */ +} + +void +Terminal::ETX(vte::parser::Sequence const& seq) +{ + /* + * ETX - end of text + * + * References: ECMA-48 § 8.3.49 + * ISO 1745 + * + * Not worth implementing. + */ +} + +void +Terminal::FF(vte::parser::Sequence const& seq) +{ + /* + * FF - form-feed + * This causes the cursor to jump to the next line (presentation). + * + * References: ECMA-48 § 8.3.51 + */ + + LF(seq); +} + +void +Terminal::FNK(vte::parser::Sequence const& seq) +{ + /* + * FNK - function key + * + * Arguments: + * args[0]: function key that was operated + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.52 + * + * Probably not worth implementing. + */ +} + +void +Terminal::FNT(vte::parser::Sequence const& seq) +{ + /* + * FNT - font selection + * Select the font to be used by subsequent SGR 10…19. + * + * Arguments: + * args[0]: the font 0…9 + * args[1]: font identifier + * + * Defaults: + * args[0]: 0 + * args[1]: 0 + * + * References: ECMA-48 § 8.3.53 + * + * Probably not worth implementing. + */ +} + +void +Terminal::GCC(vte::parser::Sequence const& seq) +{ + /* + * GCC - graphic character combination + * Two or more graphic characters that follow should be + * imaged as one symbol. + * + * Arguments: + * args[0]: mode + * 0 = Combine the following two graphic characters + * 1 = Start of string of characters to be combined + * 2 = End of string of characters to be combined + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.54 + * ECMA-43 Annex C + */ +} + +void +Terminal::GSM(vte::parser::Sequence const& seq) +{ + /* + * GSM - graphic size modification + * + * Arguments: + * args[0]: height as percentage of height set by GSS + * args[1]: width as percentage of width set by GSS + * + * Defaults: + * args[0]: 100 + * args[0]: 100 + * + * References: ECMA-48 § 8.3.55 + * + * Not applicable to VTE. + */ +} + +void +Terminal::GSS(vte::parser::Sequence const& seq) +{ + /* + * GSM - graphic size selection + * + * Arguments: + * args[0]: size in the unit set by SSU + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.56 + * + * Not applicable to VTE. + */ +} + +void +Terminal::GnDm(vte::parser::Sequence const& seq) +{ + /* + * GnDm - Gn-designate 9m-charset + * + * Designate character sets to G-sets. + * + * References: ECMA-35 § 14.3 + * ISO 2375 IR + */ + + /* Since we mostly don't implement ECMA-35 anymore, we can mostly ignore this. */ + + VteCharacterReplacement replacement; + switch (seq.charset()) { + case VTE_CHARSET_DEC_SPECIAL_GRAPHIC: + /* Some characters replaced by line drawing characters. + * This is still used by ncurses :-( + */ + replacement = VTE_CHARACTER_REPLACEMENT_LINE_DRAWING; + break; + + case VTE_CHARSET_BRITISH_NRCS: + /* # is converted to £ */ + /* FIXME: Remove this */ + replacement = VTE_CHARACTER_REPLACEMENT_BRITISH; + break; + + /* FIXME: are any of the other charsets still useful? */ + default: + replacement = VTE_CHARACTER_REPLACEMENT_NONE; + break; + } + + unsigned int slot = seq.slot(); + if (slot >= G_N_ELEMENTS(m_character_replacements)) + return; + + m_character_replacements[slot] = replacement; +} + +void +Terminal::GnDMm(vte::parser::Sequence const& seq) +{ + /* + * GnDm - Gn-designate multibyte 9m-charset + * + * Designate multibyte character sets to G-sets. + * + * References: ECMA-35 § 14.3 + * ISO 2375 IR + */ + + /* Since we mostly don't implement ECMA-35 anymore, we can ignore this */ +} + +void +Terminal::HPA(vte::parser::Sequence const& seq) +{ + /* + * HPA - horizontal position absolute + * Move the active position (data) to the position specified by @args[0] + * in the active line. + * + * Arguments: + * args[0]: position (data) + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.57 + * VT525 + */ + +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_set(screen, num - 1, screen->state.cursor_y); +#endif + + auto value = seq.collect1(0, 1, 1, m_column_count); + set_cursor_column1(value); +} + +void +Terminal::HPB(vte::parser::Sequence const& seq) +{ + /* + * HPA - horizontal position backward + * Move the active position (data) to the backward by @args[0] positions + * in the active line. + * + * Arguments: + * args[0]: number of positions to move + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.58 + */ +} + +void +Terminal::HPR(vte::parser::Sequence const& seq) +{ + /* + * HPR - horizontal-position-relative + * Move the active position (data) to the foward by @args[0] positions + * in the active line. + * + * Arguments: + * args[0]: number of positions to move + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.59 + * VT525 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + screen_cursor_right(screen, num); +#endif +} + +void +Terminal::HT(vte::parser::Sequence const& seq) +{ + /* + * HT - character tabulation + * Move the active position (presentation) to the next tab stop. + * If there are no more tab stops, the cursor moves to the right + * margin. Does not cause text to auto wrap. + * + * (If that next tabstop was set by TAC, TALE, TATE or TCC, + * the properties of that tabstop will determine how subsequently + * inserted text is positioned.) + * + * References: ECMA-48 § 8.3.60 + * VT525 + */ +#if 0 + screen_cursor_clear_wrap(screen); +#endif + + move_cursor_tab_forward(); +} + +void +Terminal::HTJ(vte::parser::Sequence const& seq) +{ + /* + * HTJ - character tabulation with justification + * + * References: ECMA-48 § 8.3.61 + * VT525 + */ +#if 0 + screen_cursor_clear_wrap(screen); +#endif + + move_cursor_tab_forward(); +} + +void +Terminal::HTS(vte::parser::Sequence const& seq) +{ + /* + * HTS - horizontal-tab-set + * Set a tabstop at the active position (presentation). + * + * Affected by TSM mode. + * + * References: ECMA-48 § 8.3.62 + * VT525 + */ + + m_tabstops.set(get_cursor_column()); +} + +void +Terminal::HVP(vte::parser::Sequence const& seq) +{ + /* + * HVP - horizontal-and-vertical-position + * Sets the active position (data) + * + * Arguments: + * args[0]: the line + * args[1]: the column + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * + * If DECOM is set, the position is relative to the top/bottom + * margins, and may not be outside it. + * + * References: ECMA-48 § 8.3.63 + * VT525 + */ + + CUP(seq); +} + +void +Terminal::ICH(vte::parser::Sequence const& seq) +{ + /* + * ICH - insert-character + * Inserts SPACE (2/0) character(s) at the cursor position. + * + * Arguments: + * args[0]: the number of characters to insert + * + * Defaults: + * args[0]: 1 + * + * Depending on DCSM, this function works on the presentation + * or data position. + + * Also affected by HEM mode, and the SLH, and SEE functions. + * + * References: ECMA-48 §8.3.64 + * VT525 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + vte_page_insert_cells(screen->page, + screen->state.cursor_x, + screen->state.cursor_y, + num, + &screen->state.attr, + screen->age); +#endif + + auto const count = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col)); + + /* TODOegmont: Insert them in a single run, so that we call cleanup_fragments only once. */ + for (auto i = 0; i < count; i++) + insert_blank_character(); +} + +void +Terminal::IDCS(vte::parser::Sequence const& seq) +{ + /* + * IDCS - identify device control string + * + * Arguments: + * args[0]: mode + * 1 = reserved for use with SRTM mode + * 2 = reservewd for DRCS according to ECMA-35 + + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.65 + */ +} + +void +Terminal::IGS(vte::parser::Sequence const& seq) +{ + /* + * IGS - identify graphic subrepertoire + * Specifies a repertoire of graphic characters to be used + * in the following text. + * + * Arguments: + * args[0]: identifier from ISO 7350 registry + + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.66 + * ISO/IEC 7350 + * ISO/IEC 10367 + * + * Not worth implementing. + */ +} + +void +Terminal::IL(vte::parser::Sequence const& seq) +{ + /* + * IL - insert-line + * Insert (a) blank line(s) at the active position. + * + * Arguments: + * args[0]: the number of lines + * + * Defaults: + * args[0]: 1 + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * Also affected by the TSM and VEM modes, + * and the SLH and SEE functions. + * + * References: ECMA-48 § 8.3.67 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + screen_cursor_clear_wrap(screen); + vte_page_insert_lines(screen->page, + screen->state.cursor_y, + num, + &screen->state.attr, + screen->age); +#endif + + auto const count = seq.collect1(0, 1); + insert_lines(count); +} + +void +Terminal::IND(vte::parser::Sequence const& seq) +{ + /* + * IND - index - DEPRECATED + * + * References: ECMA-48 § F.8.2 + */ + + LF(seq); +} + +void +Terminal::INT(vte::parser::Sequence const& seq) +{ + /* + * INT - interrupt + * + * References: ECMA-48 § 8.3.68 + */ +} + +void +Terminal::IRR(vte::parser::Sequence const& seq) +{ + /* + * IRR - identify-revised-registration + * + * References: ECMA-35 § 14.5 + * + * Probably not worth implementing. + */ + + /* Since we mostly don't implement ECMA-35 anymore, we can ignore this */ +} + +void +Terminal::IS1(vte::parser::Sequence const& seq) +{ + /* + * IS1 - information separator 1 / unit separator (US) + * + * References: ECMA-48 § 8.3.69, § 8.2.10 + */ +} + +void +Terminal::IS2(vte::parser::Sequence const& seq) +{ + /* + * IS2 - information separator 2 / record separator (RS) + * + * References: ECMA-48 § 8.3.70, § 8.2.10 + */ +} + +void +Terminal::IS3(vte::parser::Sequence const& seq) +{ + /* + * IS3 - information separator 3 / group separator (GS) + * + * References: ECMA-48 § 8.3.71, § 8.2.10 + */ +} + +void +Terminal::IS4(vte::parser::Sequence const& seq) +{ + /* + * IS4 - information separator 4 / file separator (FS) + * + * References: ECMA-48 § 8.3.72, § 8.2.10 + */ +} + +void +Terminal::JFY(vte::parser::Sequence const& seq) +{ + /* + * JFY - justify + * + * References: ECMA-48 § 8.3.73 + * + * Probably not worth implementing. + */ +} + +void +Terminal::LF(vte::parser::Sequence const& seq) +{ + /* + * LF - line-feed + * XXXX + * + * References: ECMA-48 § 8.3.74 + */ + +#if 0 + screen_cursor_down(screen, 1, true); + if (screen->flags & VTE_FLAG_NEWLINE_MODE) + screen_cursor_left(screen, screen->state.cursor_x); +#endif + + line_feed(); +} + +void +Terminal::LS0(vte::parser::Sequence const& seq) +{ + /* + * LS0 -locking shift 0 (8 bit) + * SI - shift-in (7 bit) + * + * Map G0 into GL. + * + * References: ECMA-35 § 9.3.1 + * ECMA-48 § 8.3.75, 8.3.119 + */ +#if 0 + screen->state.gl = &screen->g0; +#endif + + set_character_replacement(0); +} + +void +Terminal::LS1(vte::parser::Sequence const& seq) +{ + /* + * LS1 -locking shift 1 (8 bit) + * SO - shift-out (7 bit) + * + * Map G1 into GL. + * + * References: ECMA-35 § 9.3.1 + * ECMA-48 § 8.3.76, 8.3.126 + */ +#if 0 + screen->state.gl = &screen->g1; +#endif + + set_character_replacement(1); +} + +void +Terminal::LS1R(vte::parser::Sequence const& seq) +{ + /* + * LS1R - locking-shift-1-right + * Map G1 into GR. + * + * References: ECMA-35 § 9.3.2 + * ECMA-48 § 8.3.77 + */ +#if 0 + screen->state.gr = &screen->g1; +#endif +} + +void +Terminal::LS2(vte::parser::Sequence const& seq) +{ + /* + * LS2 - locking-shift-2 + * Map G2 into GL. + * + * References: ECMA-35 § 9.3.1 + * ECMA-48 § 8.3.78 + */ +#if 0 + screen->state.gl = &screen->g2; +#endif +} + +void +Terminal::LS2R(vte::parser::Sequence const& seq) +{ + /* + * LS2R - locking-shift-2-right + * Map G2 into GR. + * + * References: ECMA-35 § 9.3.2 + * ECMA-48 § 8.3.79 + */ +#if 0 + screen->state.gr = &screen->g2; +#endif +} + +void +Terminal::LS3(vte::parser::Sequence const& seq) +{ + /* + * LS3 - locking-shift-3 + * Map G3 into GL. + * + * References: ECMA-35 § 9.3.1 + * ECMA-48 § 8.3.80 + */ + +#if 0 + screen->state.gl = &screen->g3; +#endif +} + +void +Terminal::LS3R(vte::parser::Sequence const& seq) +{ + /* + * LS3R - locking-shift-3-right + * Map G3 into GR. + * + * References: ECMA-35 § 9.3.2 + * ECMA-48 § 8.3.81 + */ +#if 0 + screen->state.gr = &screen->g3; +#endif +} + +void +Terminal::MC_ECMA(vte::parser::Sequence const& seq) +{ + /* + * MC_ECMA - media-copy-ecma + * + * References: ECMA-48 § 8.3.82 + * VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::MC_DEC(vte::parser::Sequence const& seq) +{ + /* + * MC_DEC - media-copy-dec + * + * References: VT525 + * + * Probably not worth implementing. + */ +} + +void +Terminal::MW(vte::parser::Sequence const& seq) +{ + /* + * MW - message waiting + * + * References: ECMA-48 § 8.3.83 + * + * Not worth implementing. + */ +} + +void +Terminal::NAK(vte::parser::Sequence const& seq) +{ + /* + * NAK - negative acknowledge + * + * References: ECMA-48 § 8.3.84 + * ISO 1745 + * + * Not worth implementing. + */ +} + +void +Terminal::NBH(vte::parser::Sequence const& seq) +{ + /* + * BPH - no break permitted here + * + * References: ECMA-48 § 8.3.85 + * + * Not worth implementing. + */ +} + +void +Terminal::NEL(vte::parser::Sequence const& seq) +{ + /* + * NEL - next-line + * Moves the cursor to the first column in the next line. + * If the cursor is on the bottom margin, this scrolls up. + * + * References: ECMA-48 § 8.3.86 + */ +#if 0 + screen_cursor_clear_wrap(screen); + screen_cursor_down(screen, 1, true); + screen_cursor_set(screen, 0, screen->state.cursor_y); +#endif + + set_cursor_column(0); + cursor_down(true); +} + +void +Terminal::NP(vte::parser::Sequence const& seq) +{ + /* + * NP - next-page + * Move cursor to home on the next page (presentation). + * (Ignored if there is only one page.) + * + * Arguments: + * args[0]: number of pages to move forward + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.87 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::NUL(vte::parser::Sequence const& seq) +{ + /* + * NUL - nothing + * + * References: ECMA-48 § 8.3.88 + */ +} + +void +Terminal::OSC(vte::parser::Sequence const& seq) +{ + /* + * OSC - operating system command + * + * References: ECMA-48 § 8.3.89 + * XTERM + */ + + /* Our OSC have the format + * OSC number ; rest of string ST + * where the rest of the string may or may not contain more semicolons. + * + * First, extract the number. + */ + + auto str = seq.string_utf8(); + vte::parser::StringTokeniser tokeniser{str, ';'}; + auto it = tokeniser.cbegin(); + int osc; + if (!it.number(osc)) + return; + + auto const cend = tokeniser.cend(); + ++it; /* could now be cend */ + + switch (osc) { + case VTE_OSC_VTECWF: + set_current_file_uri(seq, it, cend); + break; + + case VTE_OSC_VTECWD: + set_current_directory_uri(seq, it, cend); + break; + + case VTE_OSC_VTEHYPER: + set_current_hyperlink(seq, it, cend); + break; + + case -1: /* default */ + case VTE_OSC_XTERM_SET_WINDOW_AND_ICON_TITLE: + case VTE_OSC_XTERM_SET_WINDOW_TITLE: { + /* Only sets window title; icon title is not supported */ + std::string title; + if (it != cend && + it.size_remaining() < VTE_WINDOW_TITLE_MAX_LENGTH) + title = it.string_remaining(); + m_window_title_pending.swap(title); + m_window_title_changed = true; + break; + } + + case VTE_OSC_XTERM_SET_COLOR: + case VTE_OSC_XTERM_SET_COLOR_SPECIAL: + set_color(seq, it, cend, osc); + break; + + case VTE_OSC_XTERM_SET_COLOR_TEXT_FG: + set_special_color(seq, it, cend, VTE_DEFAULT_FG, -1, osc); + break; + + case VTE_OSC_XTERM_SET_COLOR_TEXT_BG: + set_special_color(seq, it, cend, VTE_DEFAULT_BG, -1, osc); + break; + + case VTE_OSC_XTERM_SET_COLOR_CURSOR_BG: + set_special_color(seq, it, cend, VTE_CURSOR_BG, VTE_DEFAULT_FG, osc); + break; + + case VTE_OSC_XTERM_SET_COLOR_HIGHLIGHT_BG: + set_special_color(seq, it, cend, VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, osc); + break; + + case VTE_OSC_XTERM_SET_COLOR_HIGHLIGHT_FG: + set_special_color(seq, it, cend, VTE_HIGHLIGHT_FG, VTE_DEFAULT_BG, osc); + break; + + case VTE_OSC_XTERM_RESET_COLOR: + case VTE_OSC_XTERM_RESET_COLOR_SPECIAL: + reset_color(seq, it, cend, osc); + break; + + case VTE_OSC_XTERM_RESET_COLOR_TEXT_FG: + reset_color(VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE); + break; + + case VTE_OSC_XTERM_RESET_COLOR_TEXT_BG: + reset_color(VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE); + break; + + case VTE_OSC_XTERM_RESET_COLOR_CURSOR_BG: + reset_color(VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE); + break; + + case VTE_OSC_XTERM_RESET_COLOR_HIGHLIGHT_BG: + reset_color(VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE); + break; + + case VTE_OSC_XTERM_RESET_COLOR_HIGHLIGHT_FG: + reset_color(VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE); + break; + + case VTE_OSC_XTERM_SET_ICON_TITLE: + case VTE_OSC_XTERM_SET_XPROPERTY: + case VTE_OSC_XTERM_SET_COLOR_MOUSE_CURSOR_FG: + case VTE_OSC_XTERM_SET_COLOR_MOUSE_CURSOR_BG: + case VTE_OSC_XTERM_SET_COLOR_TEK_FG: + case VTE_OSC_XTERM_SET_COLOR_TEK_BG: + case VTE_OSC_XTERM_SET_COLOR_TEK_CURSOR: + case VTE_OSC_XTERM_LOGFILE: + case VTE_OSC_XTERM_SET_FONT: + case VTE_OSC_XTERM_SET_XSELECTION: + case VTE_OSC_XTERM_SET_COLOR_MODE: + case VTE_OSC_XTERM_RESET_COLOR_MOUSE_CURSOR_FG: + case VTE_OSC_XTERM_RESET_COLOR_MOUSE_CURSOR_BG: + case VTE_OSC_XTERM_RESET_COLOR_TEK_FG: + case VTE_OSC_XTERM_RESET_COLOR_TEK_BG: + case VTE_OSC_XTERM_RESET_COLOR_TEK_CURSOR: + case VTE_OSC_EMACS_51: + case VTE_OSC_ITERM2_133: + case VTE_OSC_ITERM2_1337: + case VTE_OSC_ITERM2_GROWL: + case VTE_OSC_KONSOLE_30: + case VTE_OSC_KONSOLE_31: + case VTE_OSC_RLOGIN_SET_KANJI_MODE: + case VTE_OSC_RLOGIN_SPEECH: + case VTE_OSC_RXVT_SET_BACKGROUND_PIXMAP: + case VTE_OSC_RXVT_SET_COLOR_FG: + case VTE_OSC_RXVT_SET_COLOR_BG: + case VTE_OSC_RXVT_DUMP_SCREEN: + case VTE_OSC_URXVT_SET_LOCALE: + case VTE_OSC_URXVT_VERSION: + case VTE_OSC_URXVT_SET_COLOR_TEXT_ITALIC: + case VTE_OSC_URXVT_SET_COLOR_TEXT_BOLD: + case VTE_OSC_URXVT_SET_COLOR_UNDERLINE: + case VTE_OSC_URXVT_SET_COLOR_BORDER: + case VTE_OSC_URXVT_SET_FONT: + case VTE_OSC_URXVT_SET_FONT_BOLD: + case VTE_OSC_URXVT_SET_FONT_ITALIC: + case VTE_OSC_URXVT_SET_FONT_BOLD_ITALIC: + case VTE_OSC_URXVT_VIEW_UP: + case VTE_OSC_URXVT_VIEW_DOWN: + case VTE_OSC_URXVT_EXTENSION: + case VTE_OSC_YF_RQGWR: + default: + break; + } +} + +void +Terminal::PEC(vte::parser::Sequence const& seq) +{ + /* + * PEC - presentation expand or contract + * + * References: ECMA-48 § 8.3.90 + * + * Not applicable in VTE. + */ +} + +void +Terminal::PFS(vte::parser::Sequence const& seq) +{ + /* + * PFS - page format selection + * + * References: ECMA-48 § 8.3.91 + * + * Not applicable in VTE. + */ +} + +void +Terminal::PLD(vte::parser::Sequence const& seq) +{ + /* + * PLD - partial line forward + * + * References: ECMA-48 § 8.3.92 + * + * Could use this to implement subscript text. + */ +} + +void +Terminal::PLU(vte::parser::Sequence const& seq) +{ + /* + * PLU - partial line backward + * + * References: ECMA-48 § 8.3.93 + * + * Could use this to implement superscript text. + */ +} + +void +Terminal::PP(vte::parser::Sequence const& seq) +{ + /* + * PP - preceding page + * Move cursor to home on the previous page (presentation). + * (Ignored if there is only one page.) + * + * Arguments: + * args[0]: number of pages to move backward + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.95 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::PPA(vte::parser::Sequence const& seq) +{ + /* + * PPA - page position absolute + * Move the cursor to the current position on the specified page + * (data). + * (Ignored if there is only one page.) + * + * Arguments: + * args[0]: absolute page number + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.96 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::PPB(vte::parser::Sequence const& seq) +{ + /* + * PPB - page position backward + * Move the cursor to the current position on a preceding page (data). + * (Ignored if there is only one page.) + * + * Arguments: + * args[0]: number of pages to move backward + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.97 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::PPR(vte::parser::Sequence const& seq) +{ + /* + * PPR - page position foward + * Move the cursor to the current position on a following page (data). + * (Ignored if there is only one page.) + * + * Arguments: + * args[0]: number of pages to move forward + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.98 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::PTX(vte::parser::Sequence const& seq) +{ + /* + * PTX - parallel texts + * + * Arguments: + * args[0]: mode + * 0 = End of parallel texts + * 1 = Start of a string of principal parallel text + * 2 = Start of a string of supplementary parallel text + * 3 = Start of a string of supplementary japanese + * phonetic annotations + * 4 = Start of a string of supplementary chinese + * phonetic annotations + * 5 = Start of a string of supplementary phonetic + * annotations + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.99 + * VT525 + * + * Since VTE only has one page, this is ignored. + */ +} + +void +Terminal::PU1(vte::parser::Sequence const& seq) +{ + /* + * PU1 - private use 1 + * + * References: ECMA-48 § 8.3.100 + * + * Not worth implementing. + */ +} + +void +Terminal::PU2(vte::parser::Sequence const& seq) +{ + /* + * PU1 - private use 2 + * + * References: ECMA-48 § 8.3.101 + * + * Not worth implementing. + */ +} + +void +Terminal::QUAD(vte::parser::Sequence const& seq) +{ + /* + * QUAD - quad + * + * References: ECMA-48 § 8.3.102 + * + * Probably not worth implementing. + */ +} + +void +Terminal::REP(vte::parser::Sequence const& seq) +{ + /* + * REP - repeat + * Repeat the preceding graphics-character the given number of times. + * @args[0] specifies how often it shall be repeated. 0 is treated as 1. + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.103 + */ + + if (m_last_graphic_character == 0) + return; + + auto const count = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col)); + + // FIXMEchpe insert in one run so we only clean up fragments once + for (auto i = 0; i < count; i++) + insert_char(m_last_graphic_character, false, true); +} + +void +Terminal::RI(vte::parser::Sequence const& seq) +{ + /* + * RI - reverse-index + * Moves the cursor up one line in the same column. If the cursor is at + * the top margin, the page scrolls down. + * + * References: ECMA-48 § 8.3.104 + */ +#if 0 + screen_cursor_up(screen, 1, true); +#endif + + ensure_cursor_is_onscreen(); + + vte::grid::row_t start, end; + if (m_scrolling_restricted) { + start = m_scrolling_region.start + m_screen->insert_delta; + end = m_scrolling_region.end + m_screen->insert_delta; + } else { + start = m_screen->insert_delta; + end = start + m_row_count - 1; + } + + if (m_screen->cursor.row == start) { + /* If we're at the top of the scrolling region, add a + * line at the top to scroll the bottom off. */ + ring_remove(end); + ring_insert(start, true); + /* Update the display. */ + scroll_region(start, end - start + 1, 1); + invalidate_cells(0, m_column_count, + start, 2); + } else { + /* Otherwise, just move the cursor up. */ + m_screen->cursor.row--; + } + /* Adjust the scrollbars if necessary. */ + adjust_adjustments(); + /* We modified the display, so make a note of it. */ + m_text_modified_flag = TRUE; +} + +void +Terminal::RIS(vte::parser::Sequence const& seq) +{ + /* + * RIS - reset-to-initial-state + * Reset to initial state. + * [list of things reset] + * + * References: ECMA-48 § 8.3.105 + */ + + reset(true, true); +} + +void +Terminal::RLOGIN_MML(vte::parser::Sequence const& seq) +{ + /* + * RLOGIN_MML - RLogin music markup language + * + * Probably not worth implementing. + * + * References: RLogin + */ +} + +void +Terminal::RM_ECMA(vte::parser::Sequence const& seq) +{ + /* + * RM_ECMA - reset-mode-ecma + * + * Defaults: none + * + * References: ECMA-48 § 8.3.106 + */ + + set_mode_ecma(seq, false); +} + +void +Terminal::RM_DEC(vte::parser::Sequence const& seq) +{ + /* + * RM_DEC - reset-mode-dec + * This is the same as RM_ECMA but for DEC modes. + * + * Defaults: none + * + * References: VT525 + */ + + set_mode_private(seq, false); +} + +void +Terminal::SCORC(vte::parser::Sequence const& seq) +{ + /* + * SCORC - SCO restore-cursor + * + * References: VT525 + * + * Not worth implementing, given that we already support DECSC/DECRC. + */ +} + +void +Terminal::SACS(vte::parser::Sequence const& seq) +{ + /* + * SACS - set additional character separation + * + * Arguments: + * args[0]: spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.107 + * + * Not applicable in VTE. + */ +} + +void +Terminal::SAPV(vte::parser::Sequence const& seq) +{ + /* + * SAPV - select alternative presentation variants + * Set variants for the presentation of following text. + * + * Arguments: + * args[0]: type + * 0 = default presentation; cancels the previous SAPV + * ... + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.108 + */ +} + +void +Terminal::SCO(vte::parser::Sequence const& seq) +{ + /* + * SCO - select character orientation + * Set the rotation for the presentation of following text. + * (positive orientation). + * + * Arguments: + * args[0]: orientation 0…7 specifying a multiple of 45° + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.110 + */ +} + +void +Terminal::SCP(vte::parser::Sequence const& seq) +{ + /* + * SCP - select character path + * Set the character path relative to the line orientation + * (presentation). + * + * Arguments: + * args[0]: path + * 1 = LTR or TTB (for horizontal/vertical line orientation) + * 2 = RTL or BTT (for horizontal/vertical line orientation) + * args[1]: effect + * 0 = implementation-defined + * 1 = ... + * 2 = ... + * + * Defaults: + * args[0]: no default + * args[1]: no default + * + * References: ECMA-48 § 8.3.111 + */ +} + +void +Terminal::SCS(vte::parser::Sequence const& seq) +{ + /* + * SCS - set character spacing + * + * Arguments: + * args[0]: spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.112 + */ +} + +void +Terminal::SD(vte::parser::Sequence const& seq) +{ + /* + * SD - scroll down / pan up + * Scrolls down a number of lines (presentation). + * + * Arguments: + * args[0]: number of lines to scroll + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.113 + * VT525 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; + + vte_page_scroll_down(screen->page, + num, + &screen->state.attr, + screen->age, + NULL); +#endif + + /* Scroll the text down N lines, but don't move the cursor. */ + auto value = std::max(seq.collect1(0, 1), int(1)); + scroll_text(value); +} + +void +Terminal::SD_OR_XTERM_IHMT(vte::parser::Sequence const& seq) +{ + /* + * There's a conflict between SD and XTERM IHMT that we + * have to resolve by checking the parameter count. + * XTERM_IHMT needs exactly 5 arguments, SD takes 0 or 1. + */ + if (seq.size_final() <= 1) + SD(seq); + #ifdef PARSER_INCLUDE_NOP + else + XTERM_IHMT(seq); + #endif +} + +void +Terminal::SDS(vte::parser::Sequence const& seq) +{ + /* + * SDS - start directed string + * + * Arguments: + * args[0]: direction + * 0 = End of directed string + * 1 = Start of LTR string + * 2 = Start of RTL string + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.114 + */ +} + +void +Terminal::SEE(vte::parser::Sequence const& seq) +{ + /* + * SEE - select editing extent + * + * Arguments: + * args[0]: extent + * 0 = ... + * 1 = ... + * 2 = ... + * 3 = ... + * 4 = ... + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.115 + */ +} + +void +Terminal::SEF(vte::parser::Sequence const& seq) +{ + /* + * SEF - sheet eject and feed + * + * Arguments: + * args[0]: + * args[1]: + * + * Defaults: + * args[0]: 0 + * args[1]: 0 + * + * References: ECMA-48 § 8.3.116 + * + * Probably not worth implementing. + */ +} + +void +Terminal::SGR(vte::parser::Sequence const& seq) +{ + /* + * SGR - select-graphics-rendition + * Selects the character attributes to use for newly inserted + * characters. + * + * Arguments: + * args[0:]: the attributes + * 0 = reset all attributes + * + * Defaults: + * args[0]: 0 (reset all attributes) + * + * References: ECMA-48 § 8.3.117 + * VT525 + */ + auto const n_params = seq.size(); + + /* If we had no parameters, default to the defaults. */ + if (n_params == 0) { + reset_default_attributes(false); + return; + } + + for (unsigned int i = 0; i < n_params; i = seq.next(i)) { + auto const param = seq.param(i); + switch (param) { + case -1: + case VTE_SGR_RESET_ALL: + reset_default_attributes(false); + break; + case VTE_SGR_SET_BOLD: + m_defaults.attr.set_bold(true); + break; + case VTE_SGR_SET_DIM: + m_defaults.attr.set_dim(true); + break; + case VTE_SGR_SET_ITALIC: + m_defaults.attr.set_italic(true); + break; + case VTE_SGR_SET_UNDERLINE: { + unsigned int v = 1; + /* If we have a subparameter, get it */ + if (seq.param_nonfinal(i)) { + v = seq.param(i + 1, 1, 0, 3); + } + m_defaults.attr.set_underline(v); + break; + } + case VTE_SGR_SET_BLINK: + m_defaults.attr.set_blink(true); + break; + case VTE_SGR_SET_REVERSE: + m_defaults.attr.set_reverse(true); + break; + case VTE_SGR_SET_INVISIBLE: + m_defaults.attr.set_invisible(true); + break; + case VTE_SGR_SET_STRIKETHROUGH: + m_defaults.attr.set_strikethrough(true); + break; + case VTE_SGR_SET_UNDERLINE_DOUBLE: + m_defaults.attr.set_underline(2); + break; + case VTE_SGR_RESET_BOLD_AND_DIM: + m_defaults.attr.unset(VTE_ATTR_BOLD_MASK | VTE_ATTR_DIM_MASK); + break; + case VTE_SGR_RESET_ITALIC: + m_defaults.attr.set_italic(false); + break; + case VTE_SGR_RESET_UNDERLINE: + m_defaults.attr.set_underline(0); + break; + case VTE_SGR_RESET_BLINK: + m_defaults.attr.set_blink(false); + break; + case VTE_SGR_RESET_REVERSE: + m_defaults.attr.set_reverse(false); + break; + case VTE_SGR_RESET_INVISIBLE: + m_defaults.attr.set_invisible(false); + break; + case VTE_SGR_RESET_STRIKETHROUGH: + m_defaults.attr.set_strikethrough(false); + break; + case VTE_SGR_SET_FORE_LEGACY_START ... VTE_SGR_SET_FORE_LEGACY_END: + m_defaults.attr.set_fore(VTE_LEGACY_COLORS_OFFSET + (param - 30)); + break; + case VTE_SGR_SET_FORE_SPEC: { + uint32_t fore; + if (G_LIKELY((seq_parse_sgr_color<8, 8, 8>(seq, i, fore)))) + m_defaults.attr.set_fore(fore); + break; + } + case VTE_SGR_RESET_FORE: + /* default foreground */ + m_defaults.attr.set_fore(VTE_DEFAULT_FG); + break; + case VTE_SGR_SET_BACK_LEGACY_START ... VTE_SGR_SET_BACK_LEGACY_END: + m_defaults.attr.set_back(VTE_LEGACY_COLORS_OFFSET + (param - 40)); + break; + case VTE_SGR_SET_BACK_SPEC: { + uint32_t back; + if (G_LIKELY((seq_parse_sgr_color<8, 8, 8>(seq, i, back)))) + m_defaults.attr.set_back(back); + break; + } + case VTE_SGR_RESET_BACK: + /* default background */ + m_defaults.attr.set_back(VTE_DEFAULT_BG); + break; + case VTE_SGR_SET_OVERLINE: + m_defaults.attr.set_overline(true); + break; + case VTE_SGR_RESET_OVERLINE: + m_defaults.attr.set_overline(false); + break; + case VTE_SGR_SET_DECO_SPEC: { + uint32_t deco; + if (G_LIKELY((seq_parse_sgr_color<4, 5, 4>(seq, i, deco)))) + m_defaults.attr.set_deco(deco); + break; + } + case VTE_SGR_RESET_DECO: + /* default decoration color, that is, same as the cell's foreground */ + m_defaults.attr.set_deco(VTE_DEFAULT_FG); + break; + case VTE_SGR_SET_FORE_LEGACY_BRIGHT_START ... VTE_SGR_SET_FORE_LEGACY_BRIGHT_END: + m_defaults.attr.set_fore(VTE_LEGACY_COLORS_OFFSET + (param - 90) + + VTE_COLOR_BRIGHT_OFFSET); + break; + case VTE_SGR_SET_BACK_LEGACY_BRIGHT_START ... VTE_SGR_SET_BACK_LEGACY_BRIGHT_END: + m_defaults.attr.set_back(VTE_LEGACY_COLORS_OFFSET + (param - 100) + + VTE_COLOR_BRIGHT_OFFSET); + break; + } + } + + /* Save the new colors. */ + m_color_defaults.attr.copy_colors(m_defaults.attr); + m_fill_defaults.attr.copy_colors(m_defaults.attr); +} + +void +Terminal::SHS(vte::parser::Sequence const& seq) +{ + /* + * SHS - select character spacing + * + * Arguments: + * args[0]: spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.118 + * + * Not applicable in VTE. + */ +} + +void +Terminal::SIMD(vte::parser::Sequence const& seq) +{ + /* + * SIMD - select implicit movement direction + * + * Arguments: + * args[0]: direction + * 0 = character progression + * 1 = opposite of character progression + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.120 + */ +} + +void +Terminal::SL(vte::parser::Sequence const& seq) +{ + /* + * SL - scroll left + * + * Arguments: + * args[0]: number of character positions (presentation) + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.121 + * + * Probably not worth implementing. + */ +} + +void +Terminal::SLH(vte::parser::Sequence const& seq) +{ + /* + * SLH - set line home + * + * Arguments: + * args[0]: position in the active line + * + * Defaults: + * args[0]: no default + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.122 + */ +} + +void +Terminal::SLL(vte::parser::Sequence const& seq) +{ + /* + * SLL - set line limit + * + * Arguments: + * args[0]: position in the active line + * + * Defaults: + * args[0]: no default + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.123 + */ +} + +void +Terminal::SLS(vte::parser::Sequence const& seq) +{ + /* + * SLS - set line spacing + * + * Arguments: + * args[0]: spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.124 + * + * Not applicable in VTE. + */ +} + +void +Terminal::SM_ECMA(vte::parser::Sequence const& seq) +{ + /* + * SM_ECMA - set-mode-ecma + * + * Defaults: none + * + * References: ECMA-48 § 8.3.125 + */ + + set_mode_ecma(seq, true); +} + +void +Terminal::SM_DEC(vte::parser::Sequence const& seq) +{ + /* + * SM_DEC - set-mode-dec + * This is the same as SM_ECMA but for DEC modes. + * + * Defaults: none + * + * References: VT525 + */ + + set_mode_private(seq, true); +} + +void +Terminal::SOH(vte::parser::Sequence const& seq) +{ + /* + * SOH - start of heading + * + * References: ECMA-48 § 8.3.127 + */ +} + +void +Terminal::SPA(vte::parser::Sequence const& seq) +{ + /* + * SPA - start of protected area + * Marks the start of an area of positions (presentation) + * that are protected; the end of the area will be + * marked by EPA. + * + * The contents of the area will be protected against + * alteration, transfer (depending on the GATM setting), + * and erasure (depending on the ERM setting). + * + * References: ECMA-48 § 8.3.129 + */ +} + +void +Terminal::SPD(vte::parser::Sequence const& seq) +{ + /* + * SPD - select presentation directions + * + * Arguments: + * args[0]: line orientation, progression, character path + * 0 = horizontal, TTB, LTR + * 1 = vertical, RTL, TTB + * 2 = vertical, LTR, TTB + * 3 = horizontal, TTB, RTL + * 4 = vertical, LTR, BTT + * 5 = horizontal, BTT, RTL + * 6 = horizontal, BTT, LTR + * 7 = vertical, RTL, BTT + * + * args[1]: effect + * 0 = implementation-defined + * 1 = ... + * 2 = ... + * + * Defaults: + * args[0]: 0 + * args[1]: 0 + * + * References: ECMA-48 § 8.3.130 + */ +} + +void +Terminal::SPH(vte::parser::Sequence const& seq) +{ + /* + * SPH - set page home + * + * Arguments: + * args[0]: position in the active page + * + * Defaults: + * args[0]: no default + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.131 + */ +} + +void +Terminal::SPI(vte::parser::Sequence const& seq) +{ + /* + * SPI - spacing increment + * Set line and character spacing for following text. + * + * Arguments: + * args[0]: line spacing (in the unit set by SSU) + * args[0]: character spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: no default + * args[1]: no default + * + * References: ECMA-48 § 8.3.132 + */ +} + +void +Terminal::SPL(vte::parser::Sequence const& seq) +{ + /* + * SPL - set page limit + * + * Arguments: + * args[0]: line position in the active page + * + * Defaults: + * args[0]: no default + * + * Depending on DCSM, this function works on the presentation + * or data position. + * + * References: ECMA-48 § 8.3.133 + */ +} + +void +Terminal::SPQR(vte::parser::Sequence const& seq) +{ + /* + * SPQR - select print quality and rapidity + * + * Arguments: + * args[0]: + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.134 + */ +} + +void +Terminal::SR(vte::parser::Sequence const& seq) +{ + /* + * SL - scroll right + * + * Arguments: + * args[0]: number of character positions (presentation) + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.135 + * + * Probably not worth implementing. + */ +} + +void +Terminal::SRCS(vte::parser::Sequence const& seq) +{ + /* + * SRCS - set reduced character separation + * + * Arguments: + * args[0]: spacing (in the unit set by SSU) + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.136 + * + * Not applicable in VTE. + */ +} + +void +Terminal::SRS(vte::parser::Sequence const& seq) +{ + /* + * SRS - start reversed string + * + * Arguments: + * args[0]: direction + * 0 = End of reversed string + * 1 = Start of reversed string + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.137 + */ +} + +void +Terminal::SSA(vte::parser::Sequence const& seq) +{ + /* + * SSA - start of selected area + * Marks the start of an area of positions (presentation) + * that are selected for transfer; the end of the area will + * be marked by ESA. + * + * What will actually be transmitted depends on the setting + * of the GATM mode, and areas set by the DAQ and SPA/EPA + * functions. + * + * References: ECMA-48 § 8.3.138 + */ +} + +void +Terminal::SSU(vte::parser::Sequence const& seq) +{ + /* + * SSU - set size unit + * + * Arguments: + * args[0]: unit + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.139 + */ +} + +void +Terminal::SSW(vte::parser::Sequence const& seq) +{ + /* + * SSW - set space width + * + * Arguments: + * args[0]: width (in the unit set by SSU) + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.140 + */ +} + +void +Terminal::SS2(vte::parser::Sequence const& seq) +{ + /* + * SS2 - single-shift-2 + * Temporarily map G2 into GL for the next graphics character. + * + * References: ECMA-35 § 8.4, 9.4 + * ECMA-48 § 8.3.141 + * VT525 + */ +#if 0 + screen->state.glt = &screen->g2; +#endif +} + +void +Terminal::SS3(vte::parser::Sequence const& seq) +{ + /* + * SS3 - single-shift-3 + * Temporarily map G3 into GL for the next graphics character + * + * References: ECMA-35 § 8.4, 9.4 + * ECMA-48 § 8.3.142 + * VT525 + */ +#if 0 + screen->state.glt = &screen->g3; +#endif +} + +void +Terminal::ST(vte::parser::Sequence const& seq) +{ + /* + * ST - string-terminator + * The string-terminator is usually part of control-sequences and + * handled by the parser. In all other situations it is silently + * ignored. + * + * References: ECMA-48 § 8.3.143 + */ +} + +void +Terminal::STAB(vte::parser::Sequence const& seq) +{ + /* + * STAB - selective tabulation + * + * Arguments: + * args[0]: + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.144 + * ITU-T Rec. T.416 (Open Document Architecture) + */ +} + +void +Terminal::STS(vte::parser::Sequence const& seq) +{ + /* + * STS - set transmit state + * + * References: ECMA-48 § 8.3.145 + * + * Not worth implementing. + */ +} + +void +Terminal::STX(vte::parser::Sequence const& seq) +{ + /* + * STX - start of text + * + * References: ECMA-48 § 8.3.146 + * ISO 1745 + * + * Not worth implementing. + */ } -/* Set certain terminal attributes. */ -void -VteTerminalPrivate::seq_decset(vte::parser::Params const& params) -{ - decset(params, false, false, true); -} +void +Terminal::SU(vte::parser::Sequence const& seq) +{ + /* + * SU - scroll-up / pan down + * Scrolls up a number of lines (presentation). + * + * Arguments: + * args[0]: number of lines to scroll + * + * Defaults: + * args[0]: 1 + * + * References: EMCA-48 § 8.3.147 + * VT525 + */ +#if 0 + unsigned int num = 1; + + if (seq->args[0] > 0) + num = seq->args[0]; -/* Unset certain terminal attributes. */ -void -VteTerminalPrivate::seq_decreset(vte::parser::Params const& params) -{ - decset(params, false, false, false); + vte_page_scroll_up(screen->page, + num, + &screen->state.attr, + screen->age, + screen->history); +#endif + + auto value = std::max(seq.collect1(0, 1), int(1)); + scroll_text(-value); } -/* Erase certain lines in the display. */ void -VteTerminalPrivate::seq_erase_in_display(vte::parser::Params const& params) +Terminal::SUB(vte::parser::Sequence const& seq) { - /* The default parameter is 0. */ - long param = 0; - /* Pull out the first parameter. */ - // FIXMEchpe why this weird taking of the first number param, not the actual first param? - auto n_params = params.size(); - for (unsigned int i = 0; i < n_params; i++) { - if (params.number_at_unchecked(i, param)) - break; - } + /* + * SUB - substitute + * Cancel the current control-sequence and print a replacement + * character. Our parser already handles this so all we have to do is + * print the replacement character. + * + * References: ECMA-48 § 8.3.148 + */ - erase_in_display(param); + insert_char(0xfffdu, false, true); } void -VteTerminalPrivate::erase_in_display(long param) +Terminal::SVS(vte::parser::Sequence const& seq) { - /* Clear the right area. */ - switch (param) { - case 0: - /* Clear below the current line. */ - clear_below_current(); - break; - case 1: - /* Clear above the current line. */ - clear_above_current(); - /* Clear everything to the left of the cursor, too. */ - /* FIXME: vttest. */ - clear_to_bol(); - break; - case 2: - /* Clear the entire screen. */ - clear_screen(); - break; - case 3: - /* Drop the scrollback. */ - drop_scrollback(); - break; - default: - break; - } - /* We've modified the display. Make a note of it. */ - m_text_deleted_flag = TRUE; + /* + * SVS - select line spacing + * + * Arguments: + * args[0]: spacing + * 0 = ... + * ... + * 9 = ... + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.149 + */ } -/* Erase certain parts of the current line in the display. */ void -VteTerminalPrivate::seq_erase_in_line(vte::parser::Params const& params) +Terminal::SYN(vte::parser::Sequence const& seq) { - /* The default parameter is 0. */ - long param = 0; - /* Pull out the first parameter. */ - // FIXMEchpe why this weird taking of the first number param, not the actual first param? - auto n_params = params.size(); - for (unsigned int i = 0; i < n_params; i++) { - if (params.number_at_unchecked(i, param)) - break; - } - - erase_in_line(param); + /* + * SYN - synchronous idle + * + * References: ECMA-48 § 8.3.150 + * ISO 1745 + * + * Not worth implementing. + */ } void -VteTerminalPrivate::erase_in_line(long param) +Terminal::TAC(vte::parser::Sequence const& seq) { - /* Clear the right area. */ - switch (param) { - case 0: - /* Clear to end of the line. */ - clear_to_eol(); - break; - case 1: - /* Clear to start of the line. */ - clear_to_bol(); - break; - case 2: - /* Clear the entire line. */ - clear_current_line(); - break; - default: - break; - } - /* We've modified the display. Make a note of it. */ - m_text_deleted_flag = TRUE; + /* + * TAC - tabulation aligned centre + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.151 + */ } -/* Perform a full-bore reset. */ void -VteTerminalPrivate::seq_full_reset(vte::parser::Params const& params) +Terminal::TALE(vte::parser::Sequence const& seq) { - reset(true, true); + /* + * TALE - tabulation aligned leading edge + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.152 + */ } -/* Insert a certain number of lines below the current cursor. */ void -VteTerminalPrivate::seq_insert_lines(vte::parser::Params const& params) +Terminal::TATE(vte::parser::Sequence const& seq) { - /* The default is one. */ - auto param = params.number_or_default_at(0, 1); - insert_lines(param); + /* + * TATE - tabulation aligned trailing edge + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.153 + */ } void -VteTerminalPrivate::insert_lines(vte::grid::row_t param) +Terminal::TBC(vte::parser::Sequence const& seq) { - vte::grid::row_t end, i; - - /* Find the region we're messing with. */ - auto row = m_screen->cursor.row; - if (m_scrolling_restricted) { - end = m_screen->insert_delta + m_scrolling_region.end; - } else { - end = m_screen->insert_delta + m_row_count - 1; - } - - /* Only allow to insert as many lines as there are between this row - * and the end of the scrolling region. See bug #676090. + /* + * TBC - tab-clear + * Clears tab stops. + * + * Arguments: + * args[0]: mode + * + * Defaults: + * args[0]: 0 + * + * References: ECMA-48 § 8.3.154 */ - auto limit = end - row + 1; - param = MIN (param, limit); - for (i = 0; i < param; i++) { - /* Clear a line off the end of the region and add one to the - * top of the region. */ - ring_remove(end); - ring_insert(row, true); + auto const param = seq.collect1(0); + switch (param) { + case -1: + case 0: + /* Clear character tabstop at the current presentation position */ + m_tabstops.unset(get_cursor_column()); + break; + case 1: + /* Clear line tabstop at the current line */ + break; + case 2: + /* Clear all character tabstops in the current line */ + /* NOTE: vttest issues this but claims it's a 'no-op' */ + m_tabstops.clear(); + break; + case 3: + /* Clear all character tabstops */ + m_tabstops.clear(); + break; + case 4: + /* Clear all line tabstops */ + break; + case 5: + /* Clear all (character and line) tabstops */ + m_tabstops.clear(); + break; + default: + break; } - m_screen->cursor.col = 0; - /* Update the display. */ - scroll_region(row, end - row + 1, param); - /* Adjust the scrollbars if necessary. */ - adjust_adjustments(); - /* We've modified the display. Make a note of it. */ - m_text_inserted_flag = TRUE; } -/* Delete certain lines from the scrolling region. */ void -VteTerminalPrivate::seq_delete_lines(vte::parser::Params const& params) +Terminal::TCC(vte::parser::Sequence const& seq) { - /* The default is one. */ - auto param = params.number_or_default_at(0, 1); - delete_lines(param); + /* + * TCC - tabulation centred on character + * + * Defaults: + * args[0]: no default + * args[1]: 32 (SPACE) + * + * References: ECMA-48 § 8.3.155 + */ } void -VteTerminalPrivate::delete_lines(vte::grid::row_t param) +Terminal::TSR(vte::parser::Sequence const& seq) { - vte::grid::row_t end, i; - - /* Find the region we're messing with. */ - auto row = m_screen->cursor.row; - if (m_scrolling_restricted) { - end = m_screen->insert_delta + m_scrolling_region.end; - } else { - end = m_screen->insert_delta + m_row_count - 1; - } - - /* Only allow to delete as many lines as there are between this row - * and the end of the scrolling region. See bug #676090. + /* + * TSR - tabulation stop remove + * This clears a tab stop at position @arg[0] in the active line (presentation), + * and on any lines below it. + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.156 */ - auto limit = end - row + 1; - param = MIN (param, limit); - /* Clear them from below the current cursor. */ - for (i = 0; i < param; i++) { - /* Insert a line at the end of the region and remove one from - * the top of the region. */ - ring_remove(row); - ring_insert(end, true); - } - m_screen->cursor.col = 0; - /* Update the display. */ - scroll_region(row, end - row + 1, -param); - /* Adjust the scrollbars if necessary. */ - adjust_adjustments(); - /* We've modified the display. Make a note of it. */ - m_text_deleted_flag = TRUE; + auto const pos = seq.collect1(0); + if (pos < 1 || pos > m_column_count) + return; + + m_tabstops.unset(pos - 1); } -/* Device status reports. The possible reports are the cursor position and - * whether or not we're okay. */ void -VteTerminalPrivate::seq_device_status_report(vte::parser::Params const& params) +Terminal::TSS(vte::parser::Sequence const& seq) { - long param; - if (!params.number_at(0, param)) - return; - - switch (param) { - case 5: - /* Send a thumbs-up sequence. */ - feed_child(_VTE_CAP_CSI "0n", -1); - break; - case 6: - /* Send the cursor position. */ - vte::grid::row_t rowval, origin, rowmax; - if (m_origin_mode && - m_scrolling_restricted) { - origin = m_scrolling_region.start; - rowmax = m_scrolling_region.end; - } else { - origin = 0; - rowmax = m_row_count - 1; - } - // FIXMEchpe this looks wrong. shouldn't this first clamp to origin,rowmax and *then* subtract origin? - rowval = m_screen->cursor.row - m_screen->insert_delta - origin; - rowval = CLAMP(rowval, 0, rowmax); - char buf[128]; - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "%ld;%ldR", - rowval + 1, - CLAMP(m_screen->cursor.col + 1, 1, m_column_count)); - feed_child(buf, -1); - break; - default: - break; - } + /* + * TSS - thin space specification + * + * Arguments: + * args[0]: width (in the unit set by SSU) + * + * Defaults: + * args[0]: no default + * + * References: ECMA-48 § 8.3.157 + * + * Not applicable in VTE. + */ } -/* DEC-style device status reports. */ void -VteTerminalPrivate::seq_dec_device_status_report(vte::parser::Params const& params) +Terminal::VPA(vte::parser::Sequence const& seq) { - long param; - if (!params.number_at(0, param)) - return; + /* + * VPA - vertical line position absolute + * Moves the cursor to the specified line on the current column (data). + * + * Arguments: + * args[0]: line number + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.158 + * VT525 + */ +#if 0 + unsigned int pos = 1; - switch (param) { - case 6: - /* Send the cursor position. */ - vte::grid::row_t rowval, origin, rowmax; - if (m_origin_mode && - m_scrolling_restricted) { - origin = m_scrolling_region.start; - rowmax = m_scrolling_region.end; - } else { - origin = 0; - rowmax = m_row_count - 1; - } - // FIXMEchpe this looks wrong. shouldn't this first clamp to origin,rowmax and *then* subtract origin? - rowval = m_screen->cursor.row - m_screen->insert_delta - origin; - rowval = CLAMP(rowval, 0, rowmax); - char buf[128]; - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "?%ld;%ldR", - rowval + 1, - CLAMP(m_screen->cursor.col + 1, 1, m_column_count)); - feed_child(buf, -1); - break; - case 15: - /* Send printer status -- 10 = ready, - * 11 = not ready. We don't print. */ - feed_child(_VTE_CAP_CSI "?11n", -1); - break; - case 25: - /* Send UDK status -- 20 = locked, - * 21 = not locked. I don't even know what - * that means, but punt anyway. */ - feed_child(_VTE_CAP_CSI "?20n", -1); - break; - case 26: - /* Send keyboard status. 50 = no locator. */ - feed_child(_VTE_CAP_CSI "?50n", -1); - break; - default: - break; - } -} + if (seq->args[0] > 0) + pos = seq->args[0]; -/* Restore a certain terminal attribute. */ -void -VteTerminalPrivate::seq_restore_mode(vte::parser::Params const& params) -{ - decset(params, true, false, false); -} - -/* Save a certain terminal attribute. */ -void -VteTerminalPrivate::seq_save_mode(vte::parser::Params const& params) -{ - decset(params, false, true, false); + screen_cursor_clear_wrap(screen); + screen_cursor_set_rel(screen, screen->state.cursor_x, pos - 1); +#endif + + // FIXMEchpe shouldn't we ensure_cursor_is_onscreen AFTER setting the new cursor row? + ensure_cursor_is_onscreen(); + + auto value = seq.collect1(0, 1, 1, m_row_count); + set_cursor_row1(value); } -/* Perform a screen alignment test -- fill all visible cells with the - * letter "E". */ void -VteTerminalPrivate::seq_screen_alignment_test(vte::parser::Params const& params) +Terminal::VPB(vte::parser::Sequence const& seq) { - for (auto row = m_screen->insert_delta; - row < m_screen->insert_delta + m_row_count; - row++) { - /* Find this row. */ - while (_vte_ring_next(m_screen->row_data) <= row) - ring_append(false); - adjust_adjustments(); - auto rowdata = _vte_ring_index_writable (m_screen->row_data, row); - g_assert(rowdata != NULL); - /* Clear this row. */ - _vte_row_data_shrink (rowdata, 0); + /* + * VPB - line position backward + * Moves the cursor up the specified number of lines on + * the current column (data). + * + * Arguments: + * args[0]: line number + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.159 + * VT525 + */ +#if 0 + unsigned int num = 1; - emit_text_deleted(); - /* Fill this row. */ - VteCell cell; - cell.c = 'E'; - cell.attr = basic_cell.attr; - cell.attr.set_columns(1); - _vte_row_data_fill(rowdata, &cell, m_column_count); - emit_text_inserted(); - } - invalidate_all(); + if (seq->args[0] > 0) + num = seq->args[0]; - /* We modified the display, so make a note of it for completeness. */ - m_text_modified_flag = TRUE; + screen_cursor_clear_wrap(screen); + screen_cursor_down(screen, num, false); +#endif } -/* DECSCUSR set cursor style */ void -VteTerminalPrivate::seq_set_cursor_style(vte::parser::Params const& params) +Terminal::VPR(vte::parser::Sequence const& seq) { - auto n_params = params.size(); - if (n_params > 1) - return; + /* + * VPR - vertical line position relative + * Moves the cursor down the specified number of lines + * on the current column (data). + * + * Arguments: + * args[0]: line number + * + * Defaults: + * args[0]: 1 + * + * References: ECMA-48 § 8.3.160 + * VT525 + */ +#if 0 + unsigned int num = 1; - long style; - if (n_params == 0) { - /* no parameters means default (according to vt100.net) */ - style = VTE_CURSOR_STYLE_TERMINAL_DEFAULT; - } else { - if (!params.number_at(0, style)) - return; - if (style < 0 || style > 6) { - return; - } - } + if (seq->args[0] > 0) + num = seq->args[0]; - set_cursor_style(VteCursorStyle(style)); + screen_cursor_clear_wrap(screen); + screen_cursor_down(screen, num, false); +#endif } -/* Perform a soft reset. */ void -VteTerminalPrivate::seq_soft_reset(vte::parser::Params const& params) +Terminal::VT(vte::parser::Sequence const& seq) { - reset(false, false); + /* + * VT - vertical-tab + * This causes a vertical jump by one line. Terminals treat it exactly + * the same as LF. + * + * References: ECMA-48 § 8.3.161 + */ + + LF(seq); } -/* Window manipulation control sequences. Most of these are considered - * bad ideas, but they're implemented as signals which the application - * is free to ignore, so they're harmless. Handle at most one action, - * see bug 741402. */ void -VteTerminalPrivate::seq_window_manipulation(vte::parser::Params const& params) +Terminal::VTS(vte::parser::Sequence const& seq) { - auto n_params = params.size(); - if (n_params < 1) - return; - - long param; - if (!params.number_at_unchecked(0, param)) - return; - - long arg1 = -1; - long arg2 = -1; - if (n_params >= 2) - params.number_at_unchecked(1, arg1); - if (n_params >= 3) - params.number_at_unchecked(2, arg2); + /* + * VTS - line tabulation set + * Sets a tabstop in the active line (presentation). + * + * References: ECMA-48 § 8.3.162 + * + * Not worth implementing. + */ +} - GdkScreen *gscreen; - char buf[128]; - int width, height; +void +Terminal::WYCAA(vte::parser::Sequence const& seq) +{ + /* + * WYCAA - redefine character display attribute association + * + * Arguments: + * args[0]: mode + * + * Defaults: + * args[0]: no defaults + * + * Probably not worth implementing. + * + * References: WY370 + */ - switch (param) { - case 1: - _vte_debug_print(VTE_DEBUG_PARSE, - "Deiconifying window.\n"); - emit_deiconify_window(); - break; - case 2: - _vte_debug_print(VTE_DEBUG_PARSE, - "Iconifying window.\n"); - emit_iconify_window(); + switch (seq.collect1(0)) { + case -1: break; - case 3: - if ((arg1 != -1) && (arg2 != -1)) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Moving window to " - "%ld,%ld.\n", arg1, arg2); - emit_move_window(arg1, arg2); - } - break; - case 4: - if ((arg1 != -1) && (arg2 != -1)) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Resizing window " - "(to %ldx%ld pixels, grid size %ldx%ld).\n", - arg2, arg1, - arg2 / m_cell_width, - arg1 / m_cell_height); - emit_resize_window(arg2 / m_cell_width, - arg1 / m_cell_height); - } - break; - case 5: - _vte_debug_print(VTE_DEBUG_PARSE, "Raising window.\n"); - emit_raise_window(); - break; - case 6: - _vte_debug_print(VTE_DEBUG_PARSE, "Lowering window.\n"); - emit_lower_window(); + + case 0 ... 47: + /* WYCAA - redefine character attribute association + * + * Arguments: + * args[0]: character attribute association to be set (0…47) + * args[1]: palette color index for foreground color (0…64) + * args[2]: palette color index for background color (0…64) + * args[3]: new definition for the attribute association @args[0] + * + * Defaults: + * args[0]: ? + * args[1]: ? + * args[2]: ? + * args[3]: ? + */ break; - case 7: - _vte_debug_print(VTE_DEBUG_PARSE, - "Refreshing window.\n"); - invalidate_all(); - emit_refresh_window(); + + case 48: + /* WYCOLOR - select foreground color palette + * + * Arguments: + * args[1]: color palette number 0…7 + * + * Defaults: + * args[1]: ? + */ break; - case 8: - if ((arg1 != -1) && (arg2 != -1)) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Resizing window " - "(to %ld columns, %ld rows).\n", - arg2, arg1); - emit_resize_window(arg2, arg1); - } + + case 49: + case 51 ... 52: + /* WYCOLOR - select background (49)/screen border(51)/cursor(52) color + * Selects the background (and screen border) color. + * + * Arguments: + * args[1]: palette color index 0…64 + * + * Defaults: + * args[1]: ? + */ break; - case 9: - switch (arg1) { - case 0: - _vte_debug_print(VTE_DEBUG_PARSE, - "Restoring window.\n"); - emit_restore_window(); - break; - case 1: - _vte_debug_print(VTE_DEBUG_PARSE, - "Maximizing window.\n"); - emit_maximize_window(); - break; - default: - break; - } + + case 50: + /* WYCOLOR - restore fore- and background colors to set-up default */ break; - case 11: - /* If we're unmapped, then we're iconified. */ - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "%dt", - 1 + !gtk_widget_get_mapped(m_widget)); - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting window state %s.\n", - gtk_widget_get_mapped(m_widget) ? - "non-iconified" : "iconified"); - feed_child(buf, -1); + + case 53: + /* WYSOVR - select overstrike position + * + * Arguments: + * args[1]: scanline number in the charcell (0=top, …bottom) to + * put the overstrike + * + * Defaults: + * args[1]: + */ break; - case 13: - /* Send window location, in pixels. */ - gdk_window_get_origin(gtk_widget_get_window(m_widget), - &width, &height); - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "3;%d;%dt", - width + m_padding.left, - height + m_padding.top); - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting window location" - "(%d++,%d++).\n", - width, height); - feed_child(buf, -1); + + case 54 ... 57: + /* WYCOLOR - select attributes and colors + * for user status line (54), system status line(55), + * replacement character(56), noneraseable character(57). + * + * Arguments: + * args[1]: + * args[2]: + * + * Defaults: + * args[1]: + * args[2]: + */ + + case 58: + /* WYDTSET - set date and time */ break; - case 14: - /* Send window size, in pixels. */ - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "4;%d;%dt", - (int)(m_row_count * m_cell_height), - (int)(m_column_count * m_cell_width)); - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting window size " - "(%dx%d)\n", - (int)(m_row_count * m_cell_height), - (int)(m_column_count * m_cell_width)); - feed_child(buf, -1); + case 59: + /* WYDFPG - define page for session + * + * Arguments: + * args[1]: + * args[2]: + * args[3]: + * args[4]: + * + * Defaults: + * args[1]: + * args[2]: + * args[3]: + * args[4]: + */ break; - case 18: - /* Send widget size, in cells. */ - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting widget size.\n"); - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "8;%ld;%ldt", - m_row_count, - m_column_count); - feed_child(buf, -1); - break; - case 19: - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting screen size.\n"); - gscreen = gtk_widget_get_screen(m_widget); - height = gdk_screen_get_height(gscreen); - width = gdk_screen_get_width(gscreen); - g_snprintf(buf, sizeof(buf), - _VTE_CAP_CSI "9;%ld;%ldt", - height / m_cell_height, - width / m_cell_width); - feed_child(buf, -1); + + case 60: + /* WYIND - restore default color index values */ break; - case 20: - /* Report a static icon title, since the real - icon title should NEVER be reported, as it - creates a security vulnerability. See - http://marc.info/?l=bugtraq&m=104612710031920&w=2 - and CVE-2003-0070. */ - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting fake icon title.\n"); - /* never use m_icon_title here! */ - g_snprintf (buf, sizeof (buf), - _VTE_CAP_OSC "LTerminal" _VTE_CAP_ST); - feed_child(buf, -1); + + case 61 ... 62: + case 64 ... 65: + /* WYIND - set current fore/background color + * Sets the current fore- (61, 64) or background (62, 65) + * color for eraseable (61, 62) or noneraseable (64, 65) + * characters. + * + * Also turns on color index mode. + * + * Arguments: + * args[1]: color index + * + * Defaults: + * args[1]: ? + */ break; - case 21: - /* Report a static window title, since the real - window title should NEVER be reported, as it - creates a security vulnerability. See - http://marc.info/?l=bugtraq&m=104612710031920&w=2 - and CVE-2003-0070. */ - _vte_debug_print(VTE_DEBUG_PARSE, - "Reporting fake window title.\n"); - /* never use m_window_title here! */ - g_snprintf (buf, sizeof (buf), - _VTE_CAP_OSC "lTerminal" _VTE_CAP_ST); - feed_child(buf, -1); + + case 63: + /* WYIND - turn color index mode on/off + * + * Arguments: + * args[1]: setting (0 = off, 1 = on) + * + * Defaults: + * args[1]: ? + */ break; - default: - if (param >= 24) { - _vte_debug_print(VTE_DEBUG_PARSE, - "Resizing to %ld rows.\n", - param); - /* Resize to the specified number of - * rows. */ - emit_resize_window(m_column_count, - param); - } + + case 66: + /* WYIND - redefine color index + * + * Arguments: + * args[1]: index + * args[2]: value + * + * Defaults: + * args[1]: ? + * args[2]: ? + */ break; } } -/* Internal helper for setting/querying special colors */ void -VteTerminalPrivate::change_special_color(vte::parser::Params const& params, - int index, - int index_fallback, - const char *osc, - const char *terminator) +Terminal::WYDHL_BH(vte::parser::Sequence const& seq) { - char* name; - if (!params.string_at(0, name)) - return; - - vte::color::rgb color; - - if (color.parse(name)) - set_color(index, VTE_COLOR_SOURCE_ESCAPE, color); - else if (strcmp (name, "?") == 0) { - gchar buf[128]; - auto c = get_color(index); - if (c == NULL && index_fallback != -1) - c = get_color(index_fallback); - g_assert(c != NULL); - g_snprintf (buf, sizeof (buf), - _VTE_CAP_OSC "%s;rgb:%04x/%04x/%04x%s", - osc, c->red, c->green, c->blue, terminator); - feed_child(buf, -1); - } + /* + * WYDHL_BH - single width double height line: bottom half + * + * Probably not worth implementing. + * + * References: WY370 + */ } -/* Change the bold color, BEL terminated */ void -VteTerminalPrivate::seq_change_bold_color_bel(vte::parser::Params const& params) +Terminal::WYDHL_TH(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_BOLD_FG, VTE_DEFAULT_FG, "5;0", BEL); + /* + * WYDHL_TH - single width double height line: top half + * + * Probably not worth implementing. + * + * References: WY370 + */ } -/* Change the bold color, ST terminated */ void -VteTerminalPrivate::seq_change_bold_color_st(vte::parser::Params const& params) +Terminal::WYSCRATE(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_BOLD_FG, VTE_DEFAULT_FG, "5;0", ST); + /* + * WYSCRATE - set smooth scroll rate + * Selects scrolling rate if DECSCLM is set. + * + * Probably not worth implementing. + * + * References: WY370 + */ } -/* Reset the bold color */ void -VteTerminalPrivate::seq_reset_bold_color(vte::parser::Params const& params) +Terminal::WYLSFNT(vte::parser::Sequence const& seq) { - reset_color(VTE_BOLD_FG, VTE_COLOR_SOURCE_ESCAPE); + /* + * WYLSFNT - load soft font + * + * Probably not worth implementing. + * + * References: WY370 + */ } -/* Change the default foreground cursor, BEL terminated */ void -VteTerminalPrivate::seq_change_foreground_color_bel(vte::parser::Params const& params) +Terminal::XDGSYNC(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_DEFAULT_FG, -1, "10", BEL); -} + /* + * XDGSYNC - synchronous update + * Content received between BSU and ESU will be committed + * atomically on ESU. This is to avoid half-drawn screen + * content. + * The terminal may ignore this, or apply a timeout, or + * terminate the synchronous update prematurely for any + * reason. + * + * Arguments: + * args[0]: + * 1: start (begin synchronous update, BSU) + * 2: end (end synchronous update, ESU) + * + * Defaults: + * args[0]: no defaults + * + * References: https://gitlab.com/gnachman/iterm2/wikis/synchronized-updates-spec + */ -/* Change the default foreground cursor, ST terminated */ -void -VteTerminalPrivate::seq_change_foreground_color_st(vte::parser::Params const& params) -{ - change_special_color(params, VTE_DEFAULT_FG, -1, "10", ST); + /* TODO: implement this! https://gitlab.gnome.org/GNOME/vte/issues/15 */ } -/* Reset the default foreground color */ void -VteTerminalPrivate::seq_reset_foreground_color(vte::parser::Params const& params) +Terminal::XTERM_IHMT(vte::parser::Sequence const& seq) { - reset_color(VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE); + /* + * XTERM_IHMT - xterm-initiate-highlight-mouse-tracking + * + * Probably not worth implementing. + */ } -/* Change the default background cursor, BEL terminated */ void -VteTerminalPrivate::seq_change_background_color_bel(vte::parser::Params const& params) +Terminal::XTERM_MLHP(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_DEFAULT_BG, -1, "11", BEL); + /* + * XTERM_MLHP - xterm-memory-lock-hp-bugfix + * + * Probably not worth implementing. + */ } -/* Change the default background cursor, ST terminated */ void -VteTerminalPrivate::seq_change_background_color_st(vte::parser::Params const& params) +Terminal::XTERM_MUHP(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_DEFAULT_BG, -1, "11", ST); + /* + * XTERM_MUHP - xterm-memory-unlock-hp-bugfix + * + * Probably not worth implementing. + */ } -/* Reset the default background color */ void -VteTerminalPrivate::seq_reset_background_color(vte::parser::Params const& params) +Terminal::XTERM_RPM(vte::parser::Sequence const& seq) { - reset_color(VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE); + /* + * XTERM_RPM - xterm-restore-private-mode + * + * Defaults: none + * + * References: XTERM + */ + + save_mode_private(seq, false); } -/* Change the color of the cursor background, BEL terminated */ void -VteTerminalPrivate::seq_change_cursor_background_color_bel(vte::parser::Params const& params) +Terminal::XTERM_RQTCAP(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_CURSOR_BG, VTE_DEFAULT_FG, "12", BEL); + /* + * XTERM_TQTCAP - xterm request termcap/terminfo + * + * Probably not worth implementing. + */ } -/* Change the color of the cursor background, ST terminated */ void -VteTerminalPrivate::seq_change_cursor_background_color_st(vte::parser::Params const& params) +Terminal::XTERM_RRV(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_CURSOR_BG, VTE_DEFAULT_FG, "12", ST); + /* + * XTERM_RRV - xterm-reset-resource-value + * + * Probably not worth implementing. + */ } -/* Reset the color of the cursor */ void -VteTerminalPrivate::seq_reset_cursor_background_color(vte::parser::Params const& params) +Terminal::XTERM_RTM(vte::parser::Sequence const& seq) { - reset_color(VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE); + /* + * XTERM_RTM - xterm-reset-title-mode + * + * Probably not worth implementing. + */ } -/* Change the highlight background color, BEL terminated */ void -VteTerminalPrivate::seq_change_highlight_background_color_bel(vte::parser::Params const& params) +Terminal::XTERM_SGFX(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, "17", BEL); + /* + * XTERM_SGFX - xterm-sixel-graphics + * + * Probably not worth implementing. + */ } -/* Change the highlight background color, ST terminated */ void -VteTerminalPrivate::seq_change_highlight_background_color_st(vte::parser::Params const& params) +Terminal::XTERM_SGR_REPORT(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, "17", ST); + /* + * XTERM_SGR_REPORT: report SGR attributes in rectangular area + * Report common character attributes in the specified rectangle. + * + * Arguments; + * args[0..3]: top, left, bottom, right of the rectangle (1-based) + * + * Defaults: + * args[0]: 1 + * args[1]: 1 + * args[2]: height of current page + * args[3]: width of current page + * + * Reply: SGR + * + * If the top > bottom or left > right, the command is ignored. + * + * These coordinates are interpreted according to origin mode (DECOM), + * but unaffected by the page margins (DECSLRM?). + * + * Note: DECSACE selects whether this function operates on the + * rectangular area or the data stream between the star and end + * positions. + * + * References: XTERM 334 + */ + /* TODO: Implement this */ } -/* Reset the highlight background color */ void -VteTerminalPrivate::seq_reset_highlight_background_color(vte::parser::Params const& params) +Terminal::XTERM_SGR_STACK_POP(vte::parser::Sequence const& seq) { - reset_color(VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE); + /* + * XTERM_SGR_STACK_POP: pop SGR stack + * Restore SGR attributes previously pushed to the stack + * with XTERM_SGR_STACK_PUSH. If there is nothing on the + * stack, does nothing. + * + * Arguments: none + * + * References: XTERM 334 + */ + /* TODO: Implement this: https://gitlab.gnome.org/GNOME/vte/issues/23 */ } -/* Change the highlight foreground color, BEL terminated */ void -VteTerminalPrivate::seq_change_highlight_foreground_color_bel(vte::parser::Params const& params) +Terminal::XTERM_SGR_STACK_PUSH(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_HIGHLIGHT_FG, VTE_DEFAULT_BG, "19", BEL); + /* + * XTERM_SGR_STACK_PUSH: push SGR stack + * Push current SGR attributes to the stack. + * If the stack is full, drops the bottommost item before + * pushing on the stack. + * + * If there are any arguments, they are interpreted as in SGR + * to denote which attributes to save; if there are no arguments, + * all attributes are saved. + * + * Arguments: + * args[0:]: the attributes + * 0 = save all attributes + * + * Defaults: + * args[0]: 0 (save all attributes) + * + * References: XTERM 334 + */ + /* TODO: Implement this: https://gitlab.gnome.org/GNOME/vte/issues/23 */ } -/* Change the highlight foreground color, ST terminated */ void -VteTerminalPrivate::seq_change_highlight_foreground_color_st(vte::parser::Params const& params) +Terminal::XTERM_SPM(vte::parser::Sequence const& seq) { - change_special_color(params, VTE_HIGHLIGHT_FG, VTE_DEFAULT_BG, "19", ST); + /* + * XTERM_SPM - xterm-set-private-mode + * + * Defaults: none + * + * References: XTERM + */ + + save_mode_private(seq, true); } -/* Reset the highlight foreground color */ void -VteTerminalPrivate::seq_reset_highlight_foreground_color(vte::parser::Params const& params) +Terminal::XTERM_SRV(vte::parser::Sequence const& seq) { - reset_color(VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE); + /* + * XTERM_SRV - xterm-set-resource-value + * + * Probably not worth implementing. + */ } -/* URXVT generic OSC 777 */ - void -VteTerminalPrivate::seq_urxvt_777(vte::parser::Params const& params) +Terminal::XTERM_STM(vte::parser::Sequence const& seq) { - /* Accept but ignore this for compatibility with downstream-patched vte (bug #711059)*/ + /* + * XTERM_STM - xterm-set-title-mode + * + * Probably not worth implementing. + */ } -/* iterm2 OSC 133 & 1337 */ - void -VteTerminalPrivate::seq_iterm2_133(vte::parser::Params const& params) +Terminal::XTERM_STCAP(vte::parser::Sequence const& seq) { - /* Accept but ignore this for compatibility when sshing to an osx host - * where the iterm2 integration is loaded even when not actually using - * iterm2. + /* + * XTERM_STCAP - xterm set termcap/terminfo + * + * Probably not worth implementing. */ } void -VteTerminalPrivate::seq_iterm2_1337(vte::parser::Params const& params) +Terminal::XTERM_WM(vte::parser::Sequence const& seq) { - /* Accept but ignore this for compatibility when sshing to an osx host - * where the iterm2 integration is loaded even when not actually using - * iterm2. + /* + * XTERM_WM - xterm-window-management + * + * Window manipulation control sequences. Most of these are considered + * bad ideas, but they're implemented as signals which the application + * is free to ignore, so they're harmless. Handle at most one action, + * see bug 741402. + * + * No parameter default values. + * + * References: XTERM + * VT525 */ -} -#define UNIMPLEMENTED_SEQUENCE_HANDLER(name) \ - void \ - VteTerminalPrivate::seq_ ## name (vte::parser::Params const& params) \ - { \ - static bool warned = false; \ - if (!warned) { \ - _vte_debug_print(VTE_DEBUG_PARSE, \ - "Unimplemented handler for control sequence `%s'.\n", \ - "name"); \ - warned = true; \ - } \ + #if 0 + char buf[128]; + #endif + + int param = seq.collect1(0); + switch (param) { + case -1: + case 0: + break; + + case VTE_XTERM_WM_RESTORE_WINDOW: + _vte_debug_print(VTE_DEBUG_EMULATION, "Deiconifying window.\n"); + emit_deiconify_window(); + break; + + case VTE_XTERM_WM_MINIMIZE_WINDOW: + _vte_debug_print(VTE_DEBUG_EMULATION, "Iconifying window.\n"); + emit_iconify_window(); + break; + + case VTE_XTERM_WM_SET_WINDOW_POSITION: { + int pos_x = seq.collect1(1, 0); + int pos_y = seq.collect1(2, 0); + + _vte_debug_print(VTE_DEBUG_EMULATION, + "Moving window to %d,%d.\n", pos_x, pos_y); + emit_move_window(pos_x, pos_y); + break; } -UNIMPLEMENTED_SEQUENCE_HANDLER(ansi_conformance_level_1) -UNIMPLEMENTED_SEQUENCE_HANDLER(ansi_conformance_level_2) -UNIMPLEMENTED_SEQUENCE_HANDLER(ansi_conformance_level_3) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_font_name) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_font_number) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_logfile) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_mouse_cursor_background_color_bel) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_mouse_cursor_background_color_st) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_mouse_cursor_foreground_color_bel) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_mouse_cursor_foreground_color_st) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_background_color_bel) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_background_color_st) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_cursor_color_bel) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_cursor_color_st) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_foreground_color_bel) -UNIMPLEMENTED_SEQUENCE_HANDLER(change_tek_foreground_color_st) -UNIMPLEMENTED_SEQUENCE_HANDLER(cursor_lower_left) -UNIMPLEMENTED_SEQUENCE_HANDLER(dec_media_copy) -UNIMPLEMENTED_SEQUENCE_HANDLER(default_character_set) -UNIMPLEMENTED_SEQUENCE_HANDLER(device_control_string) -UNIMPLEMENTED_SEQUENCE_HANDLER(double_height_bottom_half) -UNIMPLEMENTED_SEQUENCE_HANDLER(double_height_top_half) -UNIMPLEMENTED_SEQUENCE_HANDLER(double_width) -UNIMPLEMENTED_SEQUENCE_HANDLER(eight_bit_controls) -UNIMPLEMENTED_SEQUENCE_HANDLER(enable_filter_rectangle) -UNIMPLEMENTED_SEQUENCE_HANDLER(enable_locator_reporting) -UNIMPLEMENTED_SEQUENCE_HANDLER(end_of_guarded_area) -UNIMPLEMENTED_SEQUENCE_HANDLER(initiate_hilite_mouse_tracking) -UNIMPLEMENTED_SEQUENCE_HANDLER(invoke_g1_character_set_as_gr) -UNIMPLEMENTED_SEQUENCE_HANDLER(invoke_g2_character_set) -UNIMPLEMENTED_SEQUENCE_HANDLER(invoke_g2_character_set_as_gr) -UNIMPLEMENTED_SEQUENCE_HANDLER(invoke_g3_character_set) -UNIMPLEMENTED_SEQUENCE_HANDLER(invoke_g3_character_set_as_gr) -UNIMPLEMENTED_SEQUENCE_HANDLER(linux_console_cursor_attributes) -UNIMPLEMENTED_SEQUENCE_HANDLER(media_copy) -UNIMPLEMENTED_SEQUENCE_HANDLER(memory_lock) -UNIMPLEMENTED_SEQUENCE_HANDLER(memory_unlock) -UNIMPLEMENTED_SEQUENCE_HANDLER(request_locator_position) -UNIMPLEMENTED_SEQUENCE_HANDLER(reset_mouse_cursor_foreground_color) -UNIMPLEMENTED_SEQUENCE_HANDLER(reset_mouse_cursor_background_color) -UNIMPLEMENTED_SEQUENCE_HANDLER(reset_tek_background_color) -UNIMPLEMENTED_SEQUENCE_HANDLER(reset_tek_cursor_color) -UNIMPLEMENTED_SEQUENCE_HANDLER(reset_tek_foreground_color) -UNIMPLEMENTED_SEQUENCE_HANDLER(select_character_protection) -UNIMPLEMENTED_SEQUENCE_HANDLER(select_locator_events) -UNIMPLEMENTED_SEQUENCE_HANDLER(selective_erase_in_display) -UNIMPLEMENTED_SEQUENCE_HANDLER(selective_erase_in_line) -UNIMPLEMENTED_SEQUENCE_HANDLER(send_tertiary_device_attributes) -UNIMPLEMENTED_SEQUENCE_HANDLER(set_conformance_level) -UNIMPLEMENTED_SEQUENCE_HANDLER(set_text_property_21) -UNIMPLEMENTED_SEQUENCE_HANDLER(set_text_property_2L) -UNIMPLEMENTED_SEQUENCE_HANDLER(set_xproperty) -UNIMPLEMENTED_SEQUENCE_HANDLER(seven_bit_controls) -UNIMPLEMENTED_SEQUENCE_HANDLER(single_shift_g2) -UNIMPLEMENTED_SEQUENCE_HANDLER(single_shift_g3) -UNIMPLEMENTED_SEQUENCE_HANDLER(single_width) -UNIMPLEMENTED_SEQUENCE_HANDLER(start_of_guarded_area) -UNIMPLEMENTED_SEQUENCE_HANDLER(start_or_end_of_string) -UNIMPLEMENTED_SEQUENCE_HANDLER(utf_8_character_set) + case VTE_XTERM_WM_SET_WINDOW_SIZE_PIXELS: { + int width, height; + seq.collect(1, {&height, &width}); + + if (width != -1 && height != -1) { + _vte_debug_print(VTE_DEBUG_EMULATION, + "Resizing window to %dx%d pixels, grid size %dx%d.\n", + width, height, + width / int(m_cell_height), height / int(m_cell_width)); + emit_resize_window(width / int(m_cell_height), height / int(m_cell_width)); + } + break; + } -#undef UNIMPLEMENTED_UNIMPLEMENTED_SEQUENCE_HANDLER + case VTE_XTERM_WM_RAISE_WINDOW: + _vte_debug_print(VTE_DEBUG_EMULATION, "Raising window.\n"); + emit_raise_window(); + break; -vte_matcher_entry_t const* -_vte_get_matcher_entries(unsigned int* n_entries) -{ -#include "caps-list.hh" - *n_entries = G_N_ELEMENTS (entries); - return entries; + case VTE_XTERM_WM_LOWER_WINDOW: + _vte_debug_print(VTE_DEBUG_EMULATION, "Lowering window.\n"); + emit_lower_window(); + break; + + case VTE_XTERM_WM_REFRESH_WINDOW: + _vte_debug_print(VTE_DEBUG_EMULATION, "Refreshing window.\n"); + invalidate_all(); + emit_refresh_window(); + break; + + case VTE_XTERM_WM_SET_WINDOW_SIZE_CELLS: { + int width, height; + seq.collect(1, {&height, &width}); + + if (width != -1 && height != -1) { + _vte_debug_print(VTE_DEBUG_EMULATION, + "Resizing window to %d columns, %d rows.\n", + width, height); + emit_resize_window(width, height); + } + break; + } + + case VTE_XTERM_WM_MAXIMIZE_WINDOW: + switch (seq.collect1(1)) { + case -1: /* default */ + case 0: + /* Restore */ + _vte_debug_print(VTE_DEBUG_EMULATION, "Restoring window.\n"); + emit_restore_window(); + break; + case 1: + /* Maximise */ + _vte_debug_print(VTE_DEBUG_EMULATION, "Maximizing window.\n"); + emit_maximize_window(); + break; + case 2: + /* Maximise Vertically */ + break; + case 3: + /* Maximise Horizontally */ + break; + default: + break; + } + break; + + case VTE_XTERM_WM_FULLSCREEN_WINDOW: + break; + + case VTE_XTERM_WM_GET_WINDOW_STATE: + /* If we're unmapped, then we're iconified. */ + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting window state %siconified.\n", + gtk_widget_get_mapped(m_widget) ? "non-" : ""); + + reply(seq, VTE_REPLY_XTERM_WM, + {gtk_widget_get_mapped(m_widget) ? 1 : 2}); + break; + + case VTE_XTERM_WM_GET_WINDOW_POSITION: { + /* Send window location, in pixels. */ + /* FIXME: this is not supported on wayland; just hardwire + * it to a fixed return always. + */ + int x0, y0; + gdk_window_get_origin(gtk_widget_get_window(m_widget), &x0, &y0); + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting window location (%d,%d).\n", x0, y0); + + reply(seq, VTE_REPLY_XTERM_WM, + {3, x0 + m_padding.left, y0 + m_padding.top}); + break; + } + + case VTE_XTERM_WM_GET_WINDOW_SIZE_PIXELS: { + /* Send window size, in pixels. */ + int width = m_row_count * m_cell_height; + int height = m_column_count * m_cell_width; + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting window size (%dx%d)\n", + width, height); + + reply(seq, VTE_REPLY_XTERM_WM, {4, height, width}); + break; + } + + case VTE_XTERM_WM_GET_WINDOW_SIZE_CELLS: + /* Send widget size, in cells. */ + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting widget size %ldx%ld\n", + m_row_count, m_column_count); + + reply(seq, VTE_REPLY_XTERM_WM, + {8, (int)m_row_count, (int)m_column_count}); + break; + + case VTE_XTERM_WM_GET_SCREEN_SIZE_CELLS: { + /* FIMXE: this should really report the monitor's workarea, + * or even just a fixed value. + */ + auto gdkscreen = gtk_widget_get_screen(m_widget); + int height = gdk_screen_get_height(gdkscreen); + int width = gdk_screen_get_width(gdkscreen); + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting screen size as %dx%d cells.\n", + height / int(m_cell_height), width / int(m_cell_width)); + + reply(seq, VTE_REPLY_XTERM_WM, + {9, height / int(m_cell_height), width / int(m_cell_width)}); + break; + } + + case VTE_XTERM_WM_GET_ICON_TITLE: + /* Report a static icon title, since the real + * icon title should NEVER be reported, as it + * creates a security vulnerability. See + * http://marc.info/?l=bugtraq&m=104612710031920&w=2 + * and CVE-2003-0070. + */ + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting empty icon title.\n"); + + send(seq, vte::parser::u8SequenceBuilder{VTE_SEQ_OSC, "L"s}); + break; + + case VTE_XTERM_WM_GET_WINDOW_TITLE: + /* Report a static window title, since the real + * window title should NEVER be reported, as it + * creates a security vulnerability. See + * http://marc.info/?l=bugtraq&m=104612710031920&w=2 + * and CVE-2003-0070. + */ + _vte_debug_print(VTE_DEBUG_EMULATION, + "Reporting empty window title.\n"); + + send(seq, vte::parser::u8SequenceBuilder{VTE_SEQ_OSC, "l"s}); + break; + + case VTE_XTERM_WM_TITLE_STACK_PUSH: + switch (seq.collect1(1)) { + case -1: + case VTE_OSC_XTERM_SET_WINDOW_AND_ICON_TITLE: + case VTE_OSC_XTERM_SET_WINDOW_TITLE: + if (m_window_title_stack.size() >= VTE_WINDOW_TITLE_STACK_MAX_DEPTH) { + /* Drop the bottommost item */ + m_window_title_stack.erase(m_window_title_stack.cbegin()); + } + + if (m_window_title_changed) + m_window_title_stack.emplace(m_window_title_stack.cend(), + m_window_title_pending); + else + m_window_title_stack.emplace(m_window_title_stack.cend(), + m_window_title); + + g_assert_cmpuint(m_window_title_stack.size(), <=, VTE_WINDOW_TITLE_STACK_MAX_DEPTH); + break; + + case VTE_OSC_XTERM_SET_ICON_TITLE: + default: + break; + } + break; + + case VTE_XTERM_WM_TITLE_STACK_POP: + switch (seq.collect1(1)) { + case -1: + case VTE_OSC_XTERM_SET_WINDOW_AND_ICON_TITLE: + case VTE_OSC_XTERM_SET_WINDOW_TITLE: + if (m_window_title_stack.empty()) + break; + + m_window_title_changed = true; + m_window_title_pending.swap(m_window_title_stack.back()); + m_window_title_stack.pop_back(); + break; + + case VTE_OSC_XTERM_SET_ICON_TITLE: + default: + break; + } + break; + + default: + DECSLPP(seq); + break; + } } + +} // namespace terminal +} // namespace vte diff -Nru vte2.91-0.52.2/src/vteseq-list.hh vte2.91-0.54.0/src/vteseq-list.hh --- vte2.91-0.52.2/src/vteseq-list.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vteseq-list.hh 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -SEQUENCE_HANDLER(checksum_rectangular_area) -SEQUENCE_HANDLER(ansi_conformance_level_1) -SEQUENCE_HANDLER(ansi_conformance_level_2) -SEQUENCE_HANDLER(ansi_conformance_level_3) -SEQUENCE_HANDLER(application_keypad) -SEQUENCE_HANDLER(backspace) -SEQUENCE_HANDLER(bell) -SEQUENCE_HANDLER(carriage_return) -SEQUENCE_HANDLER(change_background_color_bel) -SEQUENCE_HANDLER(change_background_color_st) -SEQUENCE_HANDLER(change_bold_color_bel) -SEQUENCE_HANDLER(change_bold_color_st) -SEQUENCE_HANDLER(change_color_bel) -SEQUENCE_HANDLER(change_color_st) -SEQUENCE_HANDLER(change_cursor_background_color_bel) -SEQUENCE_HANDLER(change_cursor_background_color_st) -SEQUENCE_HANDLER(change_font_name) -SEQUENCE_HANDLER(change_font_number) -SEQUENCE_HANDLER(change_foreground_color_bel) -SEQUENCE_HANDLER(change_foreground_color_st) -SEQUENCE_HANDLER(change_highlight_background_color_bel) -SEQUENCE_HANDLER(change_highlight_background_color_st) -SEQUENCE_HANDLER(change_highlight_foreground_color_bel) -SEQUENCE_HANDLER(change_highlight_foreground_color_st) -SEQUENCE_HANDLER(change_logfile) -SEQUENCE_HANDLER(change_mouse_cursor_background_color_bel) -SEQUENCE_HANDLER(change_mouse_cursor_background_color_st) -SEQUENCE_HANDLER(change_mouse_cursor_foreground_color_bel) -SEQUENCE_HANDLER(change_mouse_cursor_foreground_color_st) -SEQUENCE_HANDLER(change_tek_background_color_bel) -SEQUENCE_HANDLER(change_tek_background_color_st) -SEQUENCE_HANDLER(change_tek_cursor_color_bel) -SEQUENCE_HANDLER(change_tek_cursor_color_st) -SEQUENCE_HANDLER(change_tek_foreground_color_bel) -SEQUENCE_HANDLER(change_tek_foreground_color_st) -SEQUENCE_HANDLER(character_attributes) -SEQUENCE_HANDLER(character_position_absolute) -SEQUENCE_HANDLER(cursor_back_tab) -SEQUENCE_HANDLER(cursor_backward) -SEQUENCE_HANDLER(cursor_character_absolute) -SEQUENCE_HANDLER(cursor_down) -SEQUENCE_HANDLER(cursor_forward) -SEQUENCE_HANDLER(cursor_forward_tabulation) -SEQUENCE_HANDLER(cursor_lower_left) -SEQUENCE_HANDLER(cursor_next_line) -SEQUENCE_HANDLER(cursor_position) -SEQUENCE_HANDLER(cursor_position_top_row) -SEQUENCE_HANDLER(cursor_preceding_line) -SEQUENCE_HANDLER(cursor_up) -SEQUENCE_HANDLER(dec_device_status_report) -SEQUENCE_HANDLER(dec_media_copy) -SEQUENCE_HANDLER(decreset) -SEQUENCE_HANDLER(decset) -SEQUENCE_HANDLER(default_character_set) -SEQUENCE_HANDLER(delete_characters) -SEQUENCE_HANDLER(delete_lines) -SEQUENCE_HANDLER(designate_g0_british) -SEQUENCE_HANDLER(designate_g0_line_drawing) -SEQUENCE_HANDLER(designate_g0_plain) -SEQUENCE_HANDLER(designate_g1_british) -SEQUENCE_HANDLER(designate_g1_line_drawing) -SEQUENCE_HANDLER(designate_g1_plain) -SEQUENCE_HANDLER(device_control_string) -SEQUENCE_HANDLER(device_status_report) -SEQUENCE_HANDLER(double_height_bottom_half) -SEQUENCE_HANDLER(double_height_top_half) -SEQUENCE_HANDLER(double_width) -SEQUENCE_HANDLER(eight_bit_controls) -SEQUENCE_HANDLER(enable_filter_rectangle) -SEQUENCE_HANDLER(enable_locator_reporting) -SEQUENCE_HANDLER(end_of_guarded_area) -SEQUENCE_HANDLER(erase_characters) -SEQUENCE_HANDLER(erase_in_display) -SEQUENCE_HANDLER(erase_in_line) -SEQUENCE_HANDLER(form_feed) -SEQUENCE_HANDLER(full_reset) -SEQUENCE_HANDLER(index) -SEQUENCE_HANDLER(initiate_hilite_mouse_tracking) -SEQUENCE_HANDLER(insert_blank_characters) -SEQUENCE_HANDLER(insert_lines) -SEQUENCE_HANDLER(invoke_g1_character_set_as_gr) -SEQUENCE_HANDLER(invoke_g2_character_set) -SEQUENCE_HANDLER(invoke_g2_character_set_as_gr) -SEQUENCE_HANDLER(invoke_g3_character_set) -SEQUENCE_HANDLER(invoke_g3_character_set_as_gr) -SEQUENCE_HANDLER(iterm2_133) -SEQUENCE_HANDLER(iterm2_1337) -SEQUENCE_HANDLER(line_feed) -SEQUENCE_HANDLER(line_position_absolute) -SEQUENCE_HANDLER(linux_console_cursor_attributes) -SEQUENCE_HANDLER(media_copy) -SEQUENCE_HANDLER(memory_lock) -SEQUENCE_HANDLER(memory_unlock) -SEQUENCE_HANDLER(next_line) -SEQUENCE_HANDLER(nop) -SEQUENCE_HANDLER(normal_keypad) -SEQUENCE_HANDLER(repeat) -SEQUENCE_HANDLER(request_locator_position) -SEQUENCE_HANDLER(request_terminal_parameters) -SEQUENCE_HANDLER(reset_background_color) -SEQUENCE_HANDLER(reset_bold_color) -SEQUENCE_HANDLER(reset_color) -SEQUENCE_HANDLER(reset_cursor_background_color) -SEQUENCE_HANDLER(reset_foreground_color) -SEQUENCE_HANDLER(reset_highlight_background_color) -SEQUENCE_HANDLER(reset_highlight_foreground_color) -SEQUENCE_HANDLER(reset_mode) -SEQUENCE_HANDLER(reset_mouse_cursor_background_color) -SEQUENCE_HANDLER(reset_mouse_cursor_foreground_color) -SEQUENCE_HANDLER(reset_tek_background_color) -SEQUENCE_HANDLER(reset_tek_cursor_color) -SEQUENCE_HANDLER(reset_tek_foreground_color) -SEQUENCE_HANDLER(restore_cursor) -SEQUENCE_HANDLER(restore_mode) -SEQUENCE_HANDLER(return_terminal_id) -SEQUENCE_HANDLER(return_terminal_status) -SEQUENCE_HANDLER(reverse_index) -SEQUENCE_HANDLER(save_cursor) -SEQUENCE_HANDLER(save_mode) -SEQUENCE_HANDLER(screen_alignment_test) -SEQUENCE_HANDLER(scroll_down) -SEQUENCE_HANDLER(scroll_up) -SEQUENCE_HANDLER(select_character_protection) -SEQUENCE_HANDLER(select_locator_events) -SEQUENCE_HANDLER(selective_erase_in_display) -SEQUENCE_HANDLER(selective_erase_in_line) -SEQUENCE_HANDLER(send_primary_device_attributes) -SEQUENCE_HANDLER(send_secondary_device_attributes) -SEQUENCE_HANDLER(send_tertiary_device_attributes) -SEQUENCE_HANDLER(set_conformance_level) -SEQUENCE_HANDLER(set_current_directory_uri) -SEQUENCE_HANDLER(set_current_file_uri) -SEQUENCE_HANDLER(set_current_hyperlink) -SEQUENCE_HANDLER(set_cursor_style) -SEQUENCE_HANDLER(set_icon_and_window_title) -SEQUENCE_HANDLER(set_icon_title) -SEQUENCE_HANDLER(set_mode) -SEQUENCE_HANDLER(set_scrolling_region) -SEQUENCE_HANDLER(set_scrolling_region_from_start) -SEQUENCE_HANDLER(set_scrolling_region_to_end) -SEQUENCE_HANDLER(set_text_property_21) -SEQUENCE_HANDLER(set_text_property_2L) -SEQUENCE_HANDLER(set_window_title) -SEQUENCE_HANDLER(set_xproperty) -SEQUENCE_HANDLER(seven_bit_controls) -SEQUENCE_HANDLER(shift_in) -SEQUENCE_HANDLER(shift_out) -SEQUENCE_HANDLER(single_shift_g2) -SEQUENCE_HANDLER(single_shift_g3) -SEQUENCE_HANDLER(single_width) -SEQUENCE_HANDLER(soft_reset) -SEQUENCE_HANDLER(start_of_guarded_area) -SEQUENCE_HANDLER(start_or_end_of_string) -SEQUENCE_HANDLER(tab) -SEQUENCE_HANDLER(tab_clear) -SEQUENCE_HANDLER(tab_set) -SEQUENCE_HANDLER(urxvt_777) -SEQUENCE_HANDLER(utf_8_character_set) -SEQUENCE_HANDLER(vertical_tab) -SEQUENCE_HANDLER(window_manipulation) diff -Nru vte2.91-0.52.2/src/vte.sh vte2.91-0.54.0/src/vte.sh --- vte2.91-0.52.2/src/vte.sh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vte.sh 2018-09-02 13:20:15.000000000 +0000 @@ -46,13 +46,13 @@ } __vte_osc7 () { - printf "\033]7;file://%s%s\007" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")" + printf "\u009D7;file://%s%s\u009C" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")" } __vte_prompt_command() { local pwd='~' [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/} - printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)" + printf "\u009D0;%s@%s:%s\u009C%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)" } case "$TERM" in diff -Nru vte2.91-0.52.2/src/vtetypes.hh vte2.91-0.54.0/src/vtetypes.hh --- vte2.91-0.52.2/src/vtetypes.hh 2018-05-21 19:31:53.000000000 +0000 +++ vte2.91-0.54.0/src/vtetypes.hh 2018-09-02 13:20:15.000000000 +0000 @@ -21,6 +21,9 @@ #include #include +#include +#include + #ifdef VTE_DEBUG #define IFDEF_DEBUG(str) str #else @@ -153,6 +156,8 @@ rgb(PangoColor const& c) { *static_cast(this) = c; } rgb(GdkRGBA const* c); rgb(GdkRGBA const& c) : rgb(&c) { } + rgb(uint16_t r, uint16_t g, uint16_t b) + : PangoColor{r, g, b} { } bool parse(char const* spec); diff -Nru vte2.91-0.52.2/src/widget.cc vte2.91-0.54.0/src/widget.cc --- vte2.91-0.52.2/src/widget.cc 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/widget.cc 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,364 @@ +/* + * Copyright © 2008, 2009, 2010, 2018 Christian Persch + * Copyright © 2001-2004,2009,2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include "widget.hh" + +#include // for W_EXITCODE + +#include +#include + +#include "vtegtk.hh" +#include "debug.h" + +using namespace std::literals; + +namespace vte { + +namespace platform { + +static void +im_commit_cb(GtkIMContext* im_context, + char const* text, + Widget* that) +{ + that->terminal()->im_commit(text); +} + +static void +im_preedit_start_cb(GtkIMContext* im_context, + Widget* that) +{ + _vte_debug_print(VTE_DEBUG_EVENTS, "Input method pre-edit started.\n"); + that->terminal()->im_preedit_set_active(true); +} + +static void +im_preedit_end_cb(GtkIMContext* im_context, + Widget* that) +{ + _vte_debug_print(VTE_DEBUG_EVENTS, "Input method pre-edit ended.\n"); + that->terminal()->im_preedit_set_active(false); +} + +static void +im_preedit_changed_cb(GtkIMContext* im_context, + Widget* that) +{ + that->im_preedit_changed(); +} + +static gboolean +im_retrieve_surrounding_cb(GtkIMContext* im_context, + Widget* that) +{ + _vte_debug_print(VTE_DEBUG_EVENTS, "Input method retrieve-surrounding.\n"); + return that->terminal()->im_retrieve_surrounding(); +} + +static gboolean +im_delete_surrounding_cb(GtkIMContext* im_context, + int offset, + int n_chars, + Widget* that) +{ + _vte_debug_print(VTE_DEBUG_EVENTS, + "Input method delete-surrounding offset %d n-chars %d.\n", + offset, n_chars); + return that->terminal()->im_delete_surrounding(offset, n_chars); +} + +static void +settings_notify_cb(GtkSettings* settings, + GParamSpec* pspec, + vte::platform::Widget* that) +{ + that->settings_changed(); +} + +Widget::Widget(VteTerminal* t) noexcept : + m_widget{&t->widget} +{ + /* Until Terminal init is completely fixed, use zero'd memory */ + auto place = g_malloc0(sizeof(vte::terminal::Terminal)); + m_terminal = new (place) vte::terminal::Terminal(this, t); +} + +Widget::~Widget() noexcept +{ + m_widget = nullptr; + + m_terminal->~Terminal(); + g_free(m_terminal); +} + +void +Widget::beep() noexcept +{ + if (realized()) + gdk_window_beep(gtk_widget_get_window(m_widget)); +} + +GdkCursor* +Widget::create_cursor(GdkCursorType cursor_type) const noexcept +{ + return gdk_cursor_new_for_display(gtk_widget_get_display(m_widget), cursor_type); +} + +void +Widget::dispose() noexcept +{ + if (m_terminal->terminate_child()) { + int status = W_EXITCODE(0, SIGKILL); + emit_child_exited(status); + } +} + +void +Widget::emit_child_exited(int status) noexcept +{ + _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `child-exited'.\n"); + g_signal_emit(object(), signals[SIGNAL_CHILD_EXITED], 0, status); +} + +bool +Widget::im_filter_keypress(GdkEventKey* event) noexcept +{ + // FIXMEchpe this can only be called when realized, so the m_im_context check is redundant + return m_im_context && + gtk_im_context_filter_keypress(m_im_context.get(), event); +} + +void +Widget::im_focus_in() noexcept +{ + gtk_im_context_focus_in(m_im_context.get()); +} + +void +Widget::im_focus_out() noexcept +{ + gtk_im_context_focus_out(m_im_context.get()); +} + +void +Widget::im_preedit_changed() noexcept +{ + char* str; + PangoAttrList* attrs; + int cursorpos; + + gtk_im_context_get_preedit_string(m_im_context.get(), &str, &attrs, &cursorpos); + _vte_debug_print(VTE_DEBUG_EVENTS, "Input method pre-edit changed (%s,%d).\n", + str, cursorpos); + + m_terminal->im_preedit_changed(str, cursorpos, attrs); + g_free(str); +} + +void +Widget::im_set_cursor_location(cairo_rectangle_int_t const* rect) noexcept +{ + gtk_im_context_set_cursor_location(m_im_context.get(), rect); +} + +void +Widget::map() noexcept +{ + if (m_event_window) + gdk_window_show_unraised(m_event_window); +} + +void +Widget::realize() noexcept +{ + // m_mouse_cursor_over_widget = false; /* We'll receive an enter_notify_event if the window appears under the cursor. */ + + /* Create stock cursors */ + m_default_cursor = create_cursor(VTE_DEFAULT_CURSOR); + m_invisible_cursor = create_cursor(GDK_BLANK_CURSOR); + m_mousing_cursor = create_cursor(VTE_MOUSING_CURSOR); + if (_vte_debug_on(VTE_DEBUG_HYPERLINK)) + /* Differ from the standard regex match cursor in debug mode. */ + m_hyperlink_cursor = create_cursor(VTE_HYPERLINK_CURSOR_DEBUG); + else + m_hyperlink_cursor = create_cursor(VTE_HYPERLINK_CURSOR); + + /* Create an input window for the widget. */ + auto allocation = m_terminal->get_allocated_rect(); + GdkWindowAttr attributes; + attributes.window_type = GDK_WINDOW_CHILD; + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; + attributes.wclass = GDK_INPUT_ONLY; + attributes.visual = gtk_widget_get_visual(m_widget); + attributes.event_mask = + gtk_widget_get_events(m_widget) | + GDK_EXPOSURE_MASK | + GDK_FOCUS_CHANGE_MASK | + GDK_SMOOTH_SCROLL_MASK | + GDK_SCROLL_MASK | + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | + GDK_BUTTON1_MOTION_MASK | + GDK_ENTER_NOTIFY_MASK | + GDK_LEAVE_NOTIFY_MASK | + GDK_KEY_PRESS_MASK | + GDK_KEY_RELEASE_MASK; + attributes.cursor = m_default_cursor.get(); + guint attributes_mask = + GDK_WA_X | + GDK_WA_Y | + (attributes.visual ? GDK_WA_VISUAL : 0) | + GDK_WA_CURSOR; + + m_event_window = gdk_window_new(gtk_widget_get_parent_window (m_widget), + &attributes, attributes_mask); + gtk_widget_register_window(m_widget, m_event_window); + + assert(!m_im_context); + m_im_context = gtk_im_multicontext_new(); + gtk_im_context_set_client_window(m_im_context.get(), m_event_window); + g_signal_connect(m_im_context.get(), "commit", + G_CALLBACK(im_commit_cb), this); + g_signal_connect(m_im_context.get(), "preedit-start", + G_CALLBACK(im_preedit_start_cb), this); + g_signal_connect(m_im_context.get(), "preedit-changed", + G_CALLBACK(im_preedit_changed_cb), this); + g_signal_connect(m_im_context.get(), "preedit-end", + G_CALLBACK(im_preedit_end_cb), this); + g_signal_connect(m_im_context.get(), "retrieve-surrounding", + G_CALLBACK(im_retrieve_surrounding_cb), this); + g_signal_connect(m_im_context.get(), "delete-surrounding", + G_CALLBACK(im_delete_surrounding_cb), this); + gtk_im_context_set_use_preedit(m_im_context.get(), true); + + m_terminal->widget_realize(); +} + +void +Widget::screen_changed(GdkScreen *previous_screen) noexcept +{ + auto gdk_screen = gtk_widget_get_screen(m_widget); + if (previous_screen != nullptr && + (gdk_screen != previous_screen || gdk_screen == nullptr)) { + auto settings = gtk_settings_get_for_screen(previous_screen); + g_signal_handlers_disconnect_matched(settings, G_SIGNAL_MATCH_DATA, + 0, 0, nullptr, nullptr, + this); + } + + if (gdk_screen == previous_screen || gdk_screen == nullptr) + return; + + settings_changed(); + + auto settings = gtk_widget_get_settings(m_widget); + g_signal_connect (settings, "notify::gtk-cursor-blink", + G_CALLBACK(settings_notify_cb), this); + g_signal_connect (settings, "notify::gtk-cursor-blink-time", + G_CALLBACK(settings_notify_cb), this); + g_signal_connect (settings, "notify::gtk-cursor-blink-timeout", + G_CALLBACK(settings_notify_cb), this); +} + +void +Widget::settings_changed() noexcept +{ + gboolean blink; + int blink_time; + int blink_timeout; + + g_object_get(gtk_widget_get_settings(m_widget), + "gtk-cursor-blink", &blink, + "gtk-cursor-blink-time", &blink_time, + "gtk-cursor-blink-timeout", &blink_timeout, + nullptr); + + _vte_debug_print(VTE_DEBUG_MISC, + "Cursor blinking settings: blink=%d time=%d timeout=%d\n", + blink, blink_time, blink_timeout); + + m_terminal->set_blink_settings(blink, blink_time, blink_timeout); +} + +void +Widget::set_cursor(Cursor type) noexcept +{ + switch (type) { + case Cursor::eDefault: return set_cursor(m_default_cursor.get()); + case Cursor::eInvisible: return set_cursor(m_invisible_cursor.get()); + case Cursor::eMousing: return set_cursor(m_mousing_cursor.get()); + case Cursor::eHyperlink: return set_cursor(m_hyperlink_cursor.get()); + } +} + +void +Widget::size_allocate(GtkAllocation* allocation) noexcept +{ + m_terminal->widget_size_allocate(allocation); + + if (realized()) + gdk_window_move_resize(m_event_window, + allocation->x, + allocation->y, + allocation->width, + allocation->height); +} + +void +Widget::unmap() +{ + if (m_event_window) + gdk_window_hide(m_event_window); +} + +void +Widget::unrealize() noexcept +{ + m_terminal->widget_unrealize(); + + m_default_cursor.reset(); + m_invisible_cursor.reset(); + m_mousing_cursor.reset(); + m_hyperlink_cursor.reset(); + + /* Shut down input methods. */ + assert(m_im_context); + g_signal_handlers_disconnect_matched(m_im_context.get(), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, + this); + m_terminal->im_preedit_reset(); + gtk_im_context_set_client_window(m_im_context.get(), nullptr); + m_im_context.reset(); + + /* Destroy input window */ + gtk_widget_unregister_window(m_widget, m_event_window); + gdk_window_destroy(m_event_window); + m_event_window = nullptr; +} + +} // namespace platform + +} // namespace vte diff -Nru vte2.91-0.52.2/src/widget.hh vte2.91-0.54.0/src/widget.hh --- vte2.91-0.52.2/src/widget.hh 1970-01-01 00:00:00.000000000 +0000 +++ vte2.91-0.54.0/src/widget.hh 2018-09-02 13:20:15.000000000 +0000 @@ -0,0 +1,168 @@ +/* + * Copyright © 2018 Christian Persch + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +#include "vteterminal.h" +#include "vteinternal.hh" + +#include "refptr.hh" + +namespace vte { + +namespace terminal { +class Terminal; +} + +namespace platform { + +class Widget { +public: + friend class vte::terminal::Terminal; + + Widget(VteTerminal* t) noexcept; + ~Widget() noexcept; + + Widget(Widget const&) = delete; + Widget(Widget&&) = delete; + Widget& operator= (Widget const&) = delete; + Widget& operator= (Widget&&) = delete; + + GObject* object() const noexcept { return reinterpret_cast(m_widget); } + GtkWidget* gtk() const noexcept { return m_widget; } + VteTerminal* vte() const noexcept { return reinterpret_cast(m_widget); } + + vte::terminal::Terminal* terminal() const noexcept { return m_terminal; } + + void constructed() noexcept { m_terminal->widget_constructed(); } + void dispose() noexcept; + void realize() noexcept; + void unrealize() noexcept; + void map() noexcept; + void unmap() noexcept; + void style_updated() noexcept { m_terminal->widget_style_updated(); } + void draw(cairo_t *cr) noexcept { m_terminal->widget_draw(cr); } + void get_preferred_width(int *minimum_width, + int *natural_width) const noexcept { m_terminal->widget_get_preferred_width(minimum_width, natural_width); } + void get_preferred_height(int *minimum_height, + int *natural_height) const noexcept { m_terminal->widget_get_preferred_height(minimum_height, natural_height); } + void size_allocate(GtkAllocation *allocation) noexcept; + + void focus_in(GdkEventFocus *event) noexcept { m_terminal->widget_focus_in(event); } + void focus_out(GdkEventFocus *event) noexcept { m_terminal->widget_focus_out(event); } + bool key_press(GdkEventKey *event) noexcept { return m_terminal->widget_key_press(event); } + bool key_release(GdkEventKey *event) noexcept { return m_terminal->widget_key_release(event); } + bool button_press(GdkEventButton *event) noexcept { return m_terminal->widget_button_press(event); } + bool button_release(GdkEventButton *event) noexcept { return m_terminal->widget_button_release(event); } + void enter(GdkEventCrossing *event) noexcept { m_terminal->widget_enter(event); } + void leave(GdkEventCrossing *event) noexcept { m_terminal->widget_leave(event); } + void scroll(GdkEventScroll *event) noexcept { m_terminal->widget_scroll(event); } + bool motion_notify(GdkEventMotion *event) noexcept { return m_terminal->widget_motion_notify(event); } + + void paste(GdkAtom board) noexcept { m_terminal->widget_paste(board); } + void copy(VteSelection sel, + VteFormat format) noexcept { m_terminal->widget_copy(sel, format); } + void paste_received(char const* text) noexcept { m_terminal->widget_paste_received(text); } + void clipboard_cleared(GtkClipboard *clipboard) noexcept { m_terminal->widget_clipboard_cleared(clipboard); } + void clipboard_requested(GtkClipboard *target_clipboard, + GtkSelectionData *data, + guint info) noexcept { m_terminal->widget_clipboard_requested(target_clipboard, data, info); } + + void screen_changed (GdkScreen *previous_screen) noexcept; + void settings_changed() noexcept; + + void beep() noexcept; + + void set_hadjustment(GtkAdjustment *adjustment) noexcept { m_terminal->widget_set_hadjustment(adjustment); } + GtkAdjustment* get_hadjustment() const noexcept { return m_terminal->m_hadjustment; } + void set_vadjustment(GtkAdjustment *adjustment) noexcept { m_terminal->widget_set_vadjustment(adjustment); } + GtkAdjustment* get_vadjustment() const noexcept { return m_terminal->m_vadjustment; } + + int hscroll_policy() const noexcept { return m_terminal->m_hscroll_policy; } + int vscroll_policy() const noexcept { return m_terminal->m_vscroll_policy; } + + char const* encoding() const noexcept + { + return m_terminal->m_encoding ? m_terminal->m_encoding : "UTF-8"; + } + + void emit_child_exited(int status) noexcept; + +protected: + + enum class Cursor { + eDefault, + eInvisible, + eMousing, + eHyperlink + }; + + GdkWindow* event_window() const noexcept { return m_event_window; } + + bool realized() const noexcept + { + return gtk_widget_get_realized(m_widget); + } + + GdkCursor *create_cursor(GdkCursorType cursor_type) const noexcept; + + void set_cursor(Cursor type) noexcept; + + void set_cursor(GdkCursor* cursor) noexcept + { + gdk_window_set_cursor(m_event_window, cursor); + } + + bool im_filter_keypress(GdkEventKey* event) noexcept; + + void im_focus_in() noexcept; + void im_focus_out() noexcept; + + void im_reset() noexcept + { + if (m_im_context) + gtk_im_context_reset(m_im_context.get()); + } + + void im_set_cursor_location(cairo_rectangle_int_t const* rect) noexcept; + +public: // FIXMEchpe + void im_preedit_changed() noexcept; + +private: + GtkWidget* m_widget; + + vte::terminal::Terminal* m_terminal; + + /* Event window */ + GdkWindow *m_event_window; + + /* Cursors */ + vte::glib::RefPtr m_default_cursor; + vte::glib::RefPtr m_invisible_cursor; + vte::glib::RefPtr m_mousing_cursor; + vte::glib::RefPtr m_hyperlink_cursor; + + /* Input method */ + vte::glib::RefPtr m_im_context; +}; + +} // namespace platform + +} // namespace vte