Skip to content

Add Ctrl+V paste support to chatbox - #5296

Open
iManGaaX wants to merge 4 commits into
multitheftauto:masterfrom
iManGaaX:patch-1
Open

Add Ctrl+V paste support to chatbox#5296
iManGaaX wants to merge 4 commits into
multitheftauto:masterfrom
iManGaaX:patch-1

Conversation

@iManGaaX

Copy link
Copy Markdown
Contributor

Summary

Added Ctrl+V shortcut to CChat::CharacterKeyHandler. This allows players to paste text directly into the chat input box from the system clipboard.

Motivation

Players can now paste copied text, or long commands directly into the chat box without needing to type them out manually.

Test plan

  1. Compiled the client and opened the in-game chat box.
  2. Copied single-line text and pressed Ctrl+V. confirmed text pasted as expected.
  3. Copied multi-line text containing \r\n. confirmed newlines were stripped cleanly.
  4. Copied a string exceeding m_iCharacterLimit. confirmed text was safely truncated without buffer overflow or UI bugs.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Implement CTRL + V functionality to paste clipboard text into input, ensuring character limit is respected.
@SpeedyFolf

Copy link
Copy Markdown
Contributor

There's already #4976

@iManGaaX

Copy link
Copy Markdown
Contributor Author

There's already #4976

Oh, i haven't seen that before. i don't know what to do now, i will keep the pull request open anyway

@r12750

r12750 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

It would also be interesting to add a function to enable/disable it within toggleControl (paste_chatbox): toggleControl(“paste_chatbox”, true)

Because some server owners weren't aware of its usefulness, it is initially disabled until toggleControl is used.

@iManGaaX

Copy link
Copy Markdown
Contributor Author

It would also be interesting to add a function to enable/disable it within toggleControl (paste_chatbox): toggleControl(“paste_chatbox”, true)

Because some server owners weren't aware of its usefulness, it is initially disabled until toggleControl is used.

Anyway, the player can easily press F8 and type say and then press CTRL+V. Even if toggleControl("paste_chatbox", true/false) is created as you mentioned, it won’t make any difference to the player.

@r12750

r12750 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

It would also be interesting to add a function to enable/disable it within toggleControl (paste_chatbox): toggleControl(“paste_chatbox”, true)
Because some server owners weren't aware of its usefulness, it is initially disabled until toggleControl is used.

Anyway, the player can easily press F8 and type say and then press CTRL+V. Even if toggleControl("paste_chatbox", true/false) is created as you mentioned, it won’t make any difference to the player.

No. I use toggleControl to disable radar, hud, and others. showhud/showchat isn't executed because I disabled it using toggleControl.

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