Hi Sorry I didn't really give you many clear clues here - we actually need to make it pass some code through so the final write is done with the charset bit set. How about something like the diff below?
Although I am a little inclined to instead add #[acs] #[noacs] and make it use screen_write_cnputs so people can use #[format] stuff which might be nice for choose-list. Wouldn't be so nice if you have a window called #[foo] though... so maybe not. Index: cmd-choose-tree.c =================================================================== RCS file: /cvs/src/usr.bin/tmux/cmd-choose-tree.c,v retrieving revision 1.10 diff -u -p -r1.10 cmd-choose-tree.c --- cmd-choose-tree.c 3 Sep 2012 12:24:25 -0000 1.10 +++ cmd-choose-tree.c 5 Sep 2012 19:23:00 -0000 @@ -149,8 +149,10 @@ cmd_choose_tree_exec(struct cmd *self, s * without any padding. */ if (wflag && sflag) { - xasprintf(&final_win_template_middle, " |-> %s", win_template); - xasprintf(&final_win_template_last, " \\-> %s", win_template); + xasprintf(&final_win_template_middle, + " \001tq\001> %s", win_template); + xasprintf(&final_win_template_last, + " \001mq\001> %s", win_template); } else if (wflag) { final_win_template_middle = xstrdup(win_template); final_win_template_last = xstrdup(win_template); Index: screen-write.c =================================================================== RCS file: /cvs/src/usr.bin/tmux/screen-write.c,v retrieving revision 1.56 diff -u -p -r1.56 screen-write.c --- screen-write.c 10 Jul 2012 11:53:01 -0000 1.56 +++ screen-write.c 5 Sep 2012 19:23:01 -0000 @@ -210,8 +210,12 @@ screen_write_vnputs(struct screen_write_ if (maxlen > 0 && size + 1 > (size_t) maxlen) break; - size++; - screen_write_putc(ctx, gc, *ptr); + if (*ptr == '\001') + gc->attr ^= GRID_ATTR_CHARSET; + else { + size++; + screen_write_putc(ctx, gc, *ptr); + } ptr++; } } On Wed, Sep 05, 2012 at 09:09:53PM +0200, Romain Francoise wrote: > Nicholas Marriott <nicholas.marri...@gmail.com> writes: > > > Don't think I want to use UTF-8 arrows unless the ACS arrows will work > > too. > > Ok. Conceptually we just have to use smacs/rmacs around the codes when > writing to the terminal and it should work, right? I tried the naive > approach below and the escape sequences are not interpreted, just output > in the string. I guess the screen layer prevents writing directly to the > terminal from the window-choose code? Or is the terminal in the wrong mode > to do that? > > Do you see any way to make this work at all? > > Thanks. > > > diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c > index dd6dd3b..2b5fe06 100644 > --- a/cmd-choose-tree.c > +++ b/cmd-choose-tree.c > @@ -74,6 +74,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) > struct args *args = self->args; > struct winlink *wl, *wm; > struct session *s, *s2; > + struct tty *tty; > struct window_choose_data *wcd = NULL; > const char *ses_template, *win_template; > char *final_win_action, *cur_win_template; > @@ -92,6 +93,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) > } > > s = ctx->curclient->session; > + tty = &ctx->curclient->tty; > > if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) > return (CMD_RETURN_ERROR); > @@ -149,8 +151,30 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx > *ctx) > * without any padding. > */ > if (wflag && sflag) { > - xasprintf(&final_win_template_middle, " |-> %s", win_template); > - xasprintf(&final_win_template_last, " \\-> %s", win_template); > + if (tty_use_acs(tty)) { > + xasprintf(&final_win_template_middle, " %s%s%s%s> %s", > + tty_term_string(tty->term, TTYC_SMACS), > + tty_acs_get(tty, 't'), tty_acs_get(tty, 'q'), > + tty_term_string(tty->term, TTYC_RMACS), > + win_template); > + xasprintf(&final_win_template_last, " %s%s%s%s> %s", > + tty_term_string(tty->term, TTYC_SMACS), > + tty_acs_get(tty, 'm'), tty_acs_get(tty, 'q'), > + tty_term_string(tty->term, TTYC_RMACS), > + win_template); > + } else if (tty->flags & TTY_UTF8) { > + xasprintf(&final_win_template_middle, " %s%s> %s", > + tty_acs_get(tty, 't'), tty_acs_get(tty, 'q'), > + win_template); > + xasprintf(&final_win_template_last, " %s%s> %s", > + tty_acs_get(tty, 'm'), tty_acs_get(tty, 'q'), > + win_template); > + } else { > + xasprintf(&final_win_template_middle, " |-> %s", > + win_template); > + xasprintf(&final_win_template_last, " \\-> %s", > + win_template); > + } > } else if (wflag) { > final_win_template_middle = xstrdup(win_template); > final_win_template_last = xstrdup(win_template); > diff --git a/tmux.h b/tmux.h > index 9374012..dae2a83 100644 > --- a/tmux.h > +++ b/tmux.h > @@ -423,6 +423,9 @@ struct tty_term_code_entry { > const char *name; > }; > > +#define tty_use_acs(tty) \ > + (tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8)) > + > /* Message codes. */ > enum msgtype { > MSG_COMMAND, > diff --git a/tty.c b/tty.c > index fdc0551..6582da1 100644 > --- a/tty.c > +++ b/tty.c > @@ -51,9 +51,6 @@ void tty_repeat_space(struct tty *, u_int); > void tty_cell(struct tty *, > const struct grid_cell *, const struct grid_utf8 *); > > -#define tty_use_acs(tty) \ > - (tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8)) > - > #define tty_pane_full_width(tty, ctx) \ > ((ctx)->xoff == 0 && screen_size_x((ctx)->wp->screen) >= (tty)->sx) > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users