Editor: Ctrl+Backspace/Delete by words; edit own posts in the thread/forum panel (#617, #616) #624

Merged
charles merged 1 commit from fix/editor-forum-edit into textchat 2026-11-15 09:29:26 +00:00
Owner

Two reports from Windows (#617, #616).

What was wrong

#617: Ctrl+Backspace deleted one character. The composer, the inline edit box and the forum post body are all iced text_editors with our widgets::composer::binding. Anything that binding doesn't handle goes to Binding::from_key_press, which maps Backspace/Delete to one-character edits whatever the modifiers are (iced_widget 0.14.2 text_editor.rs:1211). iced's editor has no word-delete. The search box is an iced text_input, which has one, so it already worked there.

#616: own forum post could not be edited. Clicking a forum post opens it in the thread side panel, and the forum stays ui.selected_channel. The hover bar and context menu did offer Edit for the starter and for replies, but UserAction::StartEdit(message_id) (and EditLastMessage, SaveEdit, CancelEdit) found their channel through selected_channel (crates/fluxer-core/src/chat/composer.rs, on_user). So the message was looked up in the forum, not found, and nothing happened. A regular thread in the side panel had the same problem. The full view was not affected.

What changed

  • widgets::composer: two new keys, Key::DeleteWordBackward and Key::DeleteWordForward, for Ctrl+Backspace and Ctrl+Delete (modifiers.jump(), so Option on macOS). The binding matches the logical key or the physical key.
  • composer::Mirror::delete_word: with a selection, deletes just the selection. Without one, it selects with Motion::WordLeft/WordRight (the motion Ctrl+Left/Right already use) and then deletes. Word-delete therefore stops where word movement stops: UAX #29 words with punctuation and whitespace skipped, and at a line start it joins the line above. Handled in both main_key and edit_key. The forum body reuses main_key.
  • UserAction::StartEdit { channel_id, message_id }, EditLastMessage(channel), SaveEdit(channel) and CancelEdit(channel) now carry the channel of the message list or composer that sent them. This matches the original's MessageCommands.startEdit(channelId, messageId, ...). Call sites, tests and the core/ui READMEs are updated.

Tests

  • fluxer-ui/tests/composer.rs ctrl_backspace_and_delete_by_words: checks the bindings, including Ctrl+Left/Right giving Move(WordLeft/WordRight) and Ctrl+Shift+Left/Right giving Select(...). It then drives the key presses through the composer and the store: deleting words with punctuation, deleting mid-word, Ctrl+Delete, deleting only the selection, the line join, doing nothing at the start and end, and the inline edit box. It failed before the fix.
  • fluxer-ui/tests/forum.rs own_post_edited_from_the_panel: opens an own post in the panel and checks that the starter and a reply offer Edit in the bar and the menu. Clicking Edit opens the post composer's inline edit (and not the forum's). Enter sends PatchMessage to the post, and Escape cancels there. It failed before the fix: the edit never opened.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes locally ("all steps passed"). No goldens changed.

Not verified

  • No run on real Windows. The binding assumes winit reports Ctrl+Backspace as Named(Backspace) or physical Code::Backspace; we match either.
  • Ctrl+Right and Ctrl+Delete stop at the end of the next word, which is iced/cosmic-text's motion and also what Chromium does on Linux. Chromium on Windows stops at the start of the next word instead. I left that as is, so the two shortcuts stay consistent.

Not fixed here

StartReply, ToggleReplyMention, CancelReply and PickEmoji { target: Composer } still resolve selected_channel, so Reply in the side panel (thread or forum post) probably does nothing. It's the same cause, and a follow-up should apply the same fix.

Refs #616, #617

🤖 Generated with Claude Code

Two reports from Windows (#617, #616). ## What was wrong **#617: Ctrl+Backspace deleted one character.** The composer, the inline edit box and the forum post body are all iced `text_editor`s with our `widgets::composer::binding`. Anything that binding doesn't handle goes to `Binding::from_key_press`, which maps Backspace/Delete to one-character edits whatever the modifiers are (iced_widget 0.14.2 `text_editor.rs:1211`). iced's editor has no word-delete. The search box is an iced `text_input`, which has one, so it already worked there. **#616: own forum post could not be edited.** Clicking a forum post opens it in the thread side panel, and the forum stays `ui.selected_channel`. The hover bar and context menu did offer Edit for the starter and for replies, but `UserAction::StartEdit(message_id)` (and `EditLastMessage`, `SaveEdit`, `CancelEdit`) found their channel through `selected_channel` (`crates/fluxer-core/src/chat/composer.rs`, `on_user`). So the message was looked up in the forum, not found, and nothing happened. A regular thread in the side panel had the same problem. The full view was not affected. ## What changed - `widgets::composer`: two new keys, `Key::DeleteWordBackward` and `Key::DeleteWordForward`, for Ctrl+Backspace and Ctrl+Delete (`modifiers.jump()`, so Option on macOS). The binding matches the logical key or the physical key. - `composer::Mirror::delete_word`: with a selection, deletes just the selection. Without one, it selects with `Motion::WordLeft`/`WordRight` (the motion Ctrl+Left/Right already use) and then deletes. Word-delete therefore stops where word movement stops: UAX #29 words with punctuation and whitespace skipped, and at a line start it joins the line above. Handled in both `main_key` and `edit_key`. The forum body reuses `main_key`. - `UserAction::StartEdit { channel_id, message_id }`, `EditLastMessage(channel)`, `SaveEdit(channel)` and `CancelEdit(channel)` now carry the channel of the message list or composer that sent them. This matches the original's `MessageCommands.startEdit(channelId, messageId, ...)`. Call sites, tests and the core/ui READMEs are updated. ## Tests - `fluxer-ui/tests/composer.rs` `ctrl_backspace_and_delete_by_words`: checks the bindings, including Ctrl+Left/Right giving `Move(WordLeft/WordRight)` and Ctrl+Shift+Left/Right giving `Select(...)`. It then drives the key presses through the composer and the store: deleting words with punctuation, deleting mid-word, Ctrl+Delete, deleting only the selection, the line join, doing nothing at the start and end, and the inline edit box. It failed before the fix. - `fluxer-ui/tests/forum.rs` `own_post_edited_from_the_panel`: opens an own post in the panel and checks that the starter and a reply offer Edit in the bar and the menu. Clicking Edit opens the post composer's inline edit (and not the forum's). Enter sends `PatchMessage` to the post, and Escape cancels there. It failed before the fix: the edit never opened. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes locally ("all steps passed"). No goldens changed. ## Not verified - No run on real Windows. The binding assumes winit reports Ctrl+Backspace as `Named(Backspace)` or physical `Code::Backspace`; we match either. - Ctrl+Right and Ctrl+Delete stop at the end of the next word, which is iced/cosmic-text's motion and also what Chromium does on Linux. Chromium on Windows stops at the start of the next word instead. I left that as is, so the two shortcuts stay consistent. ## Not fixed here `StartReply`, `ToggleReplyMention`, `CancelReply` and `PickEmoji { target: Composer }` still resolve `selected_channel`, so Reply in the side panel (thread or forum post) probably does nothing. It's the same cause, and a follow-up should apply the same fix. Refs #616, #617 🤖 Generated with [Claude Code](https://claude.com/claude-code)
#617: Ctrl+Backspace / Ctrl+Delete in the composer, the inline edit box
and the forum post body deleted one character (iced's text_editor maps
Backspace/Delete to single-character edits whatever the modifiers). They
now delete the selection, or else up to the word boundary Ctrl+Left /
Ctrl+Right move to (the same motion, so a line start joins the line
above). Ctrl+Left/Right and Ctrl+Shift+Left/Right are iced's and are
now covered by tests.

#616: a forum post opens in the thread side panel while the forum stays
the selected channel. StartEdit, EditLastMessage, SaveEdit and
CancelEdit resolved their channel from ui.selected_channel, so Edit on
the post's starter or a reply (offered in the hover bar and menu) looked
the message up in the forum and did nothing. They now carry the channel
of the message list / composer that sent them, as the original's
startEdit(channelId, messageId) does.

Refs #616, #617

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
charles merged commit 59adeccee5 into textchat 2026-11-15 09:29:26 +00:00
Sign in to join this conversation.
No description provided.