diff options
| author | Karl Heuer | 1997-05-29 16:44:27 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-05-29 16:44:27 +0000 |
| commit | 351d52f7198aa97d8eb6dd4a58d363d9a499d2d4 (patch) | |
| tree | d603b414fc94645d6f364d385a928de90a2a8bb7 /lisp | |
| parent | ac6e572cb99aff9ff489dd1b851e46c64f1bf6c1 (diff) | |
| download | emacs-351d52f7198aa97d8eb6dd4a58d363d9a499d2d4.tar.gz emacs-351d52f7198aa97d8eb6dd4a58d363d9a499d2d4.zip | |
* mouse-drag.el (mouse-drag-electric-col-scrolling): New variable;
auto-enables horizontal scrolling when clicks on wrapped
lines occur.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/mouse-drag.el | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el index a16b83ea186..e49bf36b17f 100644 --- a/lisp/mouse-drag.el +++ b/lisp/mouse-drag.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; mouse-drag.el --- use mouse-2 to do a new style of scrolling | 1 | ;;; mouse-drag.el --- use mouse-2 to do a new style of scrolling |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Heidemann <johnh@ISI.EDU> | 5 | ;; Author: John Heidemann <johnh@ISI.EDU> |
| 6 | ;; Keywords: mouse | 6 | ;; Keywords: mouse |
| @@ -61,6 +61,8 @@ | |||
| 61 | ;;; | 61 | ;;; |
| 62 | ;;; - reverse the throw-scroll direction with \\[mouse-throw-with-scroll-bar] | 62 | ;;; - reverse the throw-scroll direction with \\[mouse-throw-with-scroll-bar] |
| 63 | ;;; - work around a bug with \\[mouse-extras-work-around-drag-bug] | 63 | ;;; - work around a bug with \\[mouse-extras-work-around-drag-bug] |
| 64 | ;;; - auto-enable horizontal scrolling with | ||
| 65 | ;;; \\[mouse-drag-electric-col-scrolling] | ||
| 64 | ;;; | 66 | ;;; |
| 65 | ;;; | 67 | ;;; |
| 66 | ;;; History and related work: | 68 | ;;; History and related work: |
| @@ -91,20 +93,11 @@ | |||
| 91 | ;;; -johnh@isi.edu, 11-Jul-96 | 93 | ;;; -johnh@isi.edu, 11-Jul-96 |
| 92 | ;;; | 94 | ;;; |
| 93 | ;;; | 95 | ;;; |
| 94 | ;;; Old changes, for reference: | 96 | ;;; What's new with mouse-drag 2.24? |
| 95 | ;;; | 97 | ;;; |
| 96 | ;;; What's new with mouse-extras 2.21? | 98 | ;;; - mouse-drag-electric-col-scrolling (default: on) |
| 97 | ;;; | 99 | ;;; auto-enables horizontal scrolling when clicks on wrapped |
| 98 | ;;; - support for emacs-19.{29,30} | 100 | ;;; lines occur |
| 99 | ;;; - point now stays on the visible screen during horizontal scrolling | ||
| 100 | ;;; (bug identified and fix suggested by Tom Wurgler <twurgler@goodyear.com>) | ||
| 101 | ;;; - better work-around for lost-mouse-events bug (supports double/triple | ||
| 102 | ;;; clicks), see \\[mouse-extras-work-around-drag-bug] for details. | ||
| 103 | ;;; - work-around for lost-mouse-events bug now is OFF by default; | ||
| 104 | ;;; enable it if you have problems | ||
| 105 | ;;; | ||
| 106 | |||
| 107 | |||
| 108 | 101 | ||
| 109 | ;;; Code: | 102 | ;;; Code: |
| 110 | 103 | ||
| @@ -155,11 +148,24 @@ Keep the cursor on the screen as needed." | |||
| 155 | (= (car start-col-row) (car end-col-row)) | 148 | (= (car start-col-row) (car end-col-row)) |
| 156 | (= (cdr start-col-row) (cdr end-col-row))))) | 149 | (= (cdr start-col-row) (cdr end-col-row))))) |
| 157 | 150 | ||
| 151 | (defvar mouse-drag-electric-col-scrolling t | ||
| 152 | "If non-nil, mouse-drag on a long line enables truncate-lines.") | ||
| 153 | |||
| 158 | (defun mouse-drag-should-do-col-scrolling () | 154 | (defun mouse-drag-should-do-col-scrolling () |
| 159 | "* Determine if it's wise to enable col-scrolling for the current window." | 155 | "* Determine if it's wise to enable col-scrolling for the current window. |
| 156 | Basically, we check for existing horizontal scrolling." | ||
| 160 | (or truncate-lines | 157 | (or truncate-lines |
| 161 | (> (window-hscroll (selected-window)) 0) | 158 | (> (window-hscroll (selected-window)) 0) |
| 162 | (< (window-width) (screen-width)))) | 159 | (< (window-width) (screen-width)) |
| 160 | (and | ||
| 161 | mouse-drag-electric-col-scrolling | ||
| 162 | (save-excursion ;; on a long line? | ||
| 163 | (let | ||
| 164 | ((beg (progn (beginning-of-line) (point))) | ||
| 165 | (end (progn (end-of-line) (point)))) | ||
| 166 | (if (> (- end beg) (window-width)) | ||
| 167 | (setq truncate-lines t) | ||
| 168 | nil)))))) | ||
| 163 | 169 | ||
| 164 | (defvar mouse-throw-with-scroll-bar nil | 170 | (defvar mouse-throw-with-scroll-bar nil |
| 165 | "* Set direction of mouse-throwing. | 171 | "* Set direction of mouse-throwing. |