Skip to content

fix: send message on main Return key in MUI composer (X11/native-tft)#345

Merged
mverch67 merged 1 commit into
meshtastic:masterfrom
p0ns:fix/x11-return-key-send
Jul 19, 2026
Merged

fix: send message on main Return key in MUI composer (X11/native-tft)#345
mverch67 merged 1 commit into
meshtastic:masterfrom
p0ns:fix/x11-return-key-send

Conversation

@p0ns

@p0ns p0ns commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #344

On the native-tft (X11) build, the main Return key arrives as a raw '\r' because LVGL's X11 driver only maps XK_KP_Enter to LV_KEY_ENTER. The one-line composer textarea silently discards '\r', so LV_EVENT_READY never fires and the message is never sent — only the on-screen keyboard checkmark (or keypad Enter) worked.

Change

ui_event_message_ready is already registered with LV_EVENT_ALL, so it receives the LV_EVENT_KEY event after the textarea class handler drops the char. This PR handles LV_EVENT_KEY == '\r' there and routes it into the existing LV_EVENT_READY send logic.

  • No double-send for keypad Enter / libinput Enter: those arrive as LV_KEY_ENTER ('\n'), which already triggers a nested LV_EVENT_READY from the textarea class handler, and '\n' != '\r' so this handler ignores them.
  • The space+return CR_REPLACEMENT newline trick keeps working, now also with the physical Return key.
  • 9 lines, confined to TFTView_320x240.cpp.

See #344 for the full diagnosis.

Summary by CodeRabbit

  • Bug Fixes
    • Physical Enter key presses now correctly submit one-line messages from the message input.
    • Virtual keyboard carriage return key events are treated the same as the on-screen “ready” action, improving consistency; other key events are ignored to prevent unintended sends.

@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot 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.

Congratulations for your first pull request

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98e31cf8-1143-476b-9f49-487e74752c2a

📥 Commits

Reviewing files that changed from the base of the PR and between 7aeb752 and 26ac5de.

📒 Files selected for processing (1)
  • source/graphics/TFT/TFTView_320x240.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/graphics/TFT/TFTView_320x240.cpp

📝 Walkthrough

Walkthrough

The message input handler converts raw carriage-return keyboard events into LVGL ready events, allowing physical Enter to trigger the existing message-send logic.

Changes

Message submission

Layer / File(s) Summary
Route carriage return to message submission
source/graphics/TFT/TFTView_320x240.cpp
Raw '\r' key events are rewritten as LV_EVENT_READY; other key events remain ignored.

Estimated code review effort: 2 (Simple) | ~5 minutes

Poem

A rabbit pressed Enter with paws light and bright,
The message hopped forward, delivered just right.
No dropped little carriage, no stuck typing spree,
The composer now sends with a bounce and a glee.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: sending messages on the main Return key in the native-tft/X11 composer.
Linked Issues check ✅ Passed The change handles raw '\r' key events in ui_event_message_ready, which matches issue #344's required fix and preserves the existing send path.
Out of Scope Changes check ✅ Passed Only the composer key-event handling was changed, with no unrelated code paths or features added.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

LVGL's X11 input driver maps only XK_KP_Enter to LV_KEY_ENTER; the main
Return key falls through XLookupString as a raw '\r', which the one-line
message textarea silently discards (lv_textarea.c one_line filter). As a
result, typing worked but pressing Enter never sent the message - only
the on-screen keyboard checkmark did (lv_keyboard sends LV_EVENT_READY
directly).

Handle LV_EVENT_KEY == '\r' in ui_event_message_ready and route it into
the existing LV_EVENT_READY send logic. Keypad Enter is unaffected (its
LV_KEY_ENTER already triggers a nested LV_EVENT_READY from the textarea
class handler, and '\n' != '\r' avoids any double-send). The
space+return CR_REPLACEMENT newline trick keeps working, now also with
the physical Return key.
@p0ns
p0ns force-pushed the fix/x11-return-key-send branch from 7aeb752 to 26ac5de Compare July 17, 2026 16:06
Comment thread source/graphics/TFT/TFTView_320x240.cpp
@mverch67
mverch67 merged commit ef573c3 into meshtastic:master Jul 19, 2026
6 of 7 checks 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.

MUI composer: physical Enter/Return key does not send message (native-tft / X11)

3 participants