Horizontal scrolling for mouse wheel with Shift modifier (bug#43568)
* lisp/mwheel.el (mouse-wheel-scroll-amount): Change 'shift' default value from 5 to 'hscroll'. Add new option "Scroll horizontally" for 'hscroll'. (mwheel-scroll): Handle value 'hscroll' and call mwheel-scroll-left-function or mwheel-scroll-right-function. * doc/emacs/frames.texi (Mouse Commands): Update for horizontal scrolling with Shift modifier.
This commit is contained in:
parent
89dd8cd215
commit
1e7f636576
4 changed files with 33 additions and 16 deletions
|
@ -214,22 +214,24 @@ speed is linked to how fast you move the wheel. This mode also
|
|||
supports increasing or decreasing the height of the default face, by
|
||||
default bound to scrolling with the @key{Ctrl} modifier.
|
||||
|
||||
Emacs also supports horizontal scrolling with the @key{Shift} modifier.
|
||||
|
||||
@vindex mouse-wheel-tilt-scroll
|
||||
@vindex mouse-wheel-flip-direction
|
||||
Emacs can also support horizontal scrolling if your mouse's wheel can
|
||||
be tilted, or if your touchpad supports it. This feature is off by
|
||||
default; the variable @code{mouse-wheel-tilt-scroll} turns it on, if
|
||||
you customize it to a non-@code{nil} value. By default, tilting the
|
||||
mouse wheel scrolls the window's view horizontally in the direction of
|
||||
the tilt: e.g., tilting to the right scrolls the window to the right,
|
||||
so that the text displayed in the window moves horizontally to the
|
||||
left. If you'd like to reverse the direction of horizontal scrolling,
|
||||
customize the variable @code{mouse-wheel-flip-direction} to a
|
||||
non-@code{nil} value.
|
||||
If your mouse's wheel can be tilted, or if your touchpad supports it,
|
||||
then you can also enable horizontal scrolling by customizing the
|
||||
variable @code{mouse-wheel-tilt-scroll} to a non-@code{nil} value.
|
||||
By default, tilting the mouse wheel scrolls the window's view
|
||||
horizontally in the direction of the tilt: e.g., tilting to the right
|
||||
scrolls the window to the right, so that the text displayed in the
|
||||
window moves horizontally to the left. If you'd like to reverse the
|
||||
direction of horizontal scrolling, customize the variable
|
||||
@code{mouse-wheel-flip-direction} to a non-@code{nil} value.
|
||||
|
||||
When the mouse pointer is over an image in Image mode, @pxref{Image Mode},
|
||||
scrolling the mouse wheel with the @key{Ctrl} modifier scales the image
|
||||
under the mouse pointer.
|
||||
under the mouse pointer, and scrolling the mouse wheel with the
|
||||
@key{Shift} modifier scrolls the image horizontally.
|
||||
|
||||
|
||||
@node Word and Line Mouse
|
||||
|
|
5
etc/NEWS
5
etc/NEWS
|
@ -136,7 +136,10 @@ displays.)
|
|||
|
||||
---
|
||||
** Mouse wheel scrolling now defaults to one line at a time.
|
||||
Old default of five lines at a time is now bound to Shift modifier.
|
||||
|
||||
+++
|
||||
** Mouse wheel scrolling with Shift modifier now scrolls horizontally.
|
||||
This works in text buffers and over images.
|
||||
|
||||
---
|
||||
** The default value of 'frame-title-format' and 'icon-title-format' has changed.
|
||||
|
|
2
etc/TODO
2
etc/TODO
|
@ -924,7 +924,7 @@ features of that interface could be implemented NS.
|
|||
|
||||
**** Smooth scrolling -- maybe not a good idea
|
||||
Today, by default, scrolling with a trackpad makes the text move in
|
||||
steps of one line. (Scrolling with SHIFT scrolls five lines at a time.)
|
||||
steps of one line. (Scrolling with SHIFT scrolls horizontally.)
|
||||
|
||||
The "mac" port provides smooth, pixel-based, scrolling. This is a very
|
||||
popular feature. However, there are drawbacks to this method: what
|
||||
|
|
|
@ -85,7 +85,7 @@ set to the event sent when clicking on the mouse wheel button."
|
|||
:type 'number)
|
||||
|
||||
(defcustom mouse-wheel-scroll-amount
|
||||
'(1 ((shift) . 5) ((meta) . nil) ((control) . text-scale))
|
||||
'(1 ((shift) . hscroll) ((meta) . nil) ((control) . text-scale))
|
||||
"Amount to scroll windows by when spinning the mouse wheel.
|
||||
This is an alist mapping the modifier key to the amount to scroll when
|
||||
the wheel is moved with the modifier key depressed.
|
||||
|
@ -97,6 +97,9 @@ screen. It can also be a floating point number, specifying the fraction of
|
|||
a full screen to scroll. A near full screen is `next-screen-context-lines'
|
||||
less than a full screen.
|
||||
|
||||
If AMOUNT is the symbol 'hscroll', this means that with MODIFIER,
|
||||
the mouse wheel will scroll horizontally instead of vertically.
|
||||
|
||||
If AMOUNT is the symbol text-scale, this means that with
|
||||
MODIFIER, the mouse wheel will change the face height instead of
|
||||
scrolling."
|
||||
|
@ -123,6 +126,7 @@ scrolling."
|
|||
(const :tag "Scroll full screen" :value nil)
|
||||
(integer :tag "Scroll specific # of lines")
|
||||
(float :tag "Scroll fraction of window")
|
||||
(const :tag "Scroll horizontally" :value hscroll)
|
||||
(const :tag "Change face size" :value text-scale)))))
|
||||
:set 'mouse-wheel-change-button
|
||||
:version "28.1")
|
||||
|
@ -270,7 +274,11 @@ non-Windows systems."
|
|||
(condition-case nil
|
||||
(unwind-protect
|
||||
(let ((button (mwheel-event-button event)))
|
||||
(cond ((eq button mouse-wheel-down-event)
|
||||
(cond ((and (eq amt 'hscroll) (eq button mouse-wheel-down-event))
|
||||
(funcall (if mouse-wheel-flip-direction
|
||||
mwheel-scroll-left-function
|
||||
mwheel-scroll-right-function) 1))
|
||||
((eq button mouse-wheel-down-event)
|
||||
(condition-case nil (funcall mwheel-scroll-down-function amt)
|
||||
;; Make sure we do indeed scroll to the beginning of
|
||||
;; the buffer.
|
||||
|
@ -285,7 +293,11 @@ non-Windows systems."
|
|||
;; for a reason that escapes me. This problem seems
|
||||
;; to only affect scroll-down. --Stef
|
||||
(set-window-start (selected-window) (point-min))))))
|
||||
((eq button mouse-wheel-up-event)
|
||||
((and (eq amt 'hscroll) (eq button mouse-wheel-up-event))
|
||||
(funcall (if mouse-wheel-flip-direction
|
||||
mwheel-scroll-right-function
|
||||
mwheel-scroll-left-function) 1))
|
||||
((eq button mouse-wheel-up-event)
|
||||
(condition-case nil (funcall mwheel-scroll-up-function amt)
|
||||
;; Make sure we do indeed scroll to the end of the buffer.
|
||||
(end-of-buffer (while t (funcall mwheel-scroll-up-function)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue