Applied with some tweaks, also applied my change to pad checksums with 0s in previous mail.
Thanks On Sat, Mar 09, 2013 at 06:29:34PM -0600, Chris Johnsen wrote: > When pane ids were added to the custom layout strings, the parsing > was adjusted to be backwards compatible. However, a bug prevents > this code from correctly parsing custom layout strings that describe > a layout with at least one split. > > Here is an example new-style (with pane ids) custom layout string > for a split window (the leading checksum has been omitted): > > 80x40,0,0[80x20,0,0,75,80x19,0,21,76]] > ------------------- > > And the equivalent old-style string (again, without checksum): > > 80x40,0,0[80x20,0,0,80x19,0,21] > ------------------- > > The underlined portions of the strings are parsed correctly. In the > new-style string, the next bit of the string (",75") will be > correctly consumed as a pane id (the value itself is not used). In > the old-style string, the next bit of the string (",80") is also > consumed as a pane id, but this is an error because it is actually > the width of the next pane. The old-style string will ultimately be > rejected because the code is not expecting to see an 'x' immediately > after a pane description has ended (only a comma, brace, bracket, or > the end of the string is expected). > > To decide whether the next number is a pane id or the width of the > next pane, look at the following separator (if any). If it is an > 'x', then there is no pane id; let the parsing resume at the > previous comma. > > --- > > This bug will probably bite anyone using previously extracted custom > layout strings with 1.6 when they upgrade to 1.7. A fix would > probably be appropriate for a 1.7 maintenance release, if there are > any plans for one. > > For testing purposes, here is a old-style three-pane layout (it also > has a "short" checksum): > > 5ff,318x64,0,0{189x64,0,0,128x64,190,0[128x32,190,0,128x31,190,33]} > --- > layout-custom.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/layout-custom.c b/layout-custom.c > index aa70e16..a386434 100644 > --- a/layout-custom.c > +++ b/layout-custom.c > @@ -210,8 +210,7 @@ layout_construct(struct layout_cell *lcparent, const char > **layout) > > if (!isdigit((u_char) **layout)) > return (NULL); > - if (sscanf(*layout, "%ux%u,%u,%u,%*u", &sx, &sy, &xoff, &yoff) != 4 && > - sscanf(*layout, "%ux%u,%u,%u", &sx, &sy, &xoff, &yoff) != 4) > + if (sscanf(*layout, "%ux%u,%u,%u", &sx, &sy, &xoff, &yoff) != 4) > return (NULL); > > while (isdigit((u_char) **layout)) > @@ -232,9 +231,12 @@ layout_construct(struct layout_cell *lcparent, const > char **layout) > while (isdigit((u_char) **layout)) > (*layout)++; > if (**layout == ',') { > + const char *before_pane_id = *layout; > (*layout)++; > while (isdigit((u_char) **layout)) > (*layout)++; > + if (**layout == 'x') > + *layout = before_pane_id; > } > > lc = layout_create_cell(lcparent); > -- > 1.8.1.3 > > > ------------------------------------------------------------------------------ > Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester > Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the > endpoint security space. For insight on selecting the right partner to > tackle endpoint security challenges, access the full report. > http://p.sf.net/sfu/symantec-dev2dev > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users