Skip to content

Commit 27df03f

Browse files
leboikoclaude
andcommitted
Release 1.6.2: fix duplicate key events on Windows
On Windows, crossterm emits both KeyEventKind::Press and KeyEventKind::Release for every keystroke. Our event loop forwarded both, causing every action to fire twice (double scroll, double cursor move, etc.). Guard the Event::Key match arm with `key.kind == KeyEventKind::Press` so only key-down events are forwarded. No effect on macOS/Linux (they only emit Press). This is the canonical fix from the ratatui FAQ: https://ratatui.rs/faq/ Fixes #1. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 6dedd9a commit 27df03f

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to `markdown-tui-explorer` are documented here.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.6.2] - 2026-04-17
9+
10+
### Fixed
11+
- **Duplicate key events on Windows.** crossterm emits both
12+
`KeyEventKind::Press` and `KeyEventKind::Release` for every keystroke
13+
on Windows; the event loop was forwarding both, causing every action
14+
to fire twice. Now only `Press` events are forwarded. No effect on
15+
macOS/Linux (they only emit `Press`). Fixes #1.
16+
817
## [1.6.1] - 2026-04-17
918

1019
### Changed

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "markdown-tui-explorer"
3-
version = "1.6.1"
3+
version = "1.6.2"
44
edition = "2024"
55
description = "A terminal-based markdown file browser and viewer with search, syntax highlighting, and live reload"
66
license = "MIT"

‎src/event.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ impl EventHandler {
3838
&& let Ok(evt) = event::read()
3939
{
4040
let action = match evt {
41-
Event::Key(key) => Some(Action::RawKey(key)),
41+
// Only handle key-down events. On Windows, crossterm
42+
// emits both Press and Release for every keystroke;
43+
// forwarding both would duplicate every action.
44+
Event::Key(key)
45+
if key.kind == crossterm::event::KeyEventKind::Press =>
46+
{
47+
Some(Action::RawKey(key))
48+
}
4249
Event::Resize(w, h) => Some(Action::Resize(w, h)),
4350
Event::Mouse(m) => Some(Action::Mouse(m)),
4451
_ => None,

0 commit comments

Comments
 (0)