Discussion:
379400c broke status-right #(interpolation)
Suraj N. Kurapati
2015-05-29 22:56:45 UTC
Permalink
Hello,

I build tmux from git under Xubuntu 15.04. Starting with commit
379400c, the #(interpolation) no longer works in status-right:

set-option -g status-right '#{=26:pane_title} #[fg=colour208,bg=colour236] #S:#I.#P #(test -n "$SSH_TTY" && echo "\#[bold,reverse] #H ")'
set-option -g status-right-length 48

Before upgrading to this commit, I would not see anything at the end
of status-right when running tmux locally. But now, I always see:

<'test -n "$S"'

Is this expected? If so, what is the new #(interpolation) syntax?

Thanks for your consideration.

------------------------------------------------------------------------------
Nicholas Marriott
2015-05-29 23:25:07 UTC
Permalink
Hi

This commit changed status stuff to go directly to formats rather than
having an intermediate step (we have been working towards this for a
while in small increments).

Part of that change was to not include the output if the job failed,
instead to print the return value (the "<test" bit you are seeing is the
start of '<test ... exited with 1>' probably). I think that was the
wrong decision, so I'm going to change that bit back.

Also I just noticed with your example that #H was not being expanded
anymore inside #(). I've fixed that now also.

You will need to change \# into ## probably.

You can wait for SF to sync, or use the diff below.

Thanks



Index: format.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/format.c,v
retrieving revision 1.68
diff -u -p -r1.68 format.c
--- format.c 27 May 2015 13:28:04 -0000 1.68
+++ format.c 29 May 2015 23:22:35 -0000
@@ -175,17 +175,6 @@ format_job_callback(struct job *job)
fj->job = NULL;
free(fj->out);

- if (WIFEXITED(job->status) && WEXITSTATUS(job->status) != 0) {
- xasprintf(&fj->out, "<'%s' exited with %d>", fj->cmd,
- WEXITSTATUS(job->status));
- return;
- }
- if (WIFSIGNALED(job->status)) {
- xasprintf(&fj->out, "<'%s' got signal %d>", fj->cmd,
- WTERMSIG(job->status));
- return;
- }
-
buf = NULL;
if ((line = evbuffer_readline(job->event->input)) == NULL) {
len = EVBUFFER_LENGTH(job->event->input);
@@ -490,7 +479,7 @@ format_expand_time(struct format_tree *f
char *
format_expand(struct format_tree *ft, const char *fmt)
{
- char *buf, *tmp;
+ char *buf, *tmp, *cmd;
const char *ptr, *s;
size_t off, len, n, slen;
int ch, brackets;
@@ -530,9 +519,13 @@ format_expand(struct format_tree *ft, co
tmp = xmalloc(n + 1);
memcpy(tmp, fmt, n);
tmp[n] = '\0';
+ cmd = format_expand(ft, tmp);

- s = format_job_get(ft, tmp);
+ s = format_job_get(ft, cmd);
slen = strlen(s);
+
+ free(cmd);
+ free(tmp);

while (len - off < slen + 1) {
buf = xreallocarray(buf, 2, len);
Post by Suraj N. Kurapati
Hello,
I build tmux from git under Xubuntu 15.04. Starting with commit
set-option -g status-right '#{=26:pane_title} #[fg=colour208,bg=colour236] #S:#I.#P #(test -n "$SSH_TTY" && echo "\#[bold,reverse] #H ")'
set-option -g status-right-length 48
Before upgrading to this commit, I would not see anything at the end
<'test -n "$S"'
Is this expected? If so, what is the new #(interpolation) syntax?
Thanks for your consideration.
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Loading...