Re: [PATCH] vim_is_xterm() and screen

2007-05-10 Thread Bram Moolenaar

Micah Cowan wrote:

  
  Sorry for the repost; but I realized I should've drawn more attention  to
  the message with the patch in it, both so other lurkers know the threa d
  now includes a proposed patch, and so that we know what message to go
  back to if we want to refer to the code we're discussing.
 
  I have made a slight adjustment to the patch, swapping the order of
  STRICMP and term_is_xterm within vim_uses_xterm_mouse(). I was using
  vim_is_xterm() instead of term_is_xterm at first, but afterwards
  replaced it for efficiency, but left the order as it was.
  
  Looks OK to me.
 
 Terrific! Does that mean it'll go in? :)

Probably, but not right now.

  If I understood your other message correctly then using xterm2 for
  'ttymouse' would not work for screen.
 
 Well... manually setting it to xterm2 will work fine (assuming screen
 is running under a supporting version of xterm): I get the full dragging
 effect, etc. But screen doesn't do t_RV, and I don't know how else you'd
 determine support for xterm2, so there doesn't seem to be a safe way
 to set ttymouse to it automatically, for screen.
 
 Towards a better solution: how straightforward do you think it'll be to
 talk the ncurses guys into adding support for some of screen's
 extensions? AFAIK, the only one I care about is the xterm mouse support;
 another interesting one is a boolean supports ansi
 setforeground/setbackground codes; but I usually infer this (if
 necessary) from the presence of setaf/setbf (not a given, but...).

I think you need to talk to more people than ncurses for changing the
termcap/terminfo entries.  But it's a good start.

- Bram

-- 
From know your smileys:
 :-FBucktoothed vampire with one tooth missing

 /// 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///


xterm-mouse and terminfo [Re: [PATCH] vim_is_xterm() and screen]

2007-05-10 Thread Micah Cowan
Bram Moolenaar wrote:
 Micah Cowan wrote:
 Towards a better solution: how straightforward do you think it'll be to
 talk the ncurses guys into adding support for some of screen's
 extensions? AFAIK, the only one I care about is the xterm mouse support;
 another interesting one is a boolean supports ansi
 setforeground/setbackground codes; but I usually infer this (if
 necessary) from the presence of setaf/setbf (not a given, but...).
 
 I think you need to talk to more people than ncurses for changing the
 termcap/terminfo entries.  But it's a good start.

Well, I'll need to talk to ncurses to get the extensions added; after
that, I'll have to get the various terminal emulators, and any other
suppliers for terminfo descriptions, to actually /specify/ the
extensions; then, it'll take a good while for the various applications
(such as vim) to actually check for its presence.

Is that what you're referring to? :)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/



signature.asc
Description: OpenPGP digital signature


[PATCH] vim_is_xterm() and screen

2007-05-09 Thread Micah Cowan
Sorry for the repost; but I realized I should've drawn more attention to
the message with the patch in it, both so other lurkers know the thread
now includes a proposed patch, and so that we know what message to go
back to if we want to refer to the code we're discussing.

I have made a slight adjustment to the patch, swapping the order of
STRICMP and term_is_xterm within vim_uses_xterm_mouse(). I was using
vim_is_xterm() instead of term_is_xterm at first, but afterwards
replaced it for efficiency, but left the order as it was.

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

Index: os_unix.c
===
--- os_unix.c	(revision 276)
+++ os_unix.c	(working copy)
@@ -2034,6 +2034,21 @@
 		|| STRCMP(name, builtin_xterm) == 0);
 }
 
+/*
+ * Return TRUE if name appears to be that of a terminal
+ * known to support the xterm-style mouse protocol.
+ * Relies on term_is_xterm having been set to its correct value.
+ */
+int
+vim_uses_xterm_mouse(name)
+char_u *name;
+{
+if (name == NULL)
+	return FALSE;
+return (term_is_xterm
+		|| STRNICMP(name, screen, 6) == 0);
+}
+
 #if defined(FEAT_MOUSE_TTY) || defined(PROTO)
 /*
  * Return non-zero when using an xterm mouse, according to 'ttymouse'.
Index: term.c
===
--- term.c	(revision 276)
+++ term.c	(working copy)
@@ -1601,6 +1601,9 @@
 int		try;
 int		termcap_cleared = FALSE;
 #endif
+#if defined(UNIX) || defined(VMS)
+int		term_uses_xterm_mouse;
+#endif
 int		width = 0, height = 0;
 char_u	*error_msg = NULL;
 char_u	*bs_p, *del_p;
@@ -1903,6 +1906,7 @@
 
 #if defined(UNIX) || defined(VMS)
 term_is_xterm = vim_is_xterm(term);
+term_uses_xterm_mouse = vim_uses_xterm_mouse(term);
 #endif
 
 #ifdef FEAT_MOUSE
@@ -1923,7 +1927,7 @@
 #endif
 	clip_init(FALSE);
 #   endif
-	if (term_is_xterm)
+	if (term_uses_xterm_mouse)
 	{
 	if (use_xterm_mouse())
 		p = NULL;	/* keep existing value, might be xterm2 */



