Hmm, this was just something else I noticed missing when I found the lack of c and C. I had already failed to make do with what tmux had in the case of c/C so I didn't maybe try as hard as I could have with J.
I had focused on joining at copy time since it's what I was used to coming from screen and due to my plans for binding a lot of clipboards (it's complicated) I can't afford to bind multiple pastes with different separators for each logical clipboard. However, the more I think about it I can probably cook up something far better between loadb, run, and saveb. Keith Thus spake Nicholas Marriott, at Wed, May 14, 2014 at 07:29:19AM +0100: > Date: Wed, 14 May 2014 07:29:19 +0100 > From: Nicholas Marriott <nicholas.marri...@gmail.com> > To: Keith Amling <aml...@palantir.com> > CC: tmux-users@lists.sourceforge.net > Subject: Re: [PATCH 3/3] Copy mode command change-joinmode to match > screen's J. > > Hi > > You can already join the lines on paste with the -s flag to > paste-buffer. > > I wouldn't do this at all but if there is a good case for it, I would > just prefer a copy-with-separator command which prompted for the > separator (like the prompt we just added for buffer name). > > > > On Tue, May 13, 2014 at 09:27:58PM -0700, Keith Amling wrote: > > This patch is less clear than the preceding two. > > > > First, should this be bound to anything by default? 'J' is already > > taken in vi-copy. > > > > Second, the current way of surfacing the current join mode is the best > > thing I could think of but it's sort of ugly and space-wasting. Screen > > just shows a temporary message naming the new join mode when you switch > > to one but I didn't see any obvious facility for a temporary message > > like that here. > > > > Finally, ignore or remove the "0+"s in there. My company's e-mail > > server barfs on this patch without them for completely insane reasons > > that I'm about to fix with both hands. > > > > Keith > > > > --- > > mode-key.c | 1 + > > tmux.h | 1 + > > window-copy.c | 57 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++----- > > 3 files changed, 54 insertions(+), 5 deletions(-) > > > > diff --git a/mode-key.c b/mode-key.c > > index eb97d3f8a385..0c9c86be265c 100644 > > --- a/mode-key.c > > +++ b/mode-key.c > > @@ -148,6 +148,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { > > { MODEKEYCOPY_UP, "cursor-up" }, > > { MODEKEYCOPY_LEFTPRUNE, "left-prune" }, > > { MODEKEYCOPY_RIGHTPRUNE, "right-prune" }, > > + { MODEKEYCOPY_CHANGEJOINMODE, "change-joinmode" }, > > > > { 0, NULL } > > }; > > diff --git a/tmux.h b/tmux.h > > index aa01b17ee0e3..0c491a413d23 100644 > > --- a/tmux.h > > +++ b/tmux.h > > @@ -586,6 +586,7 @@ enum mode_key_cmd { > > MODEKEYCOPY_UP, > > MODEKEYCOPY_LEFTPRUNE, > > MODEKEYCOPY_RIGHTPRUNE, > > + MODEKEYCOPY_CHANGEJOINMODE, > > }; > > > > /* Entry in the default mode key tables. */ > > diff --git a/window-copy.c b/window-copy.c > > index 6d2edda8c567..1803762dc899 100644 > > --- a/window-copy.c > > +++ b/window-copy.c > > @@ -84,6 +84,7 @@ void window_copy_scroll_down(struct window_pane *, > > u_int); > > void window_copy_rectangle_toggle(struct window_pane *); > > void window_copy_left_prune(struct window_pane *); > > void window_copy_right_prune(struct window_pane *); > > +void window_copy_change_joinmode(struct window_pane *); > > > > const struct window_mode window_copy_mode = { > > window_copy_init, > > @@ -106,6 +107,36 @@ enum window_copy_input_type { > > WINDOW_COPY_GOTOLINE, > > }; > > > > +enum window_copy_join_mode { > > + WINDOW_COPY_JOIN_NEWLINE, > > + WINDOW_COPY_JOIN_NONE, > > + WINDOW_COPY_JOIN_SPACE, > > + WINDOW_COPY_JOIN_COMMA, > > + WINDOW_COPY_JOIN_MAX > > +}; > > + > > +struct window_copy_join_mode_data { > > + const char *header; > > + const char *delimiter; > > +} join_modes[WINDOW_COPY_JOIN_MAX] = { > > + { > > + "", > > + "\n", > > + }, > > + { > > + " [joined]", > > + "", > > + }, > > + { > > + " [joined with spaces]", > > + " ", > > + }, > > + { > > + " [joined with commas]", > > + ",", > > + }, > > +}; > > + > > /* > > * Copy-mode's visible screen (the "screen" field) is filled from one of > > * two sources: the original contents of the pane (used when we > > @@ -148,6 +179,8 @@ struct window_copy_mode_data { > > int rightprunex_set; > > u_int rightprunex; > > > > + enum window_copy_join_mode joinmode; > > + > > enum window_copy_input_type inputtype; > > const char *inputprompt; > > char *inputstr; > > @@ -179,6 +212,8 @@ window_copy_init(struct window_pane *wp) > > data->leftprunex_set = 0; > > data->rightprunex_set = 0; > > > > + data->joinmode = WINDOW_COPY_JOIN_NEWLINE; > > + > > data->backing_written = 0; > > > > data->rectflag = 0; > > @@ -739,6 +774,8 @@ window_copy_key(struct window_pane *wp, struct session > > *sess, int key) > > case MODEKEYCOPY_RIGHTPRUNE: > > window_copy_right_prune(wp); > > break; > > + case MODEKEYCOPY_CHANGEJOINMODE: > > + window_copy_change_joinmode(wp); > > default: > > break; > > } > > @@ -1203,7 +1240,8 @@ window_copy_write_line( > > last = screen_size_y(s) - 1; > > if (py == 0) { > > size = xsnprintf(hdr, sizeof hdr, > > - "[%u/%u]", data->oy, screen_hsize(data->backing)); > > + "[%u/%u]%s", data->oy, screen_hsize(data->backing), > > + join_modes[0+data->joinmode].header); > > if (size > screen_size_x(s)) > > size = screen_size_x(s); > > screen_write_cursormove(ctx, screen_size_x(s) - size, 0); > > @@ -1475,7 +1513,7 @@ window_copy_get_selection(struct window_pane *wp, > > size_t *len) > > free(buf); > > return (NULL); > > } > > - *len = off - 1; /* remove final \n */ > > + *len = off - strlen(join_modes[0+data->joinmode].delimiter); /* remove > > final delimiter */ > > return (buf); > > } > > > > @@ -1615,10 +1653,11 @@ window_copy_copy_line(struct window_pane *wp, > > } > > } > > > > - /* Only add a newline if the line wasn't wrapped. */ > > + /* Only add a delimiter if the line wasn't wrapped. */ > > if (!wrapped || ex != xx) { > > - *buf = xrealloc(*buf, 1, (*off) + 1); > > - (*buf)[(*off)++] = '\n'; > > + *buf = xrealloc(*buf, 1, (*off) + > > strlen(join_modes[0+data->joinmode].delimiter)); > > + memcpy(*buf + *off, join_modes[0+data->joinmode].delimiter, > > strlen(join_modes[0+data->joinmode].delimiter)); > > + *off += strlen(join_modes[0+data->joinmode].delimiter); > > } > > } > > > > @@ -2250,3 +2289,11 @@ window_copy_right_prune(struct window_pane *wp) > > window_copy_redraw_screen(wp); > > } > > } > > + > > +void > > +window_copy_change_joinmode(struct window_pane *wp) > > +{ > > + struct window_copy_mode_data *data = wp->modedata; > > + data->joinmode = (data->joinmode + 1) % WINDOW_COPY_JOIN_MAX; > > + window_copy_redraw_screen(wp); > > +} > > -- > > 1.9.1 > > > > > > ------------------------------------------------------------------------------ > > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE > > Instantly run your Selenium tests across 300+ browser/OS combos. > > Get unparalleled scalability from the best Selenium testing platform > > available > > Simple to use. Nothing to install. Get started now for free." > > https://urldefense.proofpoint.com/v1/url?u=http://p.sf.net/sfu/SauceLabs&k=fDZpZZQMmYwf27OU23GmAQ%3D%3D%0A&r=BTdtcPIZXD8V7r6BhVE1Cy1S1ITG2lF8LZPYHbBpv%2B0%3D%0A&m=97YNZQZCqmcnAcK%2BSGB11PZf4njhxJZ1x%2BlEw9siaCc%3D%0A&s=def3cdda42e3414ae937269e0d53a40ec470a7080c5425bc95ad412d6035e01c > > _______________________________________________ > > tmux-users mailing list > > tmux-users@lists.sourceforge.net > > https://urldefense.proofpoint.com/v1/url?u=https://lists.sourceforge.net/lists/listinfo/tmux-users&k=fDZpZZQMmYwf27OU23GmAQ%3D%3D%0A&r=BTdtcPIZXD8V7r6BhVE1Cy1S1ITG2lF8LZPYHbBpv%2B0%3D%0A&m=97YNZQZCqmcnAcK%2BSGB11PZf4njhxJZ1x%2BlEw9siaCc%3D%0A&s=2d59b2ab723659e5cb1c07eb63fabce40880697ca7f8f6fe45c03251add74124 ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users