Home / Specs / Selection-Delete Mode
Gestures v1.2.4

Selection-Delete Mode

Text selection via backspace swipe-hold gesture

Selection-Delete Mode Specification

Feature Overview

Feature Name: Selection-Delete Mode

Priority: P1

Status: Complete

Target Version: v1.2.4

Summary

A gesture mode that enables text selection via swipe-hold on the backspace key, with automatic deletion on release.

Motivation

Traditional text selection on mobile keyboards is cumbersome, requiring switching to cursor mode or long-pressing. This feature enables rapid text selection and deletion with a single fluid gesture on the backspace key.

Requirements

Functional Requirements

Non-Functional Requirements

User Stories

Technical Design

Architecture

User Input (backspace key)

|

v

+------------------+

| onTouchDown() | -- Defers backspace handling for gesture detection

+------------------+

|

v

+------------------+

| Short Swipe | -- Detects initial swipe direction

| Detection |

+------------------+

|

v (if hold detected)

+------------------+

| FLAG_P_SELECTION | -- Activates selection-delete mode

| _DELETE_MODE |

+------------------+

|

v

+------------------+

| handleSelection | -- Repeating handler for continuous selection

| DeleteRepeat() |

+------------------+

|

v (on release)

+------------------+

| Delete selected | -- Sends DEL key to remove selection

| text |

+------------------+

Component Breakdown

Data Structures

// State flag for mode tracking

private const val FLAG_P_SELECTION_DELETE_MODE = 128

// Timer identifier

private val selectionDeleteWhat = Any()

// Configuration settings

selection_delete_vertical_threshold: Int // 20-80%, default 40%

selection_delete_vertical_speed: Float // 0.1x-1.0x, default 0.4x

API/Interface Design

// Selection handling in Pointers.kt

private fun handleSelectionDeleteRepeat(ptr: Pointer) {

// Track X/Y axes independently

val dx = ptr.currentX - ptr.selectionCenterX

val dy = ptr.currentY - ptr.selectionCenterY

// Horizontal: Shift+Left or Shift+Right

// Vertical: Shift+Up or Shift+Down (with threshold)

}

// Shift state management

private fun makeInternalModifier(mod: Modifier): KeyValue

private fun with_extra_mod(value: KeyValue, extra: Modifier): KeyValue

State Management

Implementation Plan

Phase 1: Core Selection Mode

Status: Complete

Deliverables:

Phase 2: Vertical Selection & Configuration

Status: Complete

Deliverables:

Testing Strategy

Unit Tests

Integration Tests

UI/UX Tests

Dependencies

Internal Dependencies

External Dependencies

Breaking Changes

Error Handling

Success Metrics


Created: 2026-01-14

Last Updated: 2026-01-14

Owner: CleverKeys Development

Reviewers: tribixbite