On Thu, Feb 18, 2010 at 01:39:15PM -0800, Micah Cowan wrote:
> clemens fischer wrote:
> > Hi,
> > 
> > I am very glad that tmux has rectangular copies now!  But a problem as
> > well:  in the following, try to cut out the block
> > 
> >   >bbb  <   from   >aaa bbb
> >   >yyyyy<          >xxx yyyyy
> >   >22   <          >111 22
> > 
> > At least in vi-copy mode on linux, the shortest line determines the
> > right border of the block.
> > 
> > The other problem:  for my purposes, I used to rely on screens ability
> > to 'J'oin the lines of any selection by either spaces, commas, newlines
> > (the default) or whatnot, ie. to make one long line of the selected
> > lines.  For example, in a "ls -l" listing, I could select a few files on
> > the right hand side, 'J'oin them with commas and - in bash - type eg.
> > "cp <dir>/{<THE_SELECTION>} .".  Not worry about the proper glob, that
> > is.
> > 
> > If this is not too difficult and you can point me to the files involved,
> > I'd like to give it a try.  If not, I'd have to call on the masters to
> > hand down the solution to this problem from heaven ...
> 
> For the first solution, the file you want to look at is window-copy.c.
> It's not that the shortest line determines the right border, it's that
> tmux doesn't allow you to move the cursor beyond the end of the line
> you're currently on. If you started the selection from the bottom line,
> and ended it on the top, you'd be able to get your cursor one more over
> to the right.
> 
> Have a look at window_copy_cursor_right. The comparison of data->cx
> against px is where it decides whether it's gone beyond the end, and
> should thus wrap to the next line. Perhaps you could change how px is
> set, so that it keeps its current setting when its not doing a rectangle
> selection, but sets px to the total screen-grid's width when it is.

Yeah, it should allow you to move the cursor anywhere in rectangle copy mode,
although of course EOL keys etc should work as before.

> 
> Whether the selection is set should be indicated by
> data->screen.sel.flag, and whether rectangle is on should be in
> data->rectflag. The screen's width is screen_size_x(data->screen).
> 
> 
> For the second; I was discussing this recently with Robin Lee Powell,
> and I think a more general approach would be to make the selection, save
> it out to a file, process the file, and load it back in. Then you'd have
> the flexibility to do much more than screen currently allows (say, add
> quotes around each line before joining with commas).
> 
> The following should bind <prefix> J to join the current (already
> finished) selection with spaces:
> 
> bind-key J run-shell 'tmux save-buffer /tmp/.tmux-exchange; tr \n " " <
> /tmp/.tmux-exchange >/tmp/.tmux-exchange-processed; tmux load-buffer
> /tmp/.tmux-exchange-processed'
> 
> -- 
> Micah J. Cowan
> http://micah.cowan.name/
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to