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

Bug#920287: Shift-Tab doesn't work in text mode



Package: console-setup
Version: 1.188
Severity: important
Tags: patch upstream

Shift-Tab doesn't work in text mode so for example, in the debian installer or
openSUSE's YaST, pressing Tab goes to the next focusable item but pressing
Shift-Tab (which should go to the previous focusable item) just works as if only
Tab was pressed.

This is due to ISO_Left_Tab being translated just to Tab by ckbcomp when
converting the text layouts.

Looking at how the keyboard layouts were defined before xkb layouts were parsed,
I noticed legacy layouts were defined like:

```
keycode 15 = Tab
    shift  keycode 15 = Meta_Tab
```

The attached patch changes ckbcomp to translate ISO_Left_Tab to Meta_Tab fixing
the issue for Yast and I guess also for the debian installer (in openSUSE the
kbd package has to be rebuilt with the fixed console-setup package, and in
debian I think the console-data package has to be rebuilt the same way too)

Note that I also submitted a merge request at
https://salsa.debian.org/installer-team/console-setup/merge_requests/1
with the same patch and the commit log explains more about the issue.

>From 564f2dfbe9661df5094a0107568878d405fc2fae Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larrosa@gmail.com>
Date: Tue, 22 Jan 2019 18:06:28 +0100
Subject: [PATCH] Translate ISO_Left_Tab to Meta_Tab

Short description:
ISO_Left_Tab shouldn't be translated to Tab (just like regular Tab)
otherwise there's no way to differentiate between Tab and Shift-Tab
on text mode. This commit changes ckbcomp to translate ISO_Left_Tab
to Meta_Tab.

Long description:
Currently, in most Linux distribution, most keyboard layouts in text
mode assign the Tab and Shift-Tab key presses the same code.
This can be checked by pressing ctrl-alt-f1, logging in and running:
"showkey -a"

Pressing Tab and Shift-Tab generate the same code (0x09), so for
example, when Yast runs with ncurses, Tab moves the focus to the next
focusable item, but Shift-Tab can't be used as it behaves just like
Tab and there's no way applications can differentiate both.

Changing the keyboard layout with "loadkeys es", "loadkeys de" or
"loadkeys fr" doesn't help.

I investigated this and found that ckbcomp was translating the
ISO_Left_Tab symbol to Tab just like it does with Tab, which doesn't
make sense since Shift-Tab should produce a "Left Tab" (in many
keyboards it's even printed in the Tab key over the regular Right-Tab
drawing).

Looking at how the keyboard layouts were defined before xkb layouts
were parsed, I noticed legacy layouts were defined like:

keycode 15 = Tab
    shift  keycode 15 = Meta_Tab

So ISO_Left_Tab is now translated to Meta_Tab to fix this and let it
generate the same code it did in the past.

Now "showkey -a" shows the (0x09) code for Tab and (0x1b 0x09) for
Shift-Tab which can be recognized by text applications as different
and automatically fixes Yast.

In SUSE/openSUSE distributions, after applying this change and
rebuilding the kbd package with the generated console-setup (which
regenerates the kbd keymaps with the fixed ckbcomp script) fixes this.
I guess other distributions would also need to rebuild kbd after
applying this patch.
---
 Keyboard/ckbcomp            | 2 +-
 Keyboard/compose_translator | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Keyboard/ckbcomp b/Keyboard/ckbcomp
index b0df606..47ec922 100755
--- a/Keyboard/ckbcomp
+++ b/Keyboard/ckbcomp
@@ -2581,7 +2581,7 @@ if ($freebsd) {
          'any' => 'NoSymbol', # Is this recognised by X ?
          'VoidSymbol' => 'VoidSymbol',
          'voidsymbol' => 'VoidSymbol', # Is this recognised by X ?
-         'ISO_Left_Tab' => 'Tab',
+         'ISO_Left_Tab' => 'Meta_Tab',
          'Clear' => 'VoidSymbol',
          'Pause' => 'Pause',
          'Scroll_Lock' => 'Scroll_Lock',
diff --git a/Keyboard/compose_translator b/Keyboard/compose_translator
index d478def..3af492f 100755
--- a/Keyboard/compose_translator
+++ b/Keyboard/compose_translator
@@ -1827,7 +1827,7 @@ my %xkbsym_table = (
      'any' => 'NoSymbol', # Is this recognised by X ?
      'VoidSymbol' => 'VoidSymbol',
      'voidsymbol' => 'VoidSymbol', # Is this recognised by X ?
-     'ISO_Left_Tab' => 'Tab',
+     'ISO_Left_Tab' => 'Meta_Tab',
      'Clear' => 'VoidSymbol',
      'Pause' => 'Pause',
      'Scroll_Lock' => 'Scroll_Lock',
-- 
2.20.1


Reply to: