1

Re: Mapping key to visual block + select

Hi,

When I do this in vim:
:map <C-S-B> <C-v>i{

I can hit ctrl-shift-b repeatedly, and the block grows.

If I do it in ViEmu, it only works on the first hit, but apparently the <C-v> interferes with subsequent invocations of i{ - I can tell because mapping a different key to just i{ works just fine.

Any chance of a fix to this? smile

/Brian

2

Re: Mapping key to visual block + select

Brian, I'll have a look at this and post back about it. I'm not really sure why it may be failing, although some sensitivity to trying to enter visual-block mode does not really surprise me much. Hopefully it will be easy to addres.

3

Re: Mapping key to visual block + select

Brian, I've finally been able to analyze this and implement a fix. The reason it didn't work in ViEmu is that <C-v> sanitizes the cursor position, bringing it inside the line from the end-of-line position. Thust, the logic that i{ uses to decide to extend the selection did not kick in (it only kicks in if the new selection found by i{ is exactly the same as the previous one).

Initially I thought that your mapping didn't make sense, as i{ turns the visual mode into char-wise. Then, I realized this allowed it to work fine both in normal and in visual modes for direct repetition.

I also realized that having two separate mappings, one for normal mode and another one for visual mode, would have probably fixed it:

  :nnoremap <c-s-b> vi{
  :vnoremap <c-s-b> i{

But in any case, I changed the logic of what <c-v> and shift-v do, so that it will allow the cursor to stay at the end-of-line position, as visual-chars mode already did. And so that it will work more similarly to vim. You can overwrite the current DLL in your installation folder to get this new version, which makes your mapping work fine:

  http://www.viemu.com/26ext/ViEmu.dll

This is version-tagged "2.1.26.return.ext", it includes another improvement I recently added. If everything tests fine I will turn this into 2.1.27 and release it properly in the next few days.

By the way, my proposal above will also make your command work even if you start from visual-block mode, so it's probably better.

Best regards,

  - Jon