Skip to content

Commit

Permalink
updated for version 7.3.343
Browse files Browse the repository at this point in the history
Problem:    No mouse support for urxvt.
Solution:   Implement urxvt mouse support, also for > 252 columns.  (Yiding
	    Jia)
  • Loading branch information
brammool committed Oct 20, 2011
1 parent 2d7f127 commit d770129
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
21 changes: 17 additions & 4 deletions src/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,9 @@
# ifdef FEAT_BIG
# define FEAT_MOUSE_DEC
# endif
# ifdef FEAT_BIG
# define FEAT_MOUSE_URXVT
# endif
# if defined(FEAT_NORMAL) && (defined(MSDOS) || defined(WIN3264))
# define DOS_MOUSE
# endif
Expand All @@ -1068,13 +1071,23 @@
#if defined(FEAT_NORMAL) && defined(HAVE_SYSMOUSE)
# define FEAT_SYSMOUSE
#endif

/* urxvt is a small variation of mouse_xterm, and shares its code */
#if defined(FEAT_MOUSE_URXVT) && !defined(FEAT_MOUSE_XTERM)
# define FEAT_MOUSE_XTERM
#endif

/* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
#if !defined(FEAT_MOUSE_TTY) \
&& (defined(FEAT_MOUSE_XTERM) \
|| defined(FEAT_MOUSE_NET) || defined(FEAT_MOUSE_DEC) \
|| defined(DOS_MOUSE) || defined(FEAT_MOUSE_GPM) \
|| defined(FEAT_MOUSE_JSB) || defined(FEAT_MOUSE_PTERM) \
|| defined(FEAT_SYSMOUSE))
|| defined(FEAT_MOUSE_NET) \
|| defined(FEAT_MOUSE_DEC) \
|| defined(DOS_MOUSE) \
|| defined(FEAT_MOUSE_GPM) \
|| defined(FEAT_MOUSE_JSB) \
|| defined(FEAT_MOUSE_PTERM) \
|| defined(FEAT_SYSMOUSE) \
|| defined(FEAT_MOUSE_URXVT))
# define FEAT_MOUSE_TTY /* include non-GUI mouse support */
#endif
#if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
Expand Down
9 changes: 6 additions & 3 deletions src/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
*/
#define KS_TEAROFF 244

/* used for JSB term mouse */
/* Used for JSB term mouse. */
#define KS_JSBTERM_MOUSE 243

/* used a termcap entry that produces a normal character */
/* Used a termcap entry that produces a normal character. */
#define KS_KEY 242

/* Used for the qnx pterm mouse */
/* Used for the qnx pterm mouse. */
#define KS_PTERM_MOUSE 241

/* Used for click in a tab pages label. */
Expand All @@ -107,6 +107,9 @@
/* Used for menu in a tab pages line. */
#define KS_TABMENU 239

/* Used for the urxvt mouse. */
#define KS_URXVT_MOUSE 238

/*
* Filler used after KS_SPECIAL and others
*/
Expand Down
3 changes: 2 additions & 1 deletion src/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,15 @@ EXTERN long p_ttyscroll; /* 'ttyscroll' */
EXTERN char_u *p_ttym; /* 'ttymouse' */
EXTERN unsigned ttym_flags;
# ifdef IN_OPTION_C
static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", NULL};
static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", NULL};
# endif
# define TTYM_XTERM 0x01
# define TTYM_XTERM2 0x02
# define TTYM_DEC 0x04
# define TTYM_NETTERM 0x08
# define TTYM_JSBTERM 0x10
# define TTYM_PTERM 0x20
# define TTYM_URXVT 0x40
#endif
EXTERN char_u *p_udir; /* 'undodir' */
EXTERN long p_ul; /* 'undolevels' */
Expand Down
38 changes: 38 additions & 0 deletions src/os_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -2158,10 +2158,13 @@ use_xterm_like_mouse(name)
* Return non-zero when using an xterm mouse, according to 'ttymouse'.
* Return 1 for "xterm".
* Return 2 for "xterm2".
* Return 3 for "urxvt".
*/
int
use_xterm_mouse()
{
if (ttym_flags == TTYM_URXVT)
return 3;
if (ttym_flags == TTYM_XTERM2)
return 2;
if (ttym_flags == TTYM_XTERM)
Expand Down Expand Up @@ -3318,6 +3321,17 @@ mch_setmouse(on)
return;

xterm_mouse_vers = use_xterm_mouse();

# ifdef FEAT_MOUSE_URXVT
if (ttym_flags == TTYM_URXVT) {
out_str_nf((char_u *)
(on
? IF_EB("\033[?1015h", ESC_STR "[?1015h")
: IF_EB("\033[?1015l", ESC_STR "[?1015l")));
ison = on;
}
# endif

if (xterm_mouse_vers > 0)
{
if (on) /* enable mouse events, use mouse tracking if available */
Expand Down Expand Up @@ -3434,6 +3448,9 @@ check_mouse_termcode()
{
# ifdef FEAT_MOUSE_XTERM
if (use_xterm_mouse()
# ifdef FEAT_MOUSE_URXVT
&& use_xterm_mouse() != 3
# endif
# ifdef FEAT_GUI
&& !gui.in_use
# endif
Expand Down Expand Up @@ -3523,6 +3540,27 @@ check_mouse_termcode()
else
del_mouse_termcode(KS_PTERM_MOUSE);
# endif
# ifdef FEAT_MOUSE_URXVT
/* same as the dec mouse */
if (use_xterm_mouse() == 3
# ifdef FEAT_GUI
&& !gui.in_use
# endif
)
{
set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
? IF_EB("\233", CSI_STR)
: IF_EB("\033[", ESC_STR "[")));

if (*p_mouse != NUL)
{
mch_setmouse(FALSE);
setmouse();
}
}
else
del_mouse_termcode(KS_URXVT_MOUSE);
# endif
}
#endif

Expand Down
7 changes: 7 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ static char *(features[]) =
# else
"-mouse_xterm",
# endif
# ifdef FEAT_MOUSE_URXVT
"+mouse_urxvt",
# else
"-mouse_urxvt",
# endif
#endif
#ifdef __QNX__
# ifdef FEAT_MOUSE_PTERM
Expand Down Expand Up @@ -709,6 +714,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
343,
/**/
342,
/**/
Expand Down

0 comments on commit d770129

Please sign in to comment.