[vte/vte-0-36] emulation: Support DECCOLM mode to switch between 80 and 132 columns



commit b38428322ee2c99b9ef5da9208533b817fcf94fe
Author: Michele Baldessari <michele acksyn org>
Date:   Mon Nov 18 21:26:45 2013 +0100

    emulation: Support DECCOLM mode to switch between 80 and 132 columns
    
    https://bugzilla.gnome.org/show_bug.cgi?id=4993

 src/vte-private.h |    1 +
 src/vte.c         |    3 +++
 src/vteseq.c      |   40 ++++++++++++++++++++++++----------------
 3 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 561a652..daac9d4 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -270,6 +270,7 @@ struct _VteTerminalPrivate {
        guint bell_margin;
        gboolean allow_bold;
        gboolean nrc_mode;
+        gboolean deccolm_mode; /* DECCOLM allowed */
        GHashTable *tabstops;
        gboolean text_modified_flag;
        gboolean text_inserted_flag;
diff --git a/src/vte.c b/src/vte.c
index 5290032..07b502f 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8629,6 +8629,7 @@ vte_terminal_init(VteTerminal *terminal)
        pvt->bell_margin = 10;
        pvt->allow_bold = TRUE;
        pvt->nrc_mode = TRUE;
+        pvt->deccolm_mode = FALSE;
        vte_terminal_set_default_tabstops(terminal);
 
        /* Cursor shape. */
@@ -14286,6 +14287,8 @@ vte_terminal_reset(VteTerminal *terminal,
        pvt->margin_bell = FALSE;
        /* Enable iso2022/NRC processing. */
        pvt->nrc_mode = TRUE;
+        /* Disable DECCOLM mode. */
+        pvt->deccolm_mode = FALSE;
        /* Reset saved settings. */
        if (pvt->dec_saved != NULL) {
                g_hash_table_destroy(pvt->dec_saved);
diff --git a/src/vteseq.c b/src/vteseq.c
index e6a9788..72f271f 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -650,7 +650,11 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                 NULL, NULL,},
                /* 2: disallowed, we don't do VT52. */
                {2, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
-               /* 3: disallowed, window size is set by user. */
+                /* 3: DECCOLM set/reset to and from 132/80 columns */
+                {3, NULL, NULL, NULL, 
+                 GINT_TO_POINTER(FALSE),
+                 GINT_TO_POINTER(TRUE),
+                 NULL, NULL,},
                {3, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
                /* 5: Reverse video. */
                {5, &terminal->pvt->screen->reverse_mode, NULL, NULL,
@@ -690,8 +694,11 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                /* 35/rxvt: disallowed, fonts set by user. */
                {35, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
                /* 38: enter Tektronix mode. */
-               /* 40: disallowed, the user sizes dynamically. */
-               {40, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+                /* 40: Enable DECCOLM mode. */
+                {40, &terminal->pvt->deccolm_mode, NULL, NULL, 
+                 GINT_TO_POINTER(FALSE),
+                 GINT_TO_POINTER(TRUE),
+                 NULL, NULL,},
                /* 41: more(1) fix. */
                /* 42: Enable NLS replacements. */
                {42, &terminal->pvt->nrc_mode, NULL, NULL,
@@ -886,21 +893,22 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
                                "Entering application cursor mode.\n" :
                                "Leaving application cursor mode.\n");
                break;
-#if 0          /* 3: disallowed, window size is set by user. */
        case 3:
-               vte_terminal_emit_resize_window(terminal,
-                                               (set ? 132 : 80) *
-                                               terminal->char_width +
-                                               terminal->pvt->inner_border.left +
-                                                terminal->pvt->inner_border.right,
-                                               terminal->row_count *
-                                               terminal->char_height +
-                                               terminal->pvt->inner_border.top +
-                                                terminal->pvt->inner_border.bottom);
-               /* Request a resize and redraw. */
-               _vte_invalidate_all(terminal);
+                /* 3: DECCOLM set/reset to 132/80 columns mode */
+                if (terminal->pvt->deccolm_mode) {
+                        vte_terminal_emit_resize_window(terminal,
+                                                        (set ? 132 : 80) *
+                                                        terminal->char_width +
+                                                        terminal->pvt->inner_border.left +
+                                                        terminal->pvt->inner_border.right,
+                                                        terminal->row_count *
+                                                        terminal->char_height +
+                                                        terminal->pvt->inner_border.top +
+                                                        terminal->pvt->inner_border.bottom);
+                        /* Request a resize and redraw. */
+                        _vte_invalidate_all(terminal);
+                }
                break;
-#endif
        case 5:
                /* Repaint everything in reverse mode. */
                _vte_invalidate_all(terminal);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]