emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dan Nicolaescu] S-arrow_keys not working in cua-selection-mode anym


From: Kim F. Storm
Subject: Re: [Dan Nicolaescu] S-arrow_keys not working in cua-selection-mode anymore
Date: Wed, 14 Nov 2007 12:45:29 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> CUA normally works by looking for a shift modifier on the event,
>> but it has special code to handle a non-windowing system:
>
>>    ((if window-system
>>      (memq 'shift (event-modifiers
>>                    (aref (this-single-command-raw-keys) 0)))
>>       (or
>>        (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)))))))
>
>
> Oh, indeed, sorry for not catching this.  It should use input-decode-map
> rather than local-function-key-map.  

Ok.  Could someone please make the change (trunk only!!).  Thanks!

>                                      It may be even better to *also*
> check local-function-key-map (after input-decode-map), but it shouldn't
> be necessary.

Huh?  It may be better ... but not necessary ??

> This said, I'm not quite sure I understand enough of the above code:
> why does it need to behave differently depending on window-system?

The problem is to get around the implicit translation of "Shift-XXX" to
"XXX" if "Shift-XXX" has no specific binding.

On a window-system, this-single-command-raw-keys returns the untranslated
keys, so I can use it to check directly if user pressed a shifted key.

The problem is (or was??) how to test for a shifted function key
on a non-window system.

Suppose S-up sends "ESC A B" in xterm.

Then this-single-command-raw-keys returns [27 65 66].
This is not useful.

And this-single-command-keys returns [up].
This is not useful either.

So the only way is to go back to the raw key sequence and look it up
in the function key translation map to see if the result is a shifted key.

If you have a better way of checking this, I'm listening :-)


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]