Re: gvim cut paste selection

2006-11-07 Thread Stahlman Family

Ujjal,
   Although it fixed the problem (or perhaps only masked it, as the underlying problem is with Cygwin X), the patch I submitted to 
Vim was rejected. Bram maintained that since the bug pertained to Cygwin XWindows, so should the fix. I actually did not disagree 
with him on this point. The reason I had started with Vim rather than XWindows was that I was more familiar with Vim's source code. 
However, since Bram refused to incorporate the patch, I proceeded to post to the XWindows list. It was suggested that I write a 
patch and submit it. I wrote a patch, and Colin Harrison (who was more familiar with the patch submission process) tested the patch 
and submitted it to the Bugzilla bug tracking database. I also tested on my own PC running Cygwin X and gVim compiled from unix 
sources. Months after patch submission, the patch was accepted and the issue changed to FIXED / RESOLVED. I have not yet checked to 
see whether the patch has actually been rolled into the most recently released version of XWin. You can see a full description of 
the bug and how I fixed it by reading the thread below. Also, I've included the link to the Bugzilla submission page, so you can 
obtain and apply the Xwin patch if you like. Alternatively, you could obtain and apply the Vim patch, but since it's not likely ever 
to find its way into Vim (and really is kind of a kludge anyways), I'd recommend the former approach...


Hope this helps,
   Brett Stahlman

Thread subject: Serious flaw in Cygwin X clipboard integration prevents paste from 
X to Windows app
http://www.cygwin.com/ml/cygwin-xfree/2006-01/msg00030.html

Bugzilla entry 5375:
https://bugs.freedesktop.org/show_bug.cgi?id=5735

- Original Message - 
From: Ujjal Bose

To: [EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 3:16 AM
Subject: Fwd: gvim cut paste selection


Hi,

I saw ur patch that you have posted to the URL mentioned below. So will the same patch work for a unix vim or is it only for Win32 ? 
As you can see from the thread below that I am also facing similar problems , but from Unix Gvim  Windows Apps.


Thanks,
Ujjal




Forwarded Conversation
Subject: gvim cut paste selection
 


From: Ujjal Bose [EMAIL PROTECTED]
To: vim@vim.org
Date: Sat, Nov 4, 2006 at 9:30 PM


Hi ,

I was having problem with cut-paste selections from X - Windows
for gvim (6.2) , and this is the reply I got from the RealVNC team .
So is there a way to solve this in gvim ?

Thanks in advance !

-Ujjal

-- Forwarded message --
From: James Weatherall [EMAIL PROTECTED] 
Date: Nov 3, 2006 9:59 PM
Subject: RE: Xvnc cut paste problem
To: Ujjal Bose [EMAIL PROTECTED], [EMAIL PROTECTED]

Hi Ujjal,

It sounds like gvim doesn't set the timestamp on the X selection correctly
when it sets it, so vncconfig doesn't think it's changed.  Selecting text in
another X application, then selecting the desired text in gvim should cause
vncconfig to see the selection ownership change and to then send the gvim
text to the viewer.

Cheers,

Wez @ RealVNC Ltd.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] ] On
Behalf Of Ujjal Bose
Sent: 01 November 2006 19:09
To: [EMAIL PROTECTED]
Subject: Xvnc cut paste problem

For the laste few days my cut paste selections from
Unix-Windows is not working properly but Windows-Unix works
perfectly.
I was using autocutsel to enable cut-paste between various
X11 selections, and also had a line for vncconfig -nowin
-iconic in my VNC xstartup file but nothing seems to help.

0) I am using Xvnc 4.2.1 server in my Linux m/c and TightVNC
viewer on Windows XP side.

1) A Copy selection from a unix application (gvim) seems to
work intermittently.

2) If I do a mouse based visual selection (also called
PRIMARY selection in X11) from my gvim windows , and paste it
in Windows notepad, only a partial paste happens for the
first time, and then onwards , the same stuff is pasted over
and over again, in spite of selecting some other text in gvim.

3) Pasting from xterm-Notepad(Windows) seems to work correctly.

4) I even started a new VNC session on another Linux m/c
(same xstartup file) but didnt help.

5) Another thing I observed : from gvim , irrespective of my
selection method (copy or mouse based) , the paste in
Notepad seems to work only (partially in case of mouse
selection and fully in case of Copy) for the first time. If
I select something else now and then try to paste , the last
stuff only gets pasted. BUT IF I COPY BACK SOME TEXT FROM
WINDOWS-UNIX and then try again , IT WORKS FOR THE NEW
SELECTION , but again , only for once, till I repeat the process.

6) Again, pasting from xterm always works perfectly.

Any help appreciated.

-Ujjal



# My xstartup file 

vncconfig -nowin 
if ($OSTYPE == Linux) then
# Linux
 xrdb $HOME/.Xresources
 \xterm -geometry 80x24+10+10 -ls -title $VNCDESKTOP Desktop 
 #/usr/bin/gnome-session 
 #/usr/bin/startkde 
 #fvwm2 
/home

Re: gvim cut paste selection

2006-11-07 Thread Ujjal Bose

On 11/8/06, Stahlman Family [EMAIL PROTECTED] wrote:

Ujjal,
   Although it fixed the problem (or perhaps only masked it, as the underlying 
problem is with Cygwin X), the patch I submitted to
Vim was rejected. Bram maintained that since the bug pertained to Cygwin 
XWindows, so should the fix. I actually did not disagree
with him on this point. The reason I had started with Vim rather than XWindows 
was that I was more familiar with Vim's source code.
However, since Bram refused to incorporate the patch, I proceeded to post to 
the XWindows list. It was suggested that I write a
patch and submit it. I wrote a patch, and Colin Harrison (who was more familiar 
with the patch submission process) tested the patch
and submitted it to the Bugzilla bug tracking database. I also tested on my own 
PC running Cygwin X and gVim compiled from unix
sources. Months after patch submission, the patch was accepted and the issue 
changed to FIXED / RESOLVED. I have not yet checked to
see whether the patch has actually been rolled into the most recently released 
version of XWin. You can see a full description of
the bug and how I fixed it by reading the thread below. Also, I've included the 
link to the Bugzilla submission page, so you can
obtain and apply the Xwin patch if you like. Alternatively, you could obtain 
and apply the Vim patch, but since it's not likely ever
to find its way into Vim (and really is kind of a kludge anyways), I'd 
recommend the former approach...

Hope this helps,
   Brett Stahlman

Thread subject: Serious flaw in Cygwin X clipboard integration prevents paste from 
X to Windows app
http://www.cygwin.com/ml/cygwin-xfree/2006-01/msg00030.html

Bugzilla entry 5375:
https://bugs.freedesktop.org/show_bug.cgi?id=5735

- Original Message -
From: Ujjal Bose
To: [EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 3:16 AM
Subject: Fwd: gvim cut paste selection


Hi,

I saw ur patch that you have posted to the URL mentioned below. So will the 
same patch work for a unix vim or is it only for Win32 ?
As you can see from the thread below that I am also facing similar problems , but 
from Unix Gvim  Windows Apps.

Thanks,
Ujjal


Hi Brett,

I tested your vim patch on my machine and its working for me in Unix,
after removing the ifdef WIN32 macros from the patch. Now cut/paste
across gvim (unix) -- Windows apps is perfect !

As noted earlier by Brett, this may not be the best approach, but it
pretty much solves my problem :)

Thanks to Brett and Yakov !

-Ujjal


Re: gvim cut paste selection

2006-11-07 Thread Yakov Lerner

On 11/5/06, Bram Moolenaar [EMAIL PROTECTED] wrote:


