Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-08-09 Thread Thomas Adam
Hi, Yes, this looks perfectly fine to me, Nicholas. The only thing I've noticed (and I'm not sure how much it matters---hence why I've not fixed it) is the following doesn't expand: % tmux display -pF '#{?session_attached, #{]#{session_name},(no session)}' Produces: {?session_attached, Becaus

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-08-03 Thread Nicholas Marriott
Here's it updated to fix some warnings, to apply to top of latest git and also with the changes to add automatic-rename-format which you might like to look at. diff --git a/format.c b/format.c index ee3339d..da939f0 100644 --- a/format.c +++ b/format.c @@ -34,9 +34,10 @@ * string. */ -int

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-08-02 Thread Nicholas Marriott
How about this? diff --git a/format.c b/format.c index 0845df6..9a3ed07 100644 --- a/format.c +++ b/format.c @@ -191,7 +191,7 @@ int format_replace(struct format_tree *ft, const char *key, size_t keylen, char **buf, size_t *len, size_t *off) { - char*copy, *ptr; + c

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-05-15 Thread Nicholas Marriott
This still doesn't seem right. If I have "#{?foo,bar,#{baz}} #{zoink}". Then in format_expand it'll decide the first { is: "?foo,bar,#{baz}} #{zoink". Then if foo is true I'll get bar (which is fine) But if it's false I'll get "#{baz}} #{zoink" which is wrong. You need to replace the strchr wi

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-28 Thread Thomas Adam
Hi, On Thu, Apr 25, 2013 at 10:55:56PM +0100, Nicholas Marriott wrote: > Ok. I think you have the right idea about recursing through > format_expand you are just going to need to pull out the affected format > differently (ditch strchr and use a custom loop which counts {s and }s). Yeah, that's o

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Patrick Shanahan
* Jason Timrod [04-26-13 18:10]: [...] > So i think getting rid of that problem is simple - and i am the only one > pushing my opinion. And the only thing you are pushing besides people's buttons is your *opinion*. Since your opinion is worth very little, or less, where is your *better* versi

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Jason Timrod
I don't need to be far away to voice myself. I do not understand why no one else agrees with me or voices their concerns. Cowards. You clearly share my opinion as well. Jason -- Try New Relic Now & We'll Send You this

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Marcel Partap
Dear Jason, you are still not far enough away from the keyboard. On 27/04/13 00:08, Jason Timrod wrote: > I am voicing [...] shit, [...] and it's not good enough. -- Try New Relic Now & We'll Send You this Cool Shirt New

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Jason Timrod
son Timrod Cc: Nicholas Marriott ; tmux-users ; Thomas Adam Sent: Friday, April 26, 2013 10:39 PM Subject: Re: [PATCH 1/1] Allow conditional formats to expand formats [...] > Thomas, you're [...] Ok you crossed a thick red line right there. Would you bloody please stop insulting AN

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Marcel Partap
[...] > Thomas, you're [...] Ok you crossed a thick red line right there. Would you bloody please stop insulting ANYONE on ANY public opinion forum EVER AGAIN? Please take some time far off a keyboard and reflect your demeanour. How you dare spewing rants of disrespect at people whose hard labour

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-26 Thread Nicholas Marriott
gt;Jason > >-- > >From: Nicholas Marriott >To: Thomas >Cc: tmux-users@lists.sourceforge.net >Sent: Thursday, April 25, 2013 10:55 PM >Subject: Re: [PATCH 1/1] Allow conditional formats to expand formats >Ok

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Jason Timrod
Hi I tried using this patch and the code is horrible. Can we not use this? This blows goats Jason From: Nicholas Marriott To: Thomas Cc: tmux-users@lists.sourceforge.net Sent: Thursday, April 25, 2013 10:55 PM Subject: Re: [PATCH 1/1] Allow conditional

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Nicholas Marriott
Ok. I think you have the right idea about recursing through format_expand you are just going to need to pull out the affected format differently (ditch strchr and use a custom loop which counts {s and }s). On Thu, Apr 25, 2013 at 10:25:09PM +0100, Nicholas Marriott wrote: > Hi > > > @@ -232,7 +

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Thomas Adam
On 25 April 2013 22:25, Nicholas Marriott wrote: > Hi > >> @@ -232,7 +235,7 @@ format_expand(struct format_tree *ft, const char *fmt) >> ch = (u_char) *fmt++; >> switch (ch) { >> case '{': >> - ptr = strchr(fmt, '}'); >> +

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Nicholas Marriott
Hi > @@ -232,7 +235,7 @@ format_expand(struct format_tree *ft, const char *fmt) > ch = (u_char) *fmt++; > switch (ch) { > case '{': > - ptr = strchr(fmt, '}'); > + ptr = strrchr(fmt, '}'); How does this not break mu

Re: [PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Romain Francoise
Thomas writes: > @@ -182,6 +182,9 @@ format_replace(struct format_tree *ft, > goto fail; > value = ptr + 1; > } > + > + if ((value_found = format_expand(ft, value)) != NULL) > + value = value_found;

[PATCH 1/1] Allow conditional formats to expand formats

2013-04-25 Thread Thomas
From: Thomas Adam Currently, a conditional format only returns the string given based on whether the condition is true or false. This means the following does not work: #{?session_attached,#{session_name},no session} This change expands the item returned from the conditional if it's a recog