signature.asc
Description: PGP signature


signature.asc
Description: OpenPGP digital signature


Re: [PATCH] vim_is_xterm() and screen

2007-05-09 Thread Bram Moolenaar

Micah Cowan wrote:

 Sorry for the repost; but I realized I should've drawn more attention to
 the message with the patch in it, both so other lurkers know the thread
 now includes a proposed patch, and so that we know what message to go
 back to if we want to refer to the code we're discussing.
 
 I have made a slight adjustment to the patch, swapping the order of
 STRICMP and term_is_xterm within vim_uses_xterm_mouse(). I was using
 vim_is_xterm() instead of term_is_xterm at first, but afterwards
 replaced it for efficiency, but left the order as it was.

Looks OK to me.

If I understood your other message correctly then using xterm2 for
'ttymouse' would not work for screen.

-- 
From know your smileys:
 :-DBig smile

 /// 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: [PATCH] vim_is_xterm() and screen

2007-05-09 Thread Micah Cowan
Bram Moolenaar wrote:
 Micah Cowan wrote:
 
 Sorry for the repost; but I realized I should've drawn more attention to
 the message with the patch in it, both so other lurkers know the thread
 now includes a proposed patch, and so that we know what message to go
 back to if we want to refer to the code we're discussing.

 I have made a slight adjustment to the patch, swapping the order of
 STRICMP and term_is_xterm within vim_uses_xterm_mouse(). I was using
 vim_is_xterm() instead of term_is_xterm at first, but afterwards
 replaced it for efficiency, but left the order as it was.
 
 Looks OK to me.

Terrific! Does that mean it'll go in? :)

 If I understood your other message correctly then using xterm2 for
 'ttymouse' would not work for screen.

Well... manually setting it to xterm2 will work fine (assuming screen
is running under a supporting version of xterm): I get the full dragging
effect, etc. But screen doesn't do t_RV, and I don't know how else you'd
determine support for xterm2, so there doesn't seem to be a safe way
to set ttymouse to it automatically, for screen.

Towards a better solution: how straightforward do you think it'll be to
talk the ncurses guys into adding support for some of screen's
extensions? AFAIK, the only one I care about is the xterm mouse support;
another interesting one is a boolean supports ansi
setforeground/setbackground codes; but I usually infer this (if
necessary) from the presence of setaf/setbf (not a given, but...).

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] vim_is_xterm() and screen

2007-05-09 Thread Gary Johnson
On 2007-05-09, Micah Cowan [EMAIL PROTECTED] wrote:

 Towards a better solution: how straightforward do you think it'll be to
 talk the ncurses guys into adding support for some of screen's
 extensions? AFAIK, the only one I care about is the xterm mouse support;
 another interesting one is a boolean supports ansi
 setforeground/setbackground codes; but I usually infer this (if
 necessary) from the presence of setaf/setbf (not a given, but...).

The ncurses guys is Thomas Dickey, who frequents a number of lists 
and newsgroups,  and who would probably be willing to discuss it 
with you.  Contact information is here:

   http://www.gnu.org/software/ncurses/

Look for Who's Who and What's What.  You might also consider 
joining the bug-ncurses-request mailing list, which is open to 
anyone interested in helping with the development and testing of 
this package.

I would imagine the process would be more a matter of convincing 
Thomas to accept the concept, the design, and any patches you would 
submit, rather than the ncurses guys adding this support 
themselves.

Regards,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Mobile Broadband Division
 | Spokane, Washington, USA


Re: [PATCH] vim_is_xterm() and screen

2007-05-09 Thread Micah Cowan
Gary Johnson wrote:
 On 2007-05-09, Micah Cowan [EMAIL PROTECTED] wrote:
 
 Towards a better solution: how straightforward do you think it'll be to
 talk the ncurses guys into adding support for some of screen's
 extensions? AFAIK, the only one I care about is the xterm mouse support;
 another interesting one is a boolean supports ansi
 setforeground/setbackground codes; but I usually infer this (if
 necessary) from the presence of setaf/setbf (not a given, but...).
 
 The ncurses guys is Thomas Dickey, who frequents a number of lists 
 and newsgroups,  and who would probably be willing to discuss it 
 with you.  Contact information is here:
 
http://www.gnu.org/software/ncurses/
 
 Look for Who's Who and What's What.  You might also consider 
 joining the bug-ncurses-request mailing list, which is open to 
 anyone interested in helping with the development and testing of 
 this package.

Thanks for that!

 I would imagine the process would be more a matter of convincing 
 Thomas to accept the concept, the design, and any patches you would 
 submit, rather than the ncurses guys adding this support 
 themselves.

Fair enough. :)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/




signature.asc
Description: OpenPGP digital signature