[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow key
bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
Wed, 31 Dec 2008 11:09:33 +0800
Stefan Monnier <address@hidden> writes:
>> I think I have got the idea. It is because visual-line-mode maps "M-["
>> to previous-logical-line as in simple.el
>> (defvar visual-line-mode-map
>> (let ((map (make-sparse-keymap)))
>> (define-key map [remap kill-line] 'kill-visual-line)
>> (define-key map [remap move-beginning-of-line] 'beginning-of-visual-line)
>> (define-key map [remap move-end-of-line] 'end-of-visual-line)
>> (define-key map "\M-[" 'previous-logical-line)
>> (define-key map "\M-]" 'next-logical-line)
>> But in terminal (-nw), arrow keys are actually "M-[ A" "M-[ B" "M-[ C"
>> "M-[ D". Hence letters "A" "B" "C" "D" will be inserted to the buffer.
>> To prove my idea, I tried:
>> (define-key visual-line-mode-map "\M-[" nil)
>> (define-key visual-line-mode-map "\M-]" nil)
>> and the issue is solved.
> That looks like a problem indeed. This said, since Emacs-23 uses
> input-decode-map rather than function-key-map to decode M-[ A into an
> arrow key, it should take precedence to the binding in
> visual-line-mode-map. Can you check input-decode-map and
> function-key-map to make sure that the mapping from escape sequence to
> arrow key events is at the right place (i.e. not in function-key-map)?
Yes, they are in input-decode-map and not in function-key-map
> Also, the terminals to which I have access use difference sequences than
> the ones you show (which do ring a bell, tho). Could you give us some
> details about the terminal you're using and its configuration?
I am using iTerm.app (http://iterm.sourceforge.net/) under MAC