Hello, would it be possible to allow negative length limit in format specification? For example, #{=10:pane_title} include first 10 characters, while #{=-10:pane_title} would include last 10 characters?
Maybe something like this? (tmux-1.9a) --- format.c.orig 2015-04-10 17:42:31.000000000 +0200 +++ format.c 2015-04-10 18:34:26.000000000 +0200 @@ -197,7 +197,7 @@ char *copy, *copy0, *endptr, *ptr, *saved; const char *value; size_t valuelen; - u_long limit = ULONG_MAX; + long limit = LONG_MAX; /* Make a copy of the key. */ copy0 = copy = xmalloc(keylen + 1); @@ -210,8 +210,8 @@ switch (*copy) { case '=': errno = 0; - limit = strtoul(copy + 1, &endptr, 10); - if (errno == ERANGE && limit == ULONG_MAX) + limit = strtol(copy + 1, &endptr, 10); + if (errno == ERANGE && (limit == LONG_MAX || limit == LONG_MIN)) goto fail; copy = endptr; break; @@ -259,7 +259,11 @@ valuelen = strlen(value); /* Truncate the value if needed. */ - if (valuelen > limit) + if (limit < 0 && valuelen > -limit) { + value += valuelen + limit; + valuelen = -limit; + } + if (limit >= 0 && valuelen > limit) valuelen = limit; /* Expand the buffer and copy in the value. */ -- Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar Brno University of Technology, Faculty of Information Technology Bozetechova 2, 612 66 Brno, Czech Republic ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users