This is a trivial patch that paves the way for control mode to change
the tty size without code duplication.

Index: tmux.h
===================================================================
--- tmux.h      (revision 2697)
+++ tmux.h      (working copy)
@@ -1454,6 +1454,7 @@
 void   tty_pututf8(struct tty *, const struct grid_utf8 *);
 void   tty_init(struct tty *, int, char *);
 int    tty_resize(struct tty *);
+int    tty_set_size(struct tty *tty, u_int sx, u_int sy);
 void   tty_start_tty(struct tty *);
 void   tty_stop_tty(struct tty *);
 void   tty_set_title(struct tty *, const char *);
Index: tty.c
===================================================================
--- tty.c       (revision 2697)
+++ tty.c       (working copy)
@@ -93,10 +93,8 @@
                sx = 80;
                sy = 24;
        }
-       if (sx == tty->sx && sy == tty->sy)
+       if (!tty_set_size(tty, sx, sy))
                return (0);
-       tty->sx = sx;
-       tty->sy = sy;

        tty->cx = UINT_MAX;
        tty->cy = UINT_MAX;
@@ -117,6 +115,15 @@
 }

 int
+tty_set_size(struct tty *tty, u_int sx, u_int sy) {
+       if (sx == tty->sx && sy == tty->sy)
+               return (0);
+       tty->sx = sx;
+       tty->sy = sy;
+       return (1);
+}
+
+int
 tty_open(struct tty *tty, const char *overrides, char **cause)
 {
        char    out[64];

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to