summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/arabic.txt2
-rw-r--r--runtime/doc/if_pyth.txt23
-rw-r--r--runtime/doc/index.txt24
-rw-r--r--runtime/doc/insert.txt12
-rw-r--r--runtime/doc/scroll.txt71
-rw-r--r--runtime/doc/tags29
-rw-r--r--runtime/doc/todo.txt13
-rw-r--r--runtime/doc/version6.txt2
-rw-r--r--runtime/doc/version7.txt12
-rw-r--r--src/edit.c46
-rw-r--r--src/eval.c2
-rw-r--r--src/ex_getln.c4
-rw-r--r--src/gui.c117
-rw-r--r--src/gui_gtk_x11.c8
-rw-r--r--src/keymap.h7
-rw-r--r--src/message.c1
-rw-r--r--src/misc1.c2
-rw-r--r--src/misc2.c8
-rw-r--r--src/normal.c43
-rw-r--r--src/proto/gui.pro2
-rw-r--r--src/screen.c2
-rw-r--r--src/term.c4
-rw-r--r--src/vim.h12
23 files changed, 304 insertions, 142 deletions
diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt
index 8a55dea7fc..e38aa1a960 100644
--- a/runtime/doc/arabic.txt
+++ b/runtime/doc/arabic.txt
@@ -275,7 +275,7 @@ o Keyboard
+ CTRL-^ in insert/replace mode toggles between Arabic/Latin mode
+ Keyboard mapping is based on the Microsoft's Arabic keymap (the
- defacto standard in the Arab world):
+ de facto standard in the Arab world):
+---------------------------------------------------------------------+
|! |@ |# |$ |% |^ |& |* |( |) |_ |+ || |~ ّ |
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index f9fddaffd1..3e187db840 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -1,4 +1,4 @@
-*if_pyth.txt* For Vim version 7.3b. Last change: 2010 Jul 24
+*if_pyth.txt* For Vim version 7.3b. Last change: 2010 Jul 25
VIM REFERENCE MANUAL by Paul Moore
@@ -337,12 +337,21 @@ sure edit "gvim.exe" and search for "python\d*.dll\c".
==============================================================================
7. Python 3 *python3*
-Python 3 support can exist next to Python 2.x.
-
-*:py3* *:python3* *:py3file*
-
-TODO
-
+ *:py3* *:python3*
+The |:py3| and |:python3| commands work similar to |:python|.
+ *:py3file*
+The |:py3file| command works similar to |:pyfile|.
+
+Vim can be built in four ways (:version output):
+1. No Python support (-python, -python3)
+2. Python 2 support only (+python or +python/dyn, -python3)
+3. Python 3 support only (-python, +python3 or +python3/dyn)
+4. Python 2 and 3 support (+python/dyn, +python3/dyn)
+
+You can see that when Python 2 and Python 3 are both supported they must be
+loaded dynamically. This may cause some problems though, therefore currently
+inside a Vim executable you can only use Python 2 or Python 3. To switch to
+the other one you need to restart Vim.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index c198dc7e16..47c10ce0d0 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -136,10 +136,14 @@ tag char action ~
|i_<Help>| <Help> stop insert mode and display help window
|i_<Insert>| <Insert> toggle Insert/Replace mode
|i_<LeftMouse>| <LeftMouse> cursor at mouse click
-|i_<MouseDown>| <MouseDown> scroll three lines downwards
-|i_<S-MouseDown>| <S-MouseDown> scroll a full page downwards
-|i_<MouseUp>| <MouseUp> scroll three lines upwards
-|i_<S-MouseUp>| <S-MouseUp> scroll a full page upwards
+|i_<ScrollWheelDown>| <ScrollWheelDown> move window three lines down
+|i_<S-ScrollWheelDown>| <S-ScrollWheelDown> move window one page down
+|i_<ScrollWheelUp>| <ScrollWheelUp> move window three lines up
+|i_<S-ScrollWheelUp>| <S-ScrollWheelUp> move window one page up
+|i_<ScrollWheelLeft>| <ScrollWheelLeft> move window six columns left
+|i_<S-ScrollWheelLeft>| <S-ScrollWheelLeft> move window one page left
+|i_<ScrollWheelRight>| <ScrollWheelRight> move window six columns right
+|i_<S-ScrollWheelRight>| <S-ScrollWheelRight> move window one page right
commands in CTRL-X submode *i_CTRL-X_index*
@@ -441,10 +445,14 @@ tag char note action in Normal mode ~
|<S-Up>| <S-Up> 1 same as CTRL-B
|<Undo>| <Undo> 2 same as "u"
|<Up>| <Up> 1 same as "k"
-|<MouseDown>| <MouseDown> scroll three lines downwards
-|<S-MouseDown>| <S-MouseDown> scroll a full page downwards
-|<MouseUp>| <MouseUp> scroll three lines upwards
-|<S-MouseUp>| <S-MouseUp> scroll a full page upwards
+|<ScrollWheelDown>| <ScrollWheelDown> move window three lines down
+|<S-ScrollWheelDown>| <S-ScrollWheelDown> move window one page down
+|<ScrollWheelUp>| <ScrollWheelUp> move window three lines up
+|<S-ScrollWheelUp>| <S-ScrollWheelUp> move window one page up
+|<ScrollWheelLeft>| <ScrollWheelLeft> move window six columns left
+|<S-ScrollWheelLeft>| <S-ScrollWheelLeft> move window one page left
+|<ScrollWheelRight>| <ScrollWheelRight> move window six columns right
+|<S-ScrollWheelRight>| <S-ScrollWheelRight> move window one page right
==============================================================================
2.1 Text objects *objects*
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 771bf08d1e..315fa72a31 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -359,10 +359,14 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J*
<PageUp> move window one page up *i_<PageUp>*
<S-Down> move window one page down *i_<S-Down>*
<PageDown> move window one page down *i_<PageDown>*
-<MouseDown> scroll three lines down *i_<MouseDown>*
-<S-MouseDown> scroll a full page down *i_<S-MouseDown>*
-<MouseUp> scroll three lines up *i_<MouseUp>*
-<S-MouseUp> scroll a full page up *i_<S-MouseUp>*
+<ScrollWheelDown> move window three lines down *i_<ScrollWheelDown>*
+<S-ScrollWheelDown> move window one page down *i_<S-ScrollWheelDown>*
+<ScrollWheelUp> move window three lines up *i_<ScrollWheelUp>*
+<S-ScrollWheelUp> move window one page up *i_<S-ScrollWheelUp>*
+<ScrollWheelLeft> move window six columns left *i_<ScrollWheelLeft>*
+<S-ScrollWheelLeft> move window one page left *i_<S-ScrollWheelLeft>*
+<ScrollWheelRight> move window six columns right *i_<ScrollWheelRight>*
+<S-ScrollWheelRight> move window one page right *i_<S-ScrollWheelRight>*
CTRL-O execute one command, return to Insert mode *i_CTRL-O*
CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O*
CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L*
diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt
index f2daa1b115..07c2abb16a 100644
--- a/runtime/doc/scroll.txt
+++ b/runtime/doc/scroll.txt
@@ -242,7 +242,8 @@ This allows quick adjustment of the relative offset of 'scrollbind' windows.
When your mouse has a scroll wheel, it should work with Vim in the GUI. How
it works depends on your system. It might also work in an xterm
-|xterm-mouse-wheel|.
+|xterm-mouse-wheel|. By default only vertical scroll wheels are supported,
+but some GUIs also support horizontal scroll wheels.
For the Win32 GUI the scroll action is hard coded. It works just like
dragging the scrollbar of the current window. How many lines are scrolled
@@ -250,24 +251,36 @@ depends on your mouse driver. If the scroll action causes input focus
problems, see |intellimouse-wheel-problems|.
For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key
-presses <MouseDown> and <MouseUp>. The default action for these keys are:
- <MouseDown> scroll three lines down. *<MouseDown>*
- <S-MouseDown> scroll a full page down. *<S-MouseDown>*
- <C-MouseDown> scroll a full page down. *<C-MouseDown>*
- <MouseUp> scroll three lines up. *<MouseUp>*
- <S-MouseUp> scroll a full page up. *<S-MouseUp>*
- <C-MouseUp> scroll a full page up. *<C-MouseUp>*
+presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and
+<ScrollWheelRight>. For example, if you push the scroll wheel upwards a
+<ScrollWheelUp> key press is generated causing the window to scroll upwards
+(while the text is actually moving downwards). The default action for these
+keys are:
+ <ScrollWheelUp> scroll three lines up *<ScrollWheelUp>*
+ <S-ScrollWheelUp> scroll one page up *<S-ScrollWheelUp>*
+ <C-ScrollWheelUp> scroll one page up *<C-ScrollWheelUp>*
+ <ScrollWheelDown> scroll three lines down *<ScrollWheelDown>*
+ <S-ScrollWheelDown> scroll one page down *<S-ScrollWheelDown>*
+ <C-ScrollWheelDown> scroll one page down *<C-ScrollWheelDown>*
+ <ScrollWheelLeft> scroll six columns left *<ScrollWheelLeft>*
+ <S-ScrollWheelLeft> scroll one page left *<S-ScrollWheelLeft>*
+ <C-ScrollWheelLeft> scroll one page left *<C-ScrollWheelLeft>*
+ <ScrollWheelRight> scroll six columns right *<ScrollWheelRight>*
+ <S-ScrollWheelRight> scroll one page right *<S-ScrollWheelRight>*
+ <C-ScrollWheelRight> scroll one page right *<C-ScrollWheelRight>*
This should work in all modes, except when editing the command line.
-Note that <MouseDown> is used for scrolling the text down, this happens when
-you turn the mouse wheel up!
-
-You can modify this behavior by mapping the keys. For example, to make the
-scroll wheel move one line or half a page in Normal mode: >
- :map <MouseDown> <C-Y>
- :map <S-MouseDown> <C-U>
- :map <MouseUp> <C-E>
- :map <S-MouseUp> <C-D>
+Note that horizontal scrolling only works if 'nowrap' is set. Also, unless
+the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
+line if the cursor line is about to be scrolled off the screen (similarly to
+how the horizontal scrollbar works).
+
+You can modify the default behavior by mapping the keys. For example, to make
+the scroll wheel move one line or half a page in Normal mode: >
+ :map <ScrollWheelUp> <C-Y>
+ :map <S-ScrollWheelUp> <C-U>
+ :map <ScrollWheelDown> <C-E>
+ :map <S-ScrollWheelDown> <C-D>
You can also use Alt and Ctrl modifiers.
This only works when Vim gets the scroll wheel events, of course. You can
@@ -280,6 +293,10 @@ your mouse. For FreeBSD, this entry works for a Logitech scrollmouse: >
ZAxisMapping 4 5
See the XFree86 documentation for information.
+ *<MouseDown>* *<MouseUp>*
+The keys <MouseDown> and <MouseUp> have been deprecated. Use <ScrollWheelUp>
+instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>.
+
*xterm-mouse-wheel*
To use the mouse wheel in a new xterm you only have to make the scroll wheel
work in your Xserver, as mentioned above.
@@ -288,8 +305,8 @@ To use the mouse wheel in an older xterm you must do this:
1. Make it work in your Xserver, as mentioned above.
2. Add translations for the xterm, so that the xterm will pass a scroll event
to Vim as an escape sequence.
-3. Add mappings in Vim, to interpret the escape sequences as <MouseUp> or
- <MouseDown> keys.
+3. Add mappings in Vim, to interpret the escape sequences as <ScrollWheelDown>
+ or <ScrollWheelUp> keys.
You can do the translations by adding this to your ~.Xdefaults file (or other
file where your X resources are kept): >
@@ -303,13 +320,13 @@ file where your X resources are kept): >
<Btn5Up>:
Add these mappings to your vimrc file: >
- :map <M-Esc>[62~ <MouseDown>
- :map! <M-Esc>[62~ <MouseDown>
- :map <M-Esc>[63~ <MouseUp>
- :map! <M-Esc>[63~ <MouseUp>
- :map <M-Esc>[64~ <S-MouseDown>
- :map! <M-Esc>[64~ <S-MouseDown>
- :map <M-Esc>[65~ <S-MouseUp>
- :map! <M-Esc>[65~ <S-MouseUp>
+ :map <M-Esc>[62~ <ScrollWheelUp>
+ :map! <M-Esc>[62~ <ScrollWheelUp>
+ :map <M-Esc>[63~ <ScrollWheelDown>
+ :map! <M-Esc>[63~ <ScrollWheelDown>
+ :map <M-Esc>[64~ <S-ScrollWheelUp>
+ :map! <M-Esc>[64~ <S-ScrollWheelUp>
+ :map <M-Esc>[65~ <S-ScrollWheelDown>
+ :map! <M-Esc>[65~ <S-ScrollWheelDown>
<
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 78edec11e5..9dcbaf1e23 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -3056,12 +3056,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
<C-Insert> os_dos.txt /*<C-Insert>*
<C-Left> motion.txt /*<C-Left>*
<C-LeftMouse> tagsrch.txt /*<C-LeftMouse>*
-<C-MouseDown> scroll.txt /*<C-MouseDown>*
-<C-MouseUp> scroll.txt /*<C-MouseUp>*
<C-PageDown> tabpage.txt /*<C-PageDown>*
<C-PageUp> tabpage.txt /*<C-PageUp>*
<C-Right> motion.txt /*<C-Right>*
<C-RightMouse> tagsrch.txt /*<C-RightMouse>*
+<C-ScrollWheelDown> scroll.txt /*<C-ScrollWheelDown>*
+<C-ScrollWheelLeft> scroll.txt /*<C-ScrollWheelLeft>*
+<C-ScrollWheelRight> scroll.txt /*<C-ScrollWheelRight>*
+<C-ScrollWheelUp> scroll.txt /*<C-ScrollWheelUp>*
<CR> motion.txt /*<CR>*
<CSI> intro.txt /*<CSI>*
<Char-> map.txt /*<Char->*
@@ -3140,10 +3142,12 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
<S-Insert> os_dos.txt /*<S-Insert>*
<S-Left> motion.txt /*<S-Left>*
<S-LeftMouse> term.txt /*<S-LeftMouse>*
-<S-MouseDown> scroll.txt /*<S-MouseDown>*
-<S-MouseUp> scroll.txt /*<S-MouseUp>*
<S-Right> motion.txt /*<S-Right>*
<S-RightMouse> term.txt /*<S-RightMouse>*
+<S-ScrollWheelDown> scroll.txt /*<S-ScrollWheelDown>*
+<S-ScrollWheelLeft> scroll.txt /*<S-ScrollWheelLeft>*
+<S-ScrollWheelRight> scroll.txt /*<S-ScrollWheelRight>*
+<S-ScrollWheelUp> scroll.txt /*<S-ScrollWheelUp>*
<S-Tab> term.txt /*<S-Tab>*
<S-Up> scroll.txt /*<S-Up>*
<S-xF1> term.txt /*<S-xF1>*
@@ -3152,6 +3156,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
<S-xF4> term.txt /*<S-xF4>*
<SID> map.txt /*<SID>*
<SNR> map.txt /*<SNR>*
+<ScrollWheelDown> scroll.txt /*<ScrollWheelDown>*
+<ScrollWheelLeft> scroll.txt /*<ScrollWheelLeft>*
+<ScrollWheelRight> scroll.txt /*<ScrollWheelRight>*
+<ScrollWheelUp> scroll.txt /*<ScrollWheelUp>*
<Space> motion.txt /*<Space>*
<Tab> motion.txt /*<Tab>*
<Undo> undo.txt /*<Undo>*
@@ -6166,18 +6174,22 @@ i_<Home> insert.txt /*i_<Home>*
i_<Insert> insert.txt /*i_<Insert>*
i_<Left> insert.txt /*i_<Left>*
i_<LeftMouse> insert.txt /*i_<LeftMouse>*
-i_<MouseDown> insert.txt /*i_<MouseDown>*
-i_<MouseUp> insert.txt /*i_<MouseUp>*
i_<NL> insert.txt /*i_<NL>*
i_<PageDown> insert.txt /*i_<PageDown>*
i_<PageUp> insert.txt /*i_<PageUp>*
i_<Right> insert.txt /*i_<Right>*
i_<S-Down> insert.txt /*i_<S-Down>*
i_<S-Left> insert.txt /*i_<S-Left>*
-i_<S-MouseDown> insert.txt /*i_<S-MouseDown>*
-i_<S-MouseUp> insert.txt /*i_<S-MouseUp>*
i_<S-Right> insert.txt /*i_<S-Right>*
+i_<S-ScrollWheelDown> insert.txt /*i_<S-ScrollWheelDown>*
+i_<S-ScrollWheelLeft> insert.txt /*i_<S-ScrollWheelLeft>*
+i_<S-ScrollWheelRight> insert.txt /*i_<S-ScrollWheelRight>*
+i_<S-ScrollWheelUp> insert.txt /*i_<S-ScrollWheelUp>*
i_<S-Up> insert.txt /*i_<S-Up>*
+i_<ScrollWheelDown> insert.txt /*i_<ScrollWheelDown>*
+i_<ScrollWheelLeft> insert.txt /*i_<ScrollWheelLeft>*
+i_<ScrollWheelRight> insert.txt /*i_<ScrollWheelRight>*
+i_<ScrollWheelUp> insert.txt /*i_<ScrollWheelUp>*
i_<Tab> insert.txt /*i_<Tab>*
i_<Up> insert.txt /*i_<Up>*
i_BS insert.txt /*i_BS*
@@ -7599,6 +7611,7 @@ synIDattr() eval.txt /*synIDattr()*
synIDtrans() eval.txt /*synIDtrans()*
syncbind scroll.txt /*syncbind*
syncolor syntax.txt /*syncolor*
+synconcealed() eval.txt /*synconcealed()*
synload-1 syntax.txt /*synload-1*
synload-2 syntax.txt /*synload-2*
synload-3 syntax.txt /*synload-3*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index c28661d662..a7c9aaf34f 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -30,15 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-concealends does not appear to work.
-
-if_python3.c is missing some changes that were applied to if_python.c.
-Find the old version of if_python.c from when the copy was made.
-
-Move more common code from if_python.c and if_python3.c to if_py_both.h
-
-Add documentation for Python 3 support.
-
Include patch for horizontal scoll wheel? (Bjorn Winckler, 2010 Jul 20)
Additional patch Jul 21.
@@ -50,9 +41,13 @@ Additional patch Jul 21.
Patch for :find completion. (Nazri Ramliy)
But I prefer to keep term.h and include/term.h He will work on it.
+Add hg changes to version7.txt
+
Before release 7.3:
- Rename vim73 branch to default (hints: Xavier de Gaye, 2010 May 23)
+Move more common code from if_python.c and if_python3.c to if_py_both.h
+
Cursor positioning wrong with 0x200e character. (John Becket, 2010 May 6)
Test 69 breaks on MS-Windows, both 32 and 64 builds. (George Reilly, 2010 Feb
diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt
index 148929b313..8060b28d42 100644
--- a/runtime/doc/version6.txt
+++ b/runtime/doc/version6.txt
@@ -10357,7 +10357,7 @@ Files: src/ex_cmds2.c
Patch 6.2.066 (extra)
Problem: Ruby interface doesn't work with Ruby 1.8.0.
-Solution: Change "defout" to "stdout". (Aron Grifis)
+Solution: Change "defout" to "stdout". (Aron Griffis)
Change dynamic loading. (Taro Muraoka)
Files: src/if_ruby.c, src/Make_mvc.mak
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index de2a7de1b8..ee2c4dd321 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt* For Vim version 7.3b. Last change: 2010 Jul 24
+*version7.txt* For Vim version 7.3b. Last change: 2010 Jul 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5530,7 +5530,7 @@ Files: src/gui_mac.c
Patch 7.1.125
Problem: The TermResponse autocommand event is not always triggered. (Aron
- Griffix)
+ Griffis)
Solution: When unblocking autocommands check if v:termresponse changed and
trigger the event then.
Files: src/buffer.c, src/diff.c, src/ex_getln.c, src/fileio.c,
@@ -8679,7 +8679,7 @@ Files: src/testdir/Makefile
Patch 7.2.218
Problem: Cannot build GTK with hangul_input feature. (Dominique Pelle)
-Solution: Adjuste #ifdef. (SungHyun Nam)
+Solution: Adjust #ifdef. (SungHyun Nam)
Files: src/gui.c
Patch 7.2.219 (extra)
@@ -9905,7 +9905,7 @@ Files: runtime/doc/autocmd.txt, src/if_cscope.c
Patch 7.2.434 (after 7.2.432)
Problem: Compilation fails without the multi-lang feature.
-Solution: Add #ifdefs. (Johm Marriott)
+Solution: Add #ifdefs. (John Marriott)
Files: src/menu.c
Patch 7.2.435 (after 7.2.430)
@@ -10032,12 +10032,10 @@ Some versions of Ruby redefine rb_str_new2 to rb_str_new_cstr.
Window title not updated after file dropped.
-"g8" doesn't work properly on a NUL.
-
Fixed crash for ":find" completion, might also happen in other path expansion
usage.
-When 'searchhl' causes a hang make CTRL-C disable 'shearchhl'.
+When 'searchhl' causes a hang make CTRL-C disable 'searchhl'.
vim:tw=78:ts=8:ft=help:norl:
diff --git a/src/edit.c b/src/edit.c
index 3370a28f2d..4754fd9bde 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -224,7 +224,7 @@ static void ins_del __ARGS((void));
static int ins_bs __ARGS((int c, int mode, int *inserted_space_p));
#ifdef FEAT_MOUSE
static void ins_mouse __ARGS((int c));
-static void ins_mousescroll __ARGS((int up));
+static void ins_mousescroll __ARGS((int dir));
#endif
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void ins_tabline __ARGS((int c));
@@ -1112,11 +1112,19 @@ doESCkey:
break;
case K_MOUSEDOWN: /* Default action for scroll wheel up: scroll up */
- ins_mousescroll(FALSE);
+ ins_mousescroll(MSCR_DOWN);
break;
case K_MOUSEUP: /* Default action for scroll wheel down: scroll down */
- ins_mousescroll(TRUE);
+ ins_mousescroll(MSCR_UP);
+ break;
+
+ case K_MOUSELEFT: /* Scroll wheel left */
+ ins_mousescroll(MSCR_LEFT);
+ break;
+
+ case K_MOUSERIGHT: /* Scroll wheel right */
+ ins_mousescroll(MSCR_RIGHT);
break;
#endif
#ifdef FEAT_GUI_TABLINE
@@ -3516,7 +3524,8 @@ ins_compl_prep(c)
edit_submode_extra = NULL;
/* Ignore end of Select mode mapping and mouse scroll buttons. */
- if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP)
+ if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
+ || c == K_MOUSELEFT || c == K_MOUSERIGHT)
return retval;
/* Set "compl_get_longest" when finding the first matches. */
@@ -8859,8 +8868,8 @@ ins_mouse(c)
}
static void
-ins_mousescroll(up)
- int up;
+ins_mousescroll(dir)
+ int dir;
{
pos_T tpos;
# if defined(FEAT_WINDOWS)
@@ -8898,10 +8907,27 @@ ins_mousescroll(up)
)
# endif
{
- if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
- scroll_redraw(up, (long)(curwin->w_botline - curwin->w_topline));
+ if (dir == MSCR_DOWN || dir == MSCR_UP)
+ {
+ if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
+ scroll_redraw(dir,
+ (long)(curwin->w_botline - curwin->w_topline));
+ else
+ scroll_redraw(dir, 3L);
+ }
+#ifdef FEAT_GUI
else
- scroll_redraw(up, 3L);
+ {
+ int val, step = 6;
+
+ if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
+ step = W_WIDTH(curwin);
+ val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step);
+ if (val < 0)
+ val = 0;
+ gui_do_horiz_scroll(val, TRUE);
+ }
+#endif
# ifdef FEAT_INS_EXPAND
did_scroll = TRUE;
# endif
@@ -8985,7 +9011,7 @@ ins_horscroll()
undisplay_dollar();
tpos = curwin->w_cursor;
- if (gui_do_horiz_scroll())
+ if (gui_do_horiz_scroll(scrollbar_value, FALSE))
{
start_arrow(&tpos);
# ifdef FEAT_CINDENT
diff --git a/src/eval.c b/src/eval.c
index 4f1be3fa20..ac0ad26792 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -10927,6 +10927,8 @@ f_getchar(argvars, rettv)
|| n == K_X2MOUSE
|| n == K_X2DRAG
|| n == K_X2RELEASE
+ || n == K_MOUSELEFT
+ || n == K_MOUSERIGHT
|| n == K_MOUSEDOWN
|| n == K_MOUSEUP)
{
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 153271b5cc..7b7874ad4f 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1334,6 +1334,8 @@ getcmdline(firstc, count, indent)
/* Mouse scroll wheel: ignored here */
case K_MOUSEDOWN:
case K_MOUSEUP:
+ case K_MOUSELEFT:
+ case K_MOUSERIGHT:
/* Alternate buttons ignored here */
case K_X1MOUSE:
case K_X1DRAG:
@@ -1361,7 +1363,7 @@ getcmdline(firstc, count, indent)
case K_HOR_SCROLLBAR:
if (msg_scrolled == 0)
{
- gui_do_horiz_scroll();
+ gui_do_horiz_scroll(scrollbar_value, FALSE);
redrawcmd();
}
goto cmdline_not_changed;
diff --git a/src/gui.c b/src/gui.c
index 5aece03c28..49014a532d 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -31,6 +31,7 @@ static int gui_has_tabline __ARGS((void));
#endif
static void gui_do_scrollbar __ARGS((win_T *wp, int which, int enable));
static colnr_T scroll_line_len __ARGS((linenr_T lnum));
+static linenr_T gui_find_longest_lnum __ARGS((void));
static void gui_update_horiz_scrollbar __ARGS((int));
static void gui_set_fg_color __ARGS((char_u *name));
static void gui_set_bg_color __ARGS((char_u *name));
@@ -2759,7 +2760,8 @@ fill_mouse_coord(p, col, row)
* button --- may be any of MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT,
* MOUSE_X1, MOUSE_X2
* MOUSE_DRAG, or MOUSE_RELEASE.
- * MOUSE_4 and MOUSE_5 are used for a scroll wheel.
+ * MOUSE_4 and MOUSE_5 are used for vertical scroll wheel,
+ * MOUSE_6 and MOUSE_7 for horizontal scroll wheel.
* x, y --- Coordinates of mouse in pixels.
* repeated_click --- TRUE if this click comes only a short time after a
* previous click.
@@ -2803,6 +2805,12 @@ gui_send_mouse_event(button, x, y, repeated_click, modifiers)
goto button_set;
case MOUSE_5:
button_char = KE_MOUSEUP;
+ goto button_set;
+ case MOUSE_6:
+ button_char = KE_MOUSELEFT;
+ goto button_set;
+ case MOUSE_7:
+ button_char = KE_MOUSERIGHT;
button_set:
{
/* Don't put events in the input queue now. */
@@ -3845,14 +3853,14 @@ gui_drag_scrollbar(sb, value, still_dragging)
scrollbar_value = value;
if (State & NORMAL)
- gui_do_horiz_scroll();
+ gui_do_horiz_scroll(scrollbar_value, FALSE);
else if (State & INSERT)
ins_horscroll();
else if (State & CMDLINE)
{
if (msg_scrolled == 0)
{
- gui_do_horiz_scroll();
+ gui_do_horiz_scroll(scrollbar_value, FALSE);
redrawcmdline();
}
}
@@ -4319,6 +4327,51 @@ scroll_line_len(lnum)
* search for it when scrolling horizontally. */
static linenr_T longest_lnum = 0;
+/*
+ * Find longest visible line number. If this is not possible (or not desired,
+ * by setting 'h' in "guioptions") then the current line number is returned.
+ */
+ static linenr_T
+gui_find_longest_lnum()
+{
+ linenr_T ret = 0;
+
+ /* Calculate maximum for horizontal scrollbar. Check for reasonable
+ * line numbers, topline and botline can be invalid when displaying is
+ * postponed. */
+ if (vim_strchr(p_go, GO_HORSCROLL) == NULL
+ && curwin->w_topline <= curwin->w_cursor.lnum
+ && curwin->w_botline > curwin->w_cursor.lnum
+ && curwin->w_botline <= curbuf->b_ml.ml_line_count + 1)
+ {
+ linenr_T lnum;
+ colnr_T n;
+ long max = 0;
+
+ /* Use maximum of all visible lines. Remember the lnum of the
+ * longest line, closest to the cursor line. Used when scrolling
+ * below. */
+ for (lnum = curwin->w_topline; lnum < curwin->w_botline; ++lnum)
+ {
+ n = scroll_line_len(lnum);
+ if (n > (colnr_T)max)
+ {
+ max = n;
+ ret = lnum;
+ }
+ else if (n == (colnr_T)max
+ && abs((int)(lnum - curwin->w_cursor.lnum))
+ < abs((int)(ret - curwin->w_cursor.lnum)))
+ ret = lnum;
+ }
+ }
+ else
+ /* Use cursor line only. */
+ ret = curwin->w_cursor.lnum;
+
+ return ret;
+}
+
static void
gui_update_horiz_scrollbar(force)
int force;
@@ -4358,38 +4411,9 @@ gui_update_horiz_scrollbar(force)
{
value = curwin->w_leftcol;
- /* Calculate maximum for horizontal scrollbar. Check for reasonable
- * line numbers, topline and botline can be invalid when displaying is
- * postponed. */
- if (vim_strchr(p_go, GO_HORSCROLL) == NULL
- && curwin->w_topline <= curwin->w_cursor.lnum
- && curwin->w_botline > curwin->w_cursor.lnum
- && curwin->w_botline <= curbuf->b_ml.ml_line_count + 1)
- {
- linenr_T lnum;
- colnr_T n;
+ longest_lnum = gui_find_longest_lnum();
+ max = scroll_line_len(longest_lnum);
- /* Use maximum of all visible lines. Remember the lnum of the
- * longest line, clostest to the cursor line. Used when scrolling
- * below. */
- max = 0;
- for (lnum = curwin->w_topline; lnum < curwin->w_botline; ++lnum)
- {
- n = scroll_line_len(lnum);
- if (n > (colnr_T)max)
- {
- max = n;
- longest_lnum = lnum;
- }
- else if (n == (colnr_T)max
- && abs((int)(lnum - curwin->w_cursor.lnum))
- < abs((int)(longest_lnum - curwin->w_cursor.lnum)))
- longest_lnum = lnum;
- }
- }
- else
- /* Use cursor line only. */
- max = scroll_line_len(curwin->w_cursor.lnum);
#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
{
@@ -4442,26 +4466,33 @@ gui_update_horiz_scrollbar(force)
* Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise.
*/
int
-gui_do_horiz_scroll()
+gui_do_horiz_scroll(leftcol, compute_longest_lnum)
+ colnr_T leftcol;
+ int compute_longest_lnum;
{
/* no wrapping, no scrolling */
if (curwin->w_p_wrap)
return FALSE;
- if ((long_u)curwin->w_leftcol == scrollbar_value)
+ if (curwin->w_leftcol == leftcol)
return FALSE;
- curwin->w_leftcol = (colnr_T)scrollbar_value;
+ curwin->w_leftcol = leftcol;
/* When the line of the cursor is too short, move the cursor to the
- * longest visible line. Do a sanity check on "longest_lnum", just in
- * case. */
+ * longest visible line. */
if (vim_strchr(p_go, GO_HORSCROLL) == NULL
- && longest_lnum >= curwin->w_topline
- && longest_lnum < curwin->w_botline
- && !virtual_active())
+ && !virtual_active()
+ && leftcol > scroll_line_len(curwin->w_cursor.lnum))
{
- if (scrollbar_value > (long_u)scroll_line_len(curwin->w_cursor.lnum))
+ if (compute_longest_lnum)
+ {
+ curwin->w_cursor.lnum = gui_find_longest_lnum();
+ curwin->w_cursor.col = 0;
+ }
+ /* Do a sanity check on "longest_lnum", just in case. */
+ else if (longest_lnum >= curwin->w_topline
+ && longest_lnum < curwin->w_botline)
{
curwin->w_cursor.lnum = longest_lnum;
curwin->w_cursor.col = 0;
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index d8e2487382..2cde1ee490 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -1700,7 +1700,13 @@ scroll_event(GtkWidget *widget,
case GDK_SCROLL_DOWN:
button = MOUSE_5;
break;
- default: /* We don't care about left and right... Yet. */
+ case GDK_SCROLL_LEFT:
+ button = MOUSE_7;
+ break;
+ case GDK_SCROLL_RIGHT:
+ button = MOUSE_6;
+ break;
+ default: /* This shouldn't happen */
return FALSE;
}
diff --git a/src/keymap.h b/src/keymap.h
index 39837e554b..16d128a881 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -228,8 +228,13 @@ enum key_extra
, KE_S_XF3
, KE_S_XF4
+ /* NOTE: The scroll wheel events are inverted: i.e. UP is the same as
+ * moving the actual scroll wheel down, LEFT is the same as moving the
+ * scroll wheel right. */
, KE_MOUSEDOWN /* scroll wheel pseudo-button Down */
, KE_MOUSEUP /* scroll wheel pseudo-button Up */
+ , KE_MOUSELEFT /* scroll wheel pseudo-button Left */
+ , KE_MOUSERIGHT /* scroll wheel pseudo-button Right */
, KE_KINS /* keypad Insert key */
, KE_KDEL /* keypad Delete key */
@@ -440,6 +445,8 @@ enum key_extra
#define K_MOUSEDOWN TERMCAP2KEY(KS_EXTRA, KE_MOUSEDOWN)
#define K_MOUSEUP TERMCAP2KEY(KS_EXTRA, KE_MOUSEUP)
+#define K_MOUSELEFT TERMCAP2KEY(KS_EXTRA, KE_MOUSELEFT)
+#define K_MOUSERIGHT TERMCAP2KEY(KS_EXTRA, KE_MOUSERIGHT)
#define K_CSI TERMCAP2KEY(KS_EXTRA, KE_CSI)
#define K_SNR TERMCAP2KEY(KS_EXTRA, KE_SNR)
diff --git a/src/message.c b/src/message.c
index 7c94cbf8b2..3b1b458922 100644
--- a/src/message.c
+++ b/src/message.c
@@ -987,6 +987,7 @@ wait_return(redraw)
|| c == K_LEFTDRAG || c == K_LEFTRELEASE
|| c == K_MIDDLEDRAG || c == K_MIDDLERELEASE
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
+ || c == K_MOUSELEFT || c == K_MOUSERIGHT
|| c == K_MOUSEDOWN || c == K_MOUSEUP
|| (!mouse_has(MOUSE_RETURN)
&& mouse_row < msg_row
diff --git a/src/misc1.c b/src/misc1.c
index fb04fb6b72..9371760a47 100644
--- a/src/misc1.c
+++ b/