The branch, master has been updated
       via  ddf929390e2780f8e53536a7c0b2f974a3ce2721 (commit)
      from  23519fc0b440ccfe13d52ab3e09ea98c792d4fa7 (commit)

- Log -----------------------------------------------------------------
commit ddf929390e2780f8e53536a7c0b2f974a3ce2721
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Accept multiple parameters to SM/RM/DECSET/DECRST, based on a diff from 
Hayaki
    Saito.
---
 input.c |  151 +++++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 99 insertions(+), 52 deletions(-)

diff --git a/input.c b/input.c
index 30d3bb9..259fad1 100644
--- a/input.c
+++ b/input.c
@@ -70,6 +70,10 @@ int  input_input(struct input_ctx *);
 int    input_c0_dispatch(struct input_ctx *);
 int    input_esc_dispatch(struct input_ctx *);
 int    input_csi_dispatch(struct input_ctx *);
+void   input_csi_dispatch_rm(struct input_ctx *);
+void   input_csi_dispatch_rm_private(struct input_ctx *);
+void   input_csi_dispatch_sm(struct input_ctx *);
+void   input_csi_dispatch_sm_private(struct input_ctx *);
 void   input_csi_dispatch_sgr(struct input_ctx *);
 int    input_dcs_dispatch(struct input_ctx *);
 int    input_utf8_open(struct input_ctx *);
