Skip to content

feat: implement auto-spacing after punctuation and double-tap space period (#669) - #670

Open
prince-0408 wants to merge 4 commits into
scribe-org:mainfrom
prince-0408:feature/auto-space-double-tap-period-669
Open

feat: implement auto-spacing after punctuation and double-tap space period (#669)#670
prince-0408 wants to merge 4 commits into
scribe-org:mainfrom
prince-0408:feature/auto-space-double-tap-period-669

Conversation

@prince-0408

@prince-0408 prince-0408 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR implements two standard soft-keyboard usability features as requested in #669 by adding automatic punctuation spacing and refining double-tap space for period behavior to align with modern keyboard standards (such as Gboard and SwiftKey).

Key Changes

Double-Tap Space for Period (. ):

  • Updated SpaceKeyProcessor.kt so that pressing the spacebar twice after a word converts the trailing space to a period and space (. ).
  • Automatically activates single-character shift state (SHIFT_ON_ONE_CHAR) on period conversion to capitalize the first letter of the next sentence.
  • Removed outdated helper functions to simplify and streamline spacebar event handling.

Auto-Spacing After Punctuation:

  • Updated KeyHandler.kt to intercept punctuation keys (., ,, !, ?) and automatically append a trailing space when typed after a word.
  • Handled edge cases to gracefully remove auto-inserted spaces if a consecutive punctuation mark (e.g. ... or ?!) or backspace is typed.

Settings & Preferences Integration:

  • Added AUTO_SPACE_AFTER_PUNCTUATION constant, getter, and setter in PreferencesHelper.kt.
  • Defaulted both "Double-space for period" and "Auto-space after punctuation" settings to enabled (true).
  • Added a new toggle switch for "Auto-space after punctuation" under Keyboard Settings > Functionality in LanguageSettingsScreen.kt.
  • Added string resources in en-US/string.xml.

Unit Tests & Linter Cleanliness:

  • Added new test coverage in SpaceKeyProcessorTest.kt for spacebar event processing and period commits.
  • Formatted all Kotlin sources via ./gradlew formatKotlin to ensure clean compliance with ktlint and detekt.

Visual Demonstration

Double-Tap Space Period Feature Auto-Space Settings Toggle

Related Issue

Closes #669

…eriod (scribe-org#669)

- Add auto-space after punctuation (. , ! ?) setting and key handling
- Refine double-tap space for period conversion and auto-capitalization
- Default auto-spacing and double-tap period preferences to enabled
- Add unit tests for SpaceKeyProcessor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Auto-Spacing After Punctuation & Double-Tap Space for Period

1 participant