Mercurial > emacs
comparison lisp/emulation/cua-base.el @ 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 | 16efb39cdb2e |
children | 79412c640bdf |
comparison
equal
deleted
inserted
replaced
86100:ac69f23a84ce | 86101:27ff4954e2a0 |
---|---|
1223 (setq this-original-command this-command | 1223 (setq this-original-command this-command |
1224 this-command nc))))) | 1224 this-command nc))))) |
1225 | 1225 |
1226 ;; Handle shifted cursor keys and other movement commands. | 1226 ;; Handle shifted cursor keys and other movement commands. |
1227 ;; If region is not active, region is activated if key is shifted. | 1227 ;; If region is not active, region is activated if key is shifted. |
1228 ;; If region is active, region is cancelled if key is unshifted (and region not started with C-SPC). | 1228 ;; If region is active, region is cancelled if key is unshifted |
1229 ;; If rectangle is active, expand rectangle in specified direction and ignore the movement. | 1229 ;; (and region not started with C-SPC). |
1230 ;; If rectangle is active, expand rectangle in specified direction and | |
1231 ;; ignore the movement. | |
1230 ((if window-system | 1232 ((if window-system |
1233 ;; Shortcut for window-system, assuming that input-decode-map is empty. | |
1231 (memq 'shift (event-modifiers | 1234 (memq 'shift (event-modifiers |
1232 (aref (this-single-command-raw-keys) 0))) | 1235 (aref (this-single-command-raw-keys) 0))) |
1233 (or | 1236 (or |
1237 ;; Check if the final key-sequence was shifted. | |
1234 (memq 'shift (event-modifiers | 1238 (memq 'shift (event-modifiers |
1235 (aref (this-single-command-keys) 0))) | 1239 (aref (this-single-command-keys) 0))) |
1236 ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home. | 1240 ;; If not, maybe the raw key-sequence was mapped by input-decode-map |
1237 (and (boundp 'local-function-key-map) | 1241 ;; to a shifted key (and then mapped down to its unshifted form). |
1238 local-function-key-map | 1242 (let* ((keys (this-single-command-raw-keys)) |
1239 (let ((ev (lookup-key local-function-key-map | 1243 (ev (lookup-key input-decode-map keys))) |
1240 (this-single-command-raw-keys)))) | 1244 (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0)))) |
1241 (and (vector ev) | 1245 ;; Or maybe, the raw key-sequence was not an escape sequence |
1242 (symbolp (setq ev (aref ev 0))) | 1246 ;; and was shifted (and then mapped down to its unshifted form). |
1243 (string-match "S-" (symbol-name ev))))))) | 1247 (memq 'shift (event-modifiers (aref keys 0))))))) |
1244 (unless mark-active | 1248 (unless mark-active |
1245 (push-mark-command nil t)) | 1249 (push-mark-command nil t)) |
1246 (setq cua--last-region-shifted t) | 1250 (setq cua--last-region-shifted t) |
1247 (setq cua--explicit-region-start nil)) | 1251 (setq cua--explicit-region-start nil)) |
1248 | 1252 |