Subject: patch 5.4p.1 (was: selection funny-ness)
From: Bram Moolenaar <[email-masked]>
To: Allan Kelly <[email-masked]>
Cc: vim developers list <[email-masked]>

------------

Allan Kelly wrote:

> Hi, I often work with 2 gvim windows, using the very handy 'visual selection is
> clipboard selection' feature to copy code around. It's great, but I have
> behaviour I don't see in other apps: Select text in one gvim, it becomes
> hilighted (yellow bgcolor for me) then select text in the other gvim, it too
> becomes selected, but the first selection changes to underlined text. hmm.
> Now hit <ESC> in both windows to clear the selections, and 'gv' in the
> window where the first selection was made. It's still underlined, not
> yellow. And it isn't the 'clipboard' selection (mouse pasting doesn't paste
> it).
> 
> What's going on?

It's a bug.  The code that gets the selection only checks if the area changed.
It doesn't notice that the selection was given away and should be obtained
again.  This also happens with Athena and Motif.

Patch 5.4p.1
Problem:    When using auto-select, and the "gv" command is used, would not
            always obtain ownership of the selection.  Caused by the Visual
            area still being the same, but ownership taken away by another
            program.
Solution:   Reset the clipboard Visual mode to force updating the selection.
Files:      src/normal.c

*** ../vim-5.4p/src/normal.c	Mon Jul 19 11:09:17 1999
--- src/normal.c	Mon Jul 19 11:59:21 1999
***************
*** 4991,4996 ****
--- 4991,5001 ----
  #ifdef USE_MOUSE
  	    setmouse();
  #endif
+ #ifdef USE_CLIPBOARD
+ 	    /* Make sure the clipboard gets updated.  Needed because start and
+ 	     * end are still the same, and the selection needs to be owned */
+ 	    clipboard.vmode = NUL;
+ #endif
  	    update_curbuf(NOT_VALID);
  	    showmode();
  	}

--
hundred-and-one symptoms of being an internet addict:
154. You fondle your mouse.

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /