Skip to content

feat: add word-delete-keybindings - #63

Merged
vyrx-dev merged 2 commits into
vyrx-dev:masterfrom
cooperkey:feat/word-delete-keybindings
Jul 11, 2026
Merged

vyrx-dev merged 2 commits into
vyrx-dev:masterfrom
cooperkey:feat/word-delete-keybindings

Conversation

@cooperkey

Copy link
Copy Markdown
Contributor

adds word-delete support while typing:
ctrl+w deletes the last word during an active test while preserving existing keybind.
if using termux, ctrl+h (ctrl + backspace in termux) also deletes the last word while typing.

Copilot AI review requested due to automatic review settings July 3, 2026 14:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “delete previous word” behavior during an active typing test, wiring new keybindings in the TUI to game-level deletion logic (including a Termux-friendly mapping).

Changes:

  • Added (*game.Game).BackspaceWord() to delete the last word from the current input.
  • Updated typing key handling so ctrl+w deletes a word during an active test while preserving its existing pre-start behavior.
  • Updated ctrl+h to act as word-delete while typing (for Termux’ ctrl+backspace mapping) while keeping help behavior when not started.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/tui/typing.go Routes ctrl+w / ctrl+h to word-delete during active typing while preserving pre-start bindings.
internal/game/game.go Implements word-level backspace logic that the TUI can call during a test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/tui/typing.go Resolved
Comment thread internal/tui/typing.go Outdated
Comment on lines +72 to +79
//this is for termux since it reads ctrl + backspace as ctrl + h
case "ctrl+h":
if m.game.Started() {
m.game.BackspaceWord()
} else {
m.showHelp = true
return m, nil
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people use termux on mobile right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, on mobile with aarch64 because it reads ^Backspace as ^h

Comment thread internal/game/game.go
Comment on lines +181 to +203
func (g *Game) BackspaceWord() {
if len(g.input) == 0 {
return
}

g.lastTyped = time.Now()

// Trim trailing spaces first
for len(g.input) > 0 && g.input[len(g.input)-1] == ' ' {
pos := len(g.input) - 1
g.input = g.input[:pos]
delete(g.errors, pos)
}

// Then delete until hitting a space or the beginning
for len(g.input) > 0 && g.input[len(g.input)-1] != ' ' {
pos := len(g.input) - 1
g.input = g.input[:pos]
delete(g.errors, pos)
}

g.recordRacePoint()
}
@vyrx-dev

vyrx-dev commented Jul 3, 2026

Copy link
Copy Markdown
Owner

wait... you just removed help keybind 😅

@cooperkey

Copy link
Copy Markdown
Contributor Author

wait... you just removed help keybind 😅

The ^H will only activate when there is an active test. The help keybind stays the same before starting the test hehe

@vyrx-dev

vyrx-dev commented Jul 11, 2026 •

Copy link
Copy Markdown
Owner

thanks for this! kept the ctrl+w word-delete, just cleaned it up a bit — removed the termux ctrl+h part since we don't really need that. ✌

@vyrx-dev
vyrx-dev merged commit 3a65b98 into vyrx-dev:master Jul 11, 2026
1 check passed
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.

3 participants