From 588da98df9f10af25821d249343a462a2e9f8443 Mon Sep 17 00:00:00 2001 From: Terry Wang Date: Tue, 17 Nov 2026 07:08:17 +0000 Subject: [PATCH 1/3] feat: latch Shift in the extra-keys row (#31) Add a Shift key beside Ctrl and Alt so touch users can send Shift+arrow and other Shift chords (e.g. Codex's Shift+Left). The native core already forwards the Shift bit to Herdr; the only gap was sendText, which kept a Shift-only latch alive after a typed character. A latched Shift now upper-cases a single typed character and is consumed like Ctrl and Alt. --- README.md | 7 +++--- .../app/bellterm/ui/terminal/ExtraKeys.kt | 3 ++- .../app/bellterm/ui/terminal/TerminalView.kt | 13 ++++++++--- native/src/input/tests.rs | 23 +++++++++++++++++++ site/index.html | 4 ++-- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5352c8f..1a5f1bd 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,10 @@ Android conventions it follows: A foreground-service notification shows the attachment, with **Disconnect**. - The soft keyboard types straight into the focused pane: no suggestions or autocorrect, and CJK input methods compose in place at the cursor. -- An extra-keys row sits above the keyboard: Esc, Tab, latching **Ctrl** and - **Alt** for the next key, arrows and paging keys that repeat while held, and - symbols phone keyboards hide. +- An extra-keys row sits above the keyboard: Esc, Tab, latching **Shift**, + **Ctrl** and **Alt** for the next key (they combine, e.g. Shift+← or + Ctrl+Shift+→), arrows and paging keys that repeat while held, and symbols + phone keyboards hide. - Drag or fling to scroll a pane, pinch to change the font size, long-press to select text with the system **Copy / Paste** toolbar. The bell can vibrate, and the screen can stay on during a session. diff --git a/app/src/main/java/app/bellterm/ui/terminal/ExtraKeys.kt b/app/src/main/java/app/bellterm/ui/terminal/ExtraKeys.kt index cd081e6..a8a31a2 100644 --- a/app/src/main/java/app/bellterm/ui/terminal/ExtraKeys.kt +++ b/app/src/main/java/app/bellterm/ui/terminal/ExtraKeys.kt @@ -59,6 +59,7 @@ sealed interface ExtraKey { val DefaultExtraKeys: List = listOf( ExtraKey.Key("Esc", KeyEvent.KEYCODE_ESCAPE), ExtraKey.Key("Tab", KeyEvent.KEYCODE_TAB), + ExtraKey.Modifier("Shift", KeyEvent.META_SHIFT_ON), ExtraKey.Modifier("Ctrl", KeyEvent.META_CTRL_ON), ExtraKey.Modifier("Alt", KeyEvent.META_ALT_ON), ExtraKey.Key("←", KeyEvent.KEYCODE_DPAD_LEFT, repeats = true), @@ -76,7 +77,7 @@ val DefaultExtraKeys: List = listOf( ) /** - * The row of keys a phone keyboard lacks. Ctrl and Alt latch for the next key + * The row of keys a phone keyboard lacks. Shift, Ctrl and Alt latch for the next key * or character, as on Termux; arrows and paging keys repeat while held. Keys * are small glass caps; a latched modifier fills with the session's [accent]. */ diff --git a/app/src/main/java/app/bellterm/ui/terminal/TerminalView.kt b/app/src/main/java/app/bellterm/ui/terminal/TerminalView.kt index 369944d..be76bb2 100644 --- a/app/src/main/java/app/bellterm/ui/terminal/TerminalView.kt +++ b/app/src/main/java/app/bellterm/ui/terminal/TerminalView.kt @@ -44,7 +44,7 @@ class TerminalView(context: Context) : View(context) { fun onCopy(startColumn: Int, startRow: Int, endColumn: Int, endRow: Int) fun onPaste() fun onFontSize(sp: Float) - /** Ctrl or Alt latched by the extra-keys row was used up. */ + /** Shift, Ctrl or Alt latched by the extra-keys row was used up. */ fun onModifiersConsumed() } @@ -507,8 +507,14 @@ class TerminalView(context: Context) : View(context) { private fun sendText(text: String) { if (text.isEmpty()) return val meta = latchedMeta - if (meta and (KEY_CTRL or KEY_ALT) != 0 && text.codePointCount(0, text.length) == 1) { - listener?.onChord(text.codePointAt(0), meta) + if (meta != 0 && text.codePointCount(0, text.length) == 1) { + var codepoint = text.codePointAt(0) + if (meta and KEY_SHIFT != 0) codepoint = Character.toUpperCase(codepoint) + if (meta and (KEY_CTRL or KEY_ALT) != 0) { + listener?.onChord(codepoint, meta) + } else { + listener?.onText(String(Character.toChars(codepoint))) + } consumeLatch() return } @@ -571,6 +577,7 @@ class TerminalView(context: Context) : View(context) { companion object { const val MIN_FONT_SP = 7f const val MAX_FONT_SP = 32f + private const val KEY_SHIFT = KeyEvent.META_SHIFT_ON private const val KEY_CTRL = KeyEvent.META_CTRL_ON private const val KEY_ALT = KeyEvent.META_ALT_ON private const val KeyCharacterMapCombining = android.view.KeyCharacterMap.COMBINING_ACCENT diff --git a/native/src/input/tests.rs b/native/src/input/tests.rs index cb2b249..8686d02 100644 --- a/native/src/input/tests.rs +++ b/native/src/input/tests.rs @@ -128,3 +128,26 @@ fn touches_become_clicks_and_wheel_steps() { }] )); } + +#[test] +fn shift_reaches_navigation_keys() { + let left = key( + keycode::DPAD_LEFT, + Modifiers::from_meta_state(0x1), + None, + false, + ) + .unwrap(); + assert_eq!(code(&left), (&ClientKeyCode::Left, Modifiers::SHIFT)); + let both = key( + keycode::DPAD_LEFT, + Modifiers::from_meta_state(0x1 | 0x1000), + None, + false, + ) + .unwrap(); + assert_eq!( + code(&both), + (&ClientKeyCode::Left, Modifiers::SHIFT | Modifiers::CTRL) + ); +} diff --git a/site/index.html b/site/index.html index a091e9e..d384297 100644 --- a/site/index.html +++ b/site/index.html @@ -99,7 +99,7 @@

Your agents.
Your phone.
In sync.

›
- EscTabCtrlAlt←↓↑→ + EscTabShiftCtrlAlt←↓↑→
@@ -184,7 +184,7 @@

Agents

Terminal

  • libghostty-vt for graphemes, wide characters, and colour.
  • -
  • An extra-keys row with Esc, Tab, latching Ctrl and Alt, and repeating arrows.
  • +
  • An extra-keys row with Esc, Tab, latching Shift, Ctrl and Alt, and repeating arrows.
  • CJK input composes in place at the cursor. Hardware keyboards work too.
  • Nerd Font icons, ten colour schemes, pinch to zoom, long-press to copy.
From 578f2f9c4085d5e047a6efc028f86d48fbc7919b Mon Sep 17 00:00:00 2001 From: Terry Wang Date: Thu, 19 Nov 2026 08:39:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?test(e2e):=20Shift+=E2=86=90=20and=20Shift+?= =?UTF-8?q?Tab=20reach=20a=20live=20pane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GlassUiTest.t10 attaches to the CI host, runs cat -v, and taps Shift then ← and Shift then Tab in the extra-keys row: the pane must show ^[[1;2D and ^[[Z, and the next ← must be plain. Its screenshots are the PR's evidence. Also lists Shift on the Chinese site, which the first commit missed. --- .github/workflows/ci.yml | 2 +- .../java/app/bellterm/e2e/GlassUiTest.kt | 31 +++++++++++++++++++ site/zh/index.html | 4 +-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 708855e..85d8c64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,7 +170,7 @@ jobs: instrument -e publish_key 1 -e class "$test#t0_publishesDeviceKey" || exit 1 adb shell cat /sdcard/Android/data/app.bellterm/files/e2e/device.pub >> ~/.ssh/authorized_keys instrument -e host 10.0.2.2 -e port 2222 -e user "$(id -un)" -e fingerprint "$FINGERPRINT" \ - -e machine b-machine -e machine_workspace on-b -e class "$test#t8_switchesToSavedMachine,$test#t9_changelogListsReleases" + -e machine b-machine -e machine_workspace on-b -e class "$test#t8_switchesToSavedMachine,$test#t9_changelogListsReleases,$test#t10_shiftLatchesForTheNextKey" SCRIPT - uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0 diff --git a/app/src/androidTest/java/app/bellterm/e2e/GlassUiTest.kt b/app/src/androidTest/java/app/bellterm/e2e/GlassUiTest.kt index 14e3cfc..1e31210 100644 --- a/app/src/androidTest/java/app/bellterm/e2e/GlassUiTest.kt +++ b/app/src/androidTest/java/app/bellterm/e2e/GlassUiTest.kt @@ -4,6 +4,7 @@ import android.content.ClipboardManager import android.content.Context import android.content.Intent import android.os.Build +import android.view.KeyEvent import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.By import androidx.test.uiautomator.Direction @@ -305,6 +306,36 @@ class GlassUiTest { need(By.res("action:keys")) } + /** Issue #31: Shift latches from the extra-keys row and reaches the pane with the next key. */ + @Test + fun t10_shiftLatchesForTheNextKey() { + val host = InstrumentationRegistry.getArguments().getString("host") + assumeTrue("no host given; skipping the live connection", host != null) + connectHost(host!!) + need(By.res("extra_keys")) + val connection = app.connections.value.values.single() + val pane = { connection.frame.value?.panes?.firstOrNull { it.focused }?.id } + val screen = { connection.frame.value?.runs?.joinToString("") { it.text }.orEmpty() } + assertTrue("a focused pane", waitFor { pane() != null }) + // cat -v shows the bytes each key sends: ESC as ^[. + connection.text(pane(), "clear; cat -v\n") + Thread.sleep(SETTLE) + + need(By.res("key:Shift")).click() + shot("23_shift_latched") + need(By.res("key:←")).click() + assertTrue("Shift+← reaches the pane as CSI 1;2D", waitFor { "^[[1;2D" in screen() }) + need(By.res("key:Shift")).click() + need(By.res("key:Tab")).click() + assertTrue("Shift+Tab reaches the pane as back-tab", waitFor { "^[[Z" in screen() }) + // The latch was used up: a plain ← follows. + need(By.res("key:←")).click() + assertTrue("an unlatched ← stays plain", waitFor { "^[[Z^[[D" in screen() }) + shot("24_shift_chords") + + connection.chord(pane(), 'c'.code, KeyEvent.META_CTRL_ON) + } + /** Adds [host] from the instrumentation arguments as a node, opens it, and trusts its key when vouched for. */ private fun connectHost(host: String) { val args = InstrumentationRegistry.getArguments() diff --git a/site/zh/index.html b/site/zh/index.html index b05db70..1cb577b 100644 --- a/site/zh/index.html +++ b/site/zh/index.html @@ -99,7 +99,7 @@

你的 agent。
你的手机。
时刻同步。

›
- EscTabCtrlAlt←↓↑→ + EscTabShiftCtrlAlt←↓↑→
@@ -184,7 +184,7 @@

Agent

终端

  • libghostty-vt 负责字形簇、宽字符和颜色。
  • -
  • 扩展按键行:Esc、Tab、可锁定的 Ctrl 和 Alt,以及按住连发的方向键。
  • +
  • 扩展按键行:Esc、Tab、可锁定的 Shift、Ctrl 和 Alt,以及按住连发的方向键。
  • 中文输入直接在光标处组字,也支持实体键盘。
  • Nerd Font 图标、十套配色、双指缩放、长按复制。
From e364de2f7056d021486aa8fcf5b5373308b4d519 Mon Sep 17 00:00:00 2001 From: Terry Wang Date: Thu, 19 Nov 2026 08:39:20 +0800 Subject: [PATCH 3/3] docs: release notes and site changelog for 1.1.3 --- release-notes/1.1.3.en.txt | 1 + release-notes/1.1.3.zh.txt | 1 + site/changelog/index.html | 6 ++++++ site/zh/changelog/index.html | 6 ++++++ 4 files changed, 14 insertions(+) create mode 100644 release-notes/1.1.3.en.txt create mode 100644 release-notes/1.1.3.zh.txt diff --git a/release-notes/1.1.3.en.txt b/release-notes/1.1.3.en.txt new file mode 100644 index 0000000..a0809ff --- /dev/null +++ b/release-notes/1.1.3.en.txt @@ -0,0 +1 @@ +The extra-keys row has a Shift key: tap Shift, then a key, to send Shift+← or Shift+Tab, alone or with Ctrl and Alt. diff --git a/release-notes/1.1.3.zh.txt b/release-notes/1.1.3.zh.txt new file mode 100644 index 0000000..2be3403 --- /dev/null +++ b/release-notes/1.1.3.zh.txt @@ -0,0 +1 @@ +扩展按键行新增 Shift:先点 Shift 再点按键,即可发送 Shift+← 或 Shift+Tab,也可以和 Ctrl、Alt 组合。 diff --git a/site/changelog/index.html b/site/changelog/index.html index d620b28..f01a9be 100644 --- a/site/changelog/index.html +++ b/site/changelog/index.html @@ -35,6 +35,12 @@

Changelog

Android releases, newest first. The Android app offers each one on its own; the iOS beta on TestFlight picks up the same changes in a later build.

+

1.1.3

+

· Android · Release on GitHub

+
    +
  • Shift in the extra-keys row. Tap Shift, then a key, to send Shift+← and other Shift chords from the touch screen, such as Codex's Shift+← or Shift+Tab. It latches for the next key like Ctrl and Alt, combines with them, and a second tap cancels it.
  • +
+

1.1.2

· Android · Release on GitHub

    diff --git a/site/zh/changelog/index.html b/site/zh/changelog/index.html index c979722..f9e7b4b 100644 --- a/site/zh/changelog/index.html +++ b/site/zh/changelog/index.html @@ -35,6 +35,12 @@

    更新日志

    Android 版本,最新的在前。Android 应用会自动提示新版本;TestFlight 上的 iOS 测试版会在之后的构建中带上同样的改动。

    +

    1.1.3

    +

    · Android · GitHub 上的发布

    +
      +
    • 扩展按键行新增 Shift。先点 Shift 再点按键,就能在触屏上发送 Shift+← 等组合键,例如 Codex 的 Shift+← 或 Shift+Tab。它和 Ctrl、Alt 一样只对下一个按键生效,可以和它们组合,再点一次即可取消。
    • +
    +

    1.1.2

    · Android · GitHub 上的发布