unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
@ 2008-12-28 14:25 poppyer
  0 siblings, 0 replies; 9+ messages in thread
From: poppyer @ 2008-12-28 14:25 UTC (permalink / raw)
  To: emacs-pretest-bug


Under terminal (emacs -nw), the visual-line-mode maps the arrow key wrongly.
<up> -> A M-[
<down> -> B M-]
<left> -> D
<right> -> C
and it also maps the mouse-key of xterm-mouse-mode wrongly.


turn the visual-line-mode off will back everything to normal.



In GNU Emacs 23.0.60.1 (i386-apple-darwin9.6.0, NS apple-appkit-949.43)
 of 2008-12-25 on neutron.local
Windowing system distributor `Apple', version 97.112.112.108.101.45.97.112.112.107.105.116.45.57.52.57.46.51.53
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: zh_CN.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  recentf-mode: t
  which-function-mode: t
  show-paren-mode: t
  mouse-sel-mode: t
  global-hl-line-mode: t
  pinbar-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
[ C ESC [ C ESC [ C ESC [ D ESC [ D ESC [ D ESC [ D 
ESC [ D ESC [ D ESC [ D ESC [ D ESC [ D ESC [ D s RET 
C-x k ESC x r e TAB C-p ESC p RET ESC p ESC p ESC p 
ESC p ESC p ESC k v i s u a l - l i n e - m o d e SPC 
u n d e r SPC t e r m i n a l SPC ( - n w 0 DEL ) SPC 
m a k e s SPC a r r o w SPC k e y s SPC n o t SPC w 
o r k i n g C-a C-@ C-e ESC w C-e RET C-x k ESC x ESC 
p RET SPC RET C-x k C-h C-g C-x C-f ESC p C-g ESC x 
v i s u TAB C-g C-x C-f ESC p RET C-s v i s u a l C-e 
ESC [ D ESC [ D ESC [ D ESC [ D ESC [ D ESC [ D ESC 
[ D C-h f C-g ESC [ C DEL C-h f C-a C-g s C-a ESC [ 
C ESC [ C ESC [ C ESC [ C ESC DEL r e m o v e C-e C-x 
C-e C-a ESC [ C ESC [ C ESC [ C ESC [ C ESC [ C ESC 
[ C ESC [ C ESC DEL a d d C-e ESC [ D ESC [ D ESC [ 
D ESC [ D ESC [ D ESC [ D DEL C-a C-e C-n C-p C-x C-e 
C-a C-x C-s C-x k C-x C-f C-g ESC x ESC p RET







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
@ 2008-12-30 16:30 Chong Yidong
  2008-12-30 17:24 ` poppyer
  0 siblings, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2008-12-30 16:30 UTC (permalink / raw)
  To: poppyer; +Cc: 1721

> Under terminal (emacs -nw), the visual-line-mode maps the arrow key
> wrongly.
> <up> -> A M-[
> <down> -> B M-]
> <left> -> D
> <right> -> C
> and it also maps the mouse-key of xterm-mouse-mode wrongly.
>
> turn the visual-line-mode off will back everything to normal.

This bug report is unclear, and I can not reproduce any bug with
visual-line-mode under emacs -nw.  Please provide a *precise* recipe for
seeing this bug, starting with `emacs -Q -nw'.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-30 16:30 bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working Chong Yidong
@ 2008-12-30 17:24 ` poppyer
  2008-12-31  2:42   ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: poppyer @ 2008-12-30 17:24 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 1721


Chong Yidong <cyd@stupidchicken.com> writes:

>> Under terminal (emacs -nw), the visual-line-mode maps the arrow key
>> wrongly.
>> <up> -> A M-[
>> <down> -> B M-]
>> <left> -> D
>> <right> -> C
>> and it also maps the mouse-key of xterm-mouse-mode wrongly.
>>
>> turn the visual-line-mode off will back everything to normal.
>
> This bug report is unclear, and I can not reproduce any bug with
> visual-line-mode under emacs -nw.  Please provide a *precise* recipe for
> seeing this bug, starting with `emacs -Q -nw'.

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)
    map))
===========

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.


Cheers,
poppyer








^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-30 17:24 ` poppyer
@ 2008-12-31  2:42   ` Stefan Monnier
  2008-12-31  3:09     ` poppyer
  2008-12-31  9:09     ` Andreas Schwab
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2008-12-31  2:42 UTC (permalink / raw)
  To: poppyer; +Cc: Chong Yidong, 1721

> 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)
>     map))
> ===========

> 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)?

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?


        Stefan






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-31  2:42   ` Stefan Monnier
@ 2008-12-31  3:09     ` poppyer
  2008-12-31  9:09     ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: poppyer @ 2008-12-31  3:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, 1721


Stefan Monnier <monnier@iro.umontreal.ca> 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)
>>     map))
>> ===========
>
>> 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


Thanks,
poppyer






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-31  2:42   ` Stefan Monnier
  2008-12-31  3:09     ` poppyer
@ 2008-12-31  9:09     ` Andreas Schwab
  2008-12-31 18:30       ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2008-12-31  9:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, poppyer, 1721

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Also, the terminals to which I have access use difference sequences than
> the ones you show (which do ring a bell, tho).

Even xterm uses ESC [ for the function keys.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-31  9:09     ` Andreas Schwab
@ 2008-12-31 18:30       ` Stefan Monnier
  2008-12-31 19:26         ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2008-12-31 18:30 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Chong Yidong, poppyer, 1721

>> Also, the terminals to which I have access use difference sequences than
>> the ones you show (which do ring a bell, tho).
> Even xterm uses ESC [ for the function keys.

I believe you, I just don't know when: mine uses ESC O A, ESC O D, ...


        Stefan






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-31 18:30       ` Stefan Monnier
@ 2008-12-31 19:26         ` Andreas Schwab
  2009-01-02  4:02           ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2008-12-31 19:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, poppyer, 1721

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> Also, the terminals to which I have access use difference sequences than
>>> the ones you show (which do ring a bell, tho).
>> Even xterm uses ESC [ for the function keys.
>
> I believe you, I just don't know when: mine uses ESC O A, ESC O D, ...

That's why I wrote "function keys".

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working
  2008-12-31 19:26         ` Andreas Schwab
@ 2009-01-02  4:02           ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2009-01-02  4:02 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Chong Yidong, poppyer, 1721

>>>> Also, the terminals to which I have access use difference sequences than
>>>> the ones you show (which do ring a bell, tho).
>>> Even xterm uses ESC [ for the function keys.
>> I believe you, I just don't know when: mine uses ESC O A, ESC O D, ...
> That's why I wrote "function keys".

Ah, I see.  Yes, as written, I agree with the fact that M-[ should be
avoided since it's used as escape sequence.


        Stefan






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-01-02  4:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-30 16:30 bug#1721: 23.0.60; visual-line-mode under terminal (-nw) makes arrow keys not working Chong Yidong
2008-12-30 17:24 ` poppyer
2008-12-31  2:42   ` Stefan Monnier
2008-12-31  3:09     ` poppyer
2008-12-31  9:09     ` Andreas Schwab
2008-12-31 18:30       ` Stefan Monnier
2008-12-31 19:26         ` Andreas Schwab
2009-01-02  4:02           ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2008-12-28 14:25 poppyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).