Open
Conversation
Adds a custom accessibility action that extracts the last command's output using OSC 133 shell integration semantic segments and announces it via TalkBack, enabling screen reader users to review command output. Closes connectbot#28 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…iming Expose getLastCommandOutput() on the TerminalEmulator sealed interface so ConnectBot can access it from the menu without reaching into internal types. The implementation reads the current snapshot's scrollback + visible lines and delegates to the existing getLastCommandOutput(lines) function. Fix a bug in OscParser where COMMAND_INPUT segments were never created in real shell integration scenarios. Previously, COMMAND_INPUT was created at C time (command output start), but after the user presses Enter the screen scrolls while the cursor stays at the same screen-relative row. This caused the column comparison to fail (startCol > cursorCol) so no segment was created. Move COMMAND_INPUT creation to B time (command input start) where the segment is placed on the correct screen row and will be properly shifted by pushScrollbackLine along with the text content. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The View.announceForAccessibility() method was deprecated in API 36. The replacement AccessibilityManager.announce() is only available on API 36+, and our minSdk is 24, so suppress the warning for now. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use a Compose live region Box instead of the deprecated View.announceForAccessibility() to announce text to TalkBack. A hidden Box with liveRegion semantics is conditionally shown when there is text to announce, causing TalkBack to read the updated contentDescription automatically. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the new getLastCommandOutput() method to the Metalava API signature file so the compatibility check passes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test was checking all semanticSegments and expecting 1, but COMMAND_INPUT marker added at OSC 133;B time caused count to be 2. Use getSegmentsOfType(SemanticType.PROMPT) to match test intent. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
buildSnapshot() read currentLines without holding damageLock, so when the handler-posted processPendingUpdates() ran on the main thread concurrently with the test thread, the snapshot could miss segments written by addSemanticSegment on the JNI callback thread. Move currentLines and scrollbackSnapshot reads under damageLock in buildSnapshot() to ensure cross-thread visibility. Also add waitForIdleSync() in test helper to drain the main looper before taking a snapshot, preventing the handler from consuming pending state before the test's own processPendingUpdates() call. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #28.
Add the ability to retrieve the output of the last completed command using OSC 133 (FinalTerm) shell integration semantic markers. This is exposed through:
How it works
The implementation scans backward through terminal lines (scrollback + visible) to find:
Changes
AccessibilityOverlay.kt
TerminalEmulator.kt
OscParser.kt
ReadLastOutputTest.kt (new)
whitespace, and scrollback scenarios
OscParserTest.kt
Unit Tests