퍼티를 사용할 때 byobu가 구성 파일에서 자동 시작될 때 alt-left/right가 다릅니다.

퍼티를 사용할 때 byobu가 구성 파일에서 자동 시작될 때 alt-left/right가 다릅니다.

Windows 시스템에서 Putty를 사용하여 Debian 및 Ubuntu 시스템에 대한 세션을 시작하는 경우(적어도 내 경우에는) alt-left/right명령줄에서 단어 단위로 이동하는 것과 같습니다. (일반적으로 이는 Linux 시스템에서도 달성할 수 있습니다 ctr-left/right.)

하지만 Byobu를 사용하기 시작하면서그리고F9 메뉴를 사용하여 Byobu가 자동으로 시작되도록 설정한 후에는 이 기능이 alt-left/right더 이상 작동하지 않습니다. 대조적으로, Ctrl-V원시 문자를 출력하는 데 사용할 경우,

 ^[[1;3C

- 보낼 때 alt-right. 그러나 byobu가 로그인 시 자동으로 시작되지 않고 로그인 후 수동으로 시작되면 다음과 같은 메시지가 전송되는 것으로 추론됩니다.

^[^[[C

기본 inputrc 구성으로 캡처되므로 단어 단위로 이동하도록 변환됩니다.

수신된 명령에서 이러한 차이를 생성할 수 있는 Putty, 호스트/터미널/byobu 간의 메커니즘은 무엇입니까?

답변1

byobu는 여러분이 보고 있는 동작을 담당하는 tmux를 둘러싼 래퍼일 뿐입니다. tmux는 "key"를 xterm이 수정된 특수 키를 인코딩하는 일련의 문자로 변환하려고 합니다. 설명서에는 다음과 같이 설명되어 있습니다.

         xterm-keys [on | off]
                 If this option is set, tmux will generate xterm(1) -style
                 function key sequences; these have a number included to
                 indicate modifiers such as Shift, Alt or Ctrl.  The
                 default is off.

새/최신 버전에서는 기본값이 다음과 같이 보고됩니다.존재하다. 이로 인해 다음 커밋 메시지에서 볼 수 있는 문제가 노출되었습니다.

commit d52f579fd5e7fd21d7dcf837780cbf98498b10ce
Author: nicm <nicm>
Date:   Sun May 7 21:25:59 2017 +0000

    Up to now, tmux sees \033\033[OA as M-Up and since we turned on
    xterm-keys by default, generates \033[1;3A instead of
    \033\033[OA. Unfortunately this confuses vi, which doesn't understand
    xterm keys and now sees Escape+Up pressed within escape-time as Escape
    followed by A.

    The issue doesn't happen in xterm itself because it gets the keys from X
    and can distinguish between a genuine M-Up and Escape+Up.

    Because xterm can, tmux can too: xterm will give us \033[1;3A (that is,
    kUP3) for a real M-Up and \033\033OA for Escape+Up - in fact, we can be
    sure any \033 preceding an xterm key is a real Escape key press because
    Meta would be part of the xterm key instead of a separate \033.

    So change tmux to recognise both sequences as M-Up for its own purposes,
    but generate the xterm version of M-Up only if it originally received
    the xterm version from the terminal.

    This means we will return to sending \033\033OA instead of the xterm key
    for terminals that do not support xterm keys themselves, but there is no
    practical way around this because they do not allow us to distinguish
    between Escape+Up and M-Up. xterm style escape sequences are now the de
    facto standard for these keys in any case.

    Problem reported by jsing@ and subsequently by Cecile Tonglet in GitHub
    issue 907.

관련 정보