[vitunes] Re: [PATCH] add visual mode to vitunes

  • From: Ryan Flannery <ryan.flannery@xxxxxxxxx>
  • To: vitunes@xxxxxxxxxxxxx
  • Date: Thu, 10 Feb 2011 19:40:34 -0500

Hi Daniel!

On Thu, Feb 10, 2011 at 7:18 PM, Daniel Walter <sahne> wrote:
> Hi all,
>
> I've hacked a visual mode patch for vitunes, which allows you to vim like 
> select files within a playlist and
> copy or delete/cut them.

Sweeeeet!  I've been wanting something like this for a while!

> It basically works like visual mode in vim, so you enable it via 'V' and use 
> either 'UP'/'DOWN' or 'j'/'k' to
> select the files you like to copy or delete.
>
> In this first version the is no support for jumping to the beginning or end 
> of a list, but I'm planning to
> integrate this within a few days.

Hmm.. I'm thinking there might be an easier way to add support for all
of these (like gg, G, ^u, ^d, 123G, etc.), in one shot.

What about the following:

In the kba_visual, just do:
if (visual_selection_start == -1)
     visual_selection_start = ui.active->voffset + ui.active->crow;
else
     visual_selection_start = -1;


The visual_selection_end, I think, could always just be:
     ui.active->voffset + ui.active->crow;
so I wouldn't even track that.... just let the other keybinding
handlers modify that as they normally do.


In the paint code, a row gets the A_REVERSE wattron'd if and only if
the row is between
     visual_selection_start
and
     ui.active->voffset + ui.active->crow;
and the visual_selection_start is != -1 of course.


With that, yank could then be updated to use the
visual_selection_start (if != -1) and current row to get the
yank-portion.


Thoughts?

Other related posts: