Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 31 additions & 0 deletions app/src/androidTest/java/app/bellterm/e2e/GlassUiTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/app/bellterm/ui/terminal/ExtraKeys.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ sealed interface ExtraKey {
val DefaultExtraKeys: List<ExtraKey> = 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),
Expand All @@ -76,7 +77,7 @@ val DefaultExtraKeys: List<ExtraKey> = 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].
*/
Expand Down
13 changes: 10 additions & 3 deletions app/src/main/java/app/bellterm/ui/terminal/TerminalView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions native/src/input/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
1 change: 1 addition & 0 deletions release-notes/1.1.3.en.txt
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions release-notes/1.1.3.zh.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
扩展按键行新增 Shift:先点 Shift 再点按键,即可发送 Shift+← 或 Shift+Tab,也可以和 Ctrl、Alt 组合。
6 changes: 6 additions & 0 deletions site/changelog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<h1>Changelog</h1>
<p class="meta">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.</p>

<h2 id="1.1.3">1.1.3</h2>
<p class="meta"><time datetime="2026-11-19">19 November 2026</time> · Android · <a href="https://github.com/nimrc/bellterm/releases/tag/v1.1.3">Release on GitHub</a></p>
<ul>
<li><strong>Shift in the extra-keys row.</strong> 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.</li>
</ul>

<h2 id="1.1.2">1.1.2</h2>
<p class="meta"><time datetime="2026-11-17">17 November 2026</time> · Android · <a href="https://github.com/nimrc/bellterm/releases/tag/v1.1.2">Release on GitHub</a></p>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h1>Your agents.<br>Your phone.<br><span>In sync.</span></h1>

<span class="p">›</span> <i class="cursor"></i></div>
<div class="keys">
<span>Esc</span><span>Tab</span><span class="latched">Ctrl</span><span>Alt</span><span>←</span><span>↓</span><span>↑</span><span>→</span>
<span>Esc</span><span>Tab</span><span>Shift</span><span class="latched">Ctrl</span><span>Alt</span><span>←</span><span>↓</span><span>↑</span><span>→</span>
</div>
<div class="note">
<img src="/icon.svg" alt="">
Expand Down Expand Up @@ -184,7 +184,7 @@ <h3>Agents</h3>
<h3>Terminal</h3>
<ul>
<li><strong>libghostty-vt</strong> for graphemes, wide characters, and colour.</li>
<li><strong>An extra-keys row</strong> with Esc, Tab, latching Ctrl and Alt, and repeating arrows.</li>
<li><strong>An extra-keys row</strong> with Esc, Tab, latching Shift, Ctrl and Alt, and repeating arrows.</li>
<li><strong>CJK input</strong> composes in place at the cursor. Hardware keyboards work too.</li>
<li><strong>Nerd Font icons</strong>, ten colour schemes, pinch to zoom, long-press to copy.</li>
</ul>
Expand Down
6 changes: 6 additions & 0 deletions site/zh/changelog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<h1>更新日志</h1>
<p class="meta">Android 版本,最新的在前。Android 应用会自动提示新版本;TestFlight 上的 iOS 测试版会在之后的构建中带上同样的改动。</p>

<h2 id="1.1.3">1.1.3</h2>
<p class="meta"><time datetime="2026-11-19">2026 年 11 月 19 日</time> · Android · <a href="https://github.com/nimrc/bellterm/releases/tag/v1.1.3">GitHub 上的发布</a></p>
<ul>
<li><strong>扩展按键行新增 Shift。</strong>先点 Shift 再点按键,就能在触屏上发送 Shift+← 等组合键,例如 Codex 的 Shift+← 或 Shift+Tab。它和 Ctrl、Alt 一样只对下一个按键生效,可以和它们组合,再点一次即可取消。</li>
</ul>

<h2 id="1.1.2">1.1.2</h2>
<p class="meta"><time datetime="2026-11-17">2026 年 11 月 17 日</time> · Android · <a href="https://github.com/nimrc/bellterm/releases/tag/v1.1.2">GitHub 上的发布</a></p>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions site/zh/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h1>你的 agent。<br>你的手机。<br><span>时刻同步。</span></h1>

<span class="p">›</span> <i class="cursor"></i></div>
<div class="keys">
<span>Esc</span><span>Tab</span><span class="latched">Ctrl</span><span>Alt</span><span>←</span><span>↓</span><span>↑</span><span>→</span>
<span>Esc</span><span>Tab</span><span>Shift</span><span class="latched">Ctrl</span><span>Alt</span><span>←</span><span>↓</span><span>↑</span><span>→</span>
</div>
<div class="note">
<img src="/icon.svg" alt="">
Expand Down Expand Up @@ -184,7 +184,7 @@ <h3>Agent</h3>
<h3>终端</h3>
<ul>
<li><strong>libghostty-vt</strong> 负责字形簇、宽字符和颜色。</li>
<li><strong>扩展按键行</strong>:Esc、Tab、可锁定的 Ctrl 和 Alt,以及按住连发的方向键。</li>
<li><strong>扩展按键行</strong>:Esc、Tab、可锁定的 Shift、Ctrl 和 Alt,以及按住连发的方向键。</li>
<li><strong>中文输入</strong>直接在光标处组字,也支持实体键盘。</li>
<li><strong>Nerd Font 图标</strong>、十套配色、双指缩放、长按复制。</li>
</ul>
Expand Down
Loading