@@ -1071,7 +1075,6 @@ int
 input_csi_dispatch(struct input_ctx *ictx)
 {
        struct screen_write_ctx        *sctx = &ictx->ctx;
-       struct window_pane             *wp = ictx->wp;
        struct screen                  *s = sctx->s;
        struct input_table_entry       *entry;
        int                             n, m;
@@ -1230,7 +1233,60 @@ input_csi_dispatch(struct input_ctx *ictx)
                screen_write_cursormove(sctx, ictx->old_cx, ictx->old_cy);
                break;
        case INPUT_CSI_RM:
-               switch (input_get(ictx, 0, 0, -1)) {
+               input_csi_dispatch_rm(ictx);
+               break;
+       case INPUT_CSI_RM_PRIVATE:
+               input_csi_dispatch_rm_private(ictx);
+               break;
+       case INPUT_CSI_SCP:
+               memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
+               ictx->old_cx = s->cx;
+               ictx->old_cy = s->cy;
+               break;
+       case INPUT_CSI_SGR:
+               input_csi_dispatch_sgr(ictx);
+               break;
+       case INPUT_CSI_SM:
+               input_csi_dispatch_sm(ictx);
+               break;
+       case INPUT_CSI_SM_PRIVATE:
+               input_csi_dispatch_sm_private(ictx);
+               break;
+       case INPUT_CSI_TBC:
+               switch (input_get(ictx, 0, 0, 0)) {
+               case 0:
+                       if (s->cx < screen_size_x(s))
+                               bit_clear(s->tabs, s->cx);
+                       break;
+               case 3:
+                       bit_nclear(s->tabs, 0, screen_size_x(s) - 1);
+                       break;
+               default:
+                       log_debug("%s: unknown '%c'", __func__, ictx->ch);
+                       break;
+               }
+               break;
+       case INPUT_CSI_VPA:
+               n = input_get(ictx, 0, 1, 1);
+               screen_write_cursormove(sctx, s->cx, n - 1);
+               break;
+       case INPUT_CSI_DECSCUSR:
+               n = input_get(ictx, 0, 0, 0);
+               screen_set_cursor_style(s, n);
+               break;
+       }
+
+       return (0);
+}
+
+/* Handle CSI RM. */
+void
+input_csi_dispatch_rm(struct input_ctx *ictx)
+{
+       u_int   i;
+
+       for (i = 0; i < ictx->param_list_len; i++) {
+               switch (input_get(ictx, i, 0, -1)) {
                case 4:         /* IRM */
                        screen_write_mode_clear(&ictx->ctx, MODE_INSERT);
                        break;
@@ -1238,10 +1294,18 @@ input_csi_dispatch(struct input_ctx *ictx)
                        log_debug("%s: unknown '%c'", __func__, ictx->ch);
                        break;
                }
-               break;
-       case INPUT_CSI_RM_PRIVATE:
-               switch (input_get(ictx, 0, 0, -1)) {
-               case 1:         /* GATM */
+       }
+}
+
+/* Handle CSI private RM. */
+void
+input_csi_dispatch_rm_private(struct input_ctx *ictx)
+{
+       u_int   i;
+
+       for (i = 0; i < ictx->param_list_len; i++) {
+               switch (input_get(ictx, i, 0, -1)) {
+               case 1:         /* DECCKM */
                        screen_write_mode_clear(&ictx->ctx, MODE_KCURSOR);
                        break;
                case 3:         /* DECCOLM */
@@ -1271,10 +1335,10 @@ input_csi_dispatch(struct input_ctx *ictx)
                        break;
                case 47:
                case 1047:
-                       window_pane_alternate_off(wp, &ictx->cell, 0);
+                       window_pane_alternate_off(ictx->wp, &ictx->cell, 0);
                        break;
                case 1049:
-                       window_pane_alternate_off(wp, &ictx->cell, 1);
+                       window_pane_alternate_off(ictx->wp, &ictx->cell, 1);
                        break;
                case 2004:
                        screen_write_mode_clear(&ictx->ctx, MODE_BRACKETPASTE);
@@ -1283,17 +1347,17 @@ input_csi_dispatch(struct input_ctx *ictx)
                        log_debug("%s: unknown '%c'", __func__, ictx->ch);
                        break;
                }
-               break;
-       case INPUT_CSI_SCP:
-               memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
-               ictx->old_cx = s->cx;
-               ictx->old_cy = s->cy;
-               break;
-       case INPUT_CSI_SGR:
-               input_csi_dispatch_sgr(ictx);
-               break;
-       case INPUT_CSI_SM:
-               switch (input_get(ictx, 0, 0, -1)) {
+       }
+}
+
+/* Handle CSI SM. */
+void
+input_csi_dispatch_sm(struct input_ctx *ictx)
+{
+       u_int   i;
+
+       for (i = 0; i < ictx->param_list_len; i++) {
+               switch (input_get(ictx, i, 0, -1)) {
                case 4:         /* IRM */
                        screen_write_mode_set(&ictx->ctx, MODE_INSERT);
                        break;
@@ -1301,10 +1365,18 @@ input_csi_dispatch(struct input_ctx *ictx)
                        log_debug("%s: unknown '%c'", __func__, ictx->ch);
                        break;
                }
-               break;
-       case INPUT_CSI_SM_PRIVATE:
-               switch (input_get(ictx, 0, 0, -1)) {
-               case 1:         /* GATM */
+       }
+}
+
+/* Handle CSI private SM. */
+void
+input_csi_dispatch_sm_private(struct input_ctx *ictx)
+{
+       u_int   i;
+
+       for (i = 0; i < ictx->param_list_len; i++) {
+               switch (input_get(ictx, i, 0, -1)) {
+               case 1:         /* DECCKM */
                        screen_write_mode_set(&ictx->ctx, MODE_KCURSOR);
                        break;
                case 3:         /* DECCOLM */
@@ -1330,10 +1402,10 @@ input_csi_dispatch(struct input_ctx *ictx)
                        screen_write_mode_set(&ictx->ctx, MODE_MOUSE_ANY);
                        break;
                case 1004:
-                       if (s->mode & MODE_FOCUSON)
+                       if (ictx->ctx.s->mode & MODE_FOCUSON)
                                break;
                        screen_write_mode_set(&ictx->ctx, MODE_FOCUSON);
-                       wp->flags |= PANE_FOCUSPUSH; /* force update */
+                       ictx->wp->flags |= PANE_FOCUSPUSH; /* force update */
                        break;
                case 1005:
                        screen_write_mode_set(&ictx->ctx, MODE_MOUSE_UTF8);
@@ -1343,10 +1415,10 @@ input_csi_dispatch(struct input_ctx *ictx)
                        break;
                case 47:
                case 1047:
-                       window_pane_alternate_on(wp, &ictx->cell, 0);
+                       window_pane_alternate_on(ictx->wp, &ictx->cell, 0);
                        break;
                case 1049:
-                       window_pane_alternate_on(wp, &ictx->cell, 1);
+                       window_pane_alternate_on(ictx->wp, &ictx->cell, 1);
                        break;
                case 2004:
                        screen_write_mode_set(&ictx->ctx, MODE_BRACKETPASTE);
@@ -1355,32 +1427,7 @@ input_csi_dispatch(struct input_ctx *ictx)
                        log_debug("%s: unknown '%c'", __func__, ictx->ch);
                        break;
                }
-               break;
-       case INPUT_CSI_TBC:
-               switch (input_get(ictx, 0, 0, 0)) {
-               case 0:
-                       if (s->cx < screen_size_x(s))
-                               bit_clear(s->tabs, s->cx);
-                       break;
-               case 3:
-                       bit_nclear(s->tabs, 0, screen_size_x(s) - 1);
-                       break;
-               default:
-                       log_debug("%s: unknown '%c'", __func__, ictx->ch);
-                       break;
-               }
-               break;
-       case INPUT_CSI_VPA:
-               n = input_get(ictx, 0, 1, 1);
-               screen_write_cursormove(sctx, s->cx, n - 1);
-               break;
-       case INPUT_CSI_DECSCUSR:
-               n = input_get(ictx, 0, 0, 0);
-               screen_set_cursor_style(s, n);
-               break;
        }
-
-       return (0);
 }
 
 /* Handle CSI SGR. */


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

Summary of changes:
 input.c |  151 +++++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 99 insertions(+), 52 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to