Ujjal Bose wrote:

 I was having problem with cut-paste selections from X - Windows
 for gvim (6.2) , and this is the reply I got from the RealVNC team .
 So is there a way to solve this in gvim ?

 Thanks in advance !

 -Ujjal

 -- Forwarded message --
 From: James Weatherall [EMAIL PROTECTED]
 Date: Nov 3, 2006 9:59 PM
 Subject: RE: Xvnc cut paste problem
 To: Ujjal Bose [EMAIL PROTECTED], [EMAIL PROTECTED]

 Hi Ujjal,

 It sounds like gvim doesn't set the timestamp on the X selection correctly
 when it sets it, so vncconfig doesn't think it's changed.  Selecting text in
 another X application, then selecting the desired text in gvim should cause
 vncconfig to see the selection ownership change and to then send the gvim
 text to the viewer.

 Cheers,

 Wez @ RealVNC Ltd.

This is a known problem that nobody has found a solution for yet.  The
Time type is some special kind of timestamp.  I don't even know how to
get the timestamp for now.  That's why CurrentTime is used.  Getting
the timestamp from an event (e.g. a mouse click) is not always possible
(e.g., in an xterm we don't get it) and certainly difficult to pass all
the way from the input to the selection.

Problem with Xvnc is that they stick to the specification instead of
to what applications do in practice.


Bram,

I know how to fill the correct non-0 time in own_selection()
for xterm clipbpard and for Xt gui (we need to generate dummy
self-NotifyEvent to get timestamp). I did not know how to do it for gtk,
but looks like Brett have the solution for gtk.

What do you say about adding option xcliptime with values
0=use 0L timestamp, 1=fill non-0 timestamp ? It might be even
possible to auto-guess whether server  supports 0L timestamp in
OwnSelection (can be xcliptime==2).

Yakov


Re: gvim cut paste selection

2006-11-07 Thread Bram Moolenaar

Yakov Lerner wrote:

 On 11/5/06, Bram Moolenaar [EMAIL PROTECTED] wrote:
 
  Ujjal Bose wrote:
 
   I was having problem with cut-paste selections from X - Windows
   for gvim (6.2) , and this is the reply I got from the RealVNC team .
   So is there a way to solve this in gvim ?
  
   Thanks in advance !
  
   -Ujjal
  
   -- Forwarded message --
   From: James Weatherall [EMAIL PROTECTED]
   Date: Nov 3, 2006 9:59 PM
   Subject: RE: Xvnc cut paste problem
   To: Ujjal Bose [EMAIL PROTECTED], [EMAIL PROTECTED]
  
   Hi Ujjal,
  
   It sounds like gvim doesn't set the timestamp on the X selection correctly
   when it sets it, so vncconfig doesn't think it's changed.  Selecting text 
   in
   another X application, then selecting the desired text in gvim should 
   cause
   vncconfig to see the selection ownership change and to then send the gvim
   text to the viewer.
  
   Cheers,
  
   Wez @ RealVNC Ltd.
 
  This is a known problem that nobody has found a solution for yet.  The
  Time type is some special kind of timestamp.  I don't even know how to
  get the timestamp for now.  That's why CurrentTime is used.  Getting
  the timestamp from an event (e.g. a mouse click) is not always possible
  (e.g., in an xterm we don't get it) and certainly difficult to pass all
  the way from the input to the selection.
 
  Problem with Xvnc is that they stick to the specification instead of
  to what applications do in practice.
 
 Bram,
 
 I know how to fill the correct non-0 time in own_selection()
 for xterm clipbpard and for Xt gui (we need to generate dummy
 self-NotifyEvent to get timestamp). I did not know how to do it for gtk,
 but looks like Brett have the solution for gtk.
 
 What do you say about adding option xcliptime with values
 0=use 0L timestamp, 1=fill non-0 timestamp ? It might be even
 possible to auto-guess whether server  supports 0L timestamp in
 OwnSelection (can be xcliptime==2).

I don't like using an option for something that is actually something
system-dependent.  It's like telling the user we are incapable to
figure it out so he has to do all the work to figure out how it should
work himself.

As mentioned before, using CurrentTime for the timestamp, as we do now,
should work anyway.

-- 
If Microsoft would build a car...
... Occasionally your car would die on the freeway for no
reason. You would have to pull over to the side of the road,
close all of the car windows, shut it off, restart it, and
reopen the windows before you could continue. For some reason
you would simply accept this.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: gvim cut paste selection

2006-11-07 Thread Stahlman Family


- Original Message - 
From: Ujjal Bose [EMAIL PROTECTED]

To: vim@vim.org
Sent: Tuesday, November 07, 2006 1:19 PM
Subject: Re: gvim cut paste selection



On 11/8/06, Stahlman Family [EMAIL PROTECTED] wrote:

Ujjal,
   Although it fixed the problem (or perhaps only masked it, as the underlying problem is with Cygwin X), the patch I submitted 
to

Vim was rejected. Bram maintained that since the bug pertained to Cygwin 
XWindows, so should the fix. I actually did not disagree
with him on this point. The reason I had started with Vim rather than XWindows was that I was more familiar with Vim's source 
code.

However, since Bram refused to incorporate the patch, I proceeded to post to 
the XWindows list. It was suggested that I write a
patch and submit it. I wrote a patch, and Colin Harrison (who was more familiar with the patch submission process) tested the 
patch

and submitted it to the Bugzilla bug tracking database. I also tested on my own 
PC running Cygwin X and gVim compiled from unix
sources. Months after patch submission, the patch was accepted and the issue changed to FIXED / RESOLVED. I have not yet checked 
to

see whether the patch has actually been rolled into the most recently released 
version of XWin. You can see a full description of
the bug and how I fixed it by reading the thread below. Also, I've included the 
link to the Bugzilla submission page, so you can
obtain and apply the Xwin patch if you like. Alternatively, you could obtain and apply the Vim patch, but since it's not likely 
ever

to find its way into Vim (and really is kind of a kludge anyways), I'd 
recommend the former approach...

Hope this helps,
   Brett Stahlman

Thread subject: Serious flaw in Cygwin X clipboard integration prevents paste from 
X to Windows app
http://www.cygwin.com/ml/cygwin-xfree/2006-01/msg00030.html

Bugzilla entry 5375:
https://bugs.freedesktop.org/show_bug.cgi?id=5735

- Original Message -
From: Ujjal Bose
To: [EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 3:16 AM
Subject: Fwd: gvim cut paste selection


Hi,

I saw ur patch that you have posted to the URL mentioned below. So will the same patch work for a unix vim or is it only for 
Win32 ?

As you can see from the thread below that I am also facing similar problems , but 
from Unix Gvim  Windows Apps.

Thanks,
Ujjal


Hi Brett,

I tested your vim patch on my machine and its working for me in Unix,
after removing the ifdef WIN32 macros from the patch. Now cut/paste
across gvim (unix) -- Windows apps is perfect !

As noted earlier by Brett, this may not be the best approach, but it
pretty much solves my problem :)


Ujjal,
   I'm glad you got it working. Although the XWin patch is probably the ideal solution, building Vim is probably easier than 
building XWin, and a working non-ideal solution is always better than none at all. However, I am meaning to download the latest XWin 
source distribution to see whether my patch is in it yet. When I see that it is, I'll notify the list, since there are probably 
other Vim users who have been affected by this...


Brett Stahlman



Thanks to Brett and Yakov !

-Ujjal





Re: gvim cut paste selection

2006-11-06 Thread Yakov Lerner

On 11/4/06, Ujjal Bose [EMAIL PROTECTED] wrote:

I was having problem with cut-paste selections from X - Windows
for gvim (6.2) , and this is the reply I got from the RealVNC team .
So is there a way to solve this in gvim ?


I found the patch someone made for very similar problem:

   http://permalink.gmane.org/gmane.editors.vim/38505

I wonder whether this patch also fixes your problem with vnc
if you replace '#ifdef WIN32UNIX' in the patch to just '#if 1' ?

Yakov