changeset 86101:27ff4954e2a0

(cua--pre-command-handler-1): Use input-decode-map instead of function-key-map. Use event-modifiers now that it works reliably.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 15 Nov 2007 16:36:03 +0000
parents ac69f23a84ce
children 79412c640bdf
files lisp/ChangeLog lisp/emulation/cua-base.el
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Nov 15 16:33:08 2007 +0000
+++ b/lisp/ChangeLog	Thu Nov 15 16:36:03 2007 +0000
@@ -1,5 +1,9 @@
 2007-11-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* emulation/cua-base.el (cua--pre-command-handler-1):
+	Use input-decode-map instead of function-key-map.
+	Use event-modifiers now that it works reliably.
+
 	* vc.el (vc-diff-internal): Pop-to-buffer later.
 
 	* subr.el (event-modifiers): Use internal-event-symbol-parse-modifiers.
--- a/lisp/emulation/cua-base.el	Thu Nov 15 16:33:08 2007 +0000
+++ b/lisp/emulation/cua-base.el	Thu Nov 15 16:36:03 2007 +0000
@@ -1225,22 +1225,26 @@
 
    ;; Handle shifted cursor keys and other movement commands.
    ;; If region is not active, region is activated if key is shifted.
-   ;; If region is active, region is cancelled if key is unshifted (and region not started with C-SPC).
-   ;; If rectangle is active, expand rectangle in specified direction and ignore the movement.
+   ;; If region is active, region is cancelled if key is unshifted
+   ;;   (and region not started with C-SPC).
+   ;; If rectangle is active, expand rectangle in specified direction and
+   ;;   ignore the movement.
    ((if window-system
+        ;; Shortcut for window-system, assuming that input-decode-map is empty.
 	(memq 'shift (event-modifiers
 		      (aref (this-single-command-raw-keys) 0)))
       (or
+       ;; Check if the final key-sequence was shifted.
        (memq 'shift (event-modifiers
 		     (aref (this-single-command-keys) 0)))
-       ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
-       (and (boundp 'local-function-key-map)
-	    local-function-key-map
-	    (let ((ev (lookup-key local-function-key-map
-				  (this-single-command-raw-keys))))
-	      (and (vector ev)
-		   (symbolp (setq ev (aref ev 0)))
-		   (string-match "S-" (symbol-name ev)))))))
+       ;; If not, maybe the raw key-sequence was mapped by input-decode-map
+       ;; to a shifted key (and then mapped down to its unshifted form).
+       (let* ((keys (this-single-command-raw-keys))
+              (ev (lookup-key input-decode-map keys)))
+         (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0))))
+             ;; Or maybe, the raw key-sequence was not an escape sequence
+             ;; and was shifted (and then mapped down to its unshifted form).
+             (memq 'shift (event-modifiers (aref keys 0)))))))
     (unless mark-active
       (push-mark-command nil t))
     (setq cua--last-region-shifted t)