Skip to content

[fix]: textbox mouse selection and clipboard copy using mouse - #164

Open
qutad wants to merge 2 commits into
komaruworld:mainfrom
qutad:fix/115-textbox-mouse-selection
Open

qutad wants to merge 2 commits into
komaruworld:mainfrom
qutad:fix/115-textbox-mouse-selection

Conversation

@qutad

@qutad qutad commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Why this is necessary

TextBox text could not be reliably copied with the mouse. Dragging did not provide a usable selection, and hit-testing could jump from the start to the end of the text instead of advancing letter by letter. This prevented players from selecting
and copying a specific value, such as a lobby code. Closes #115.

Whats changed

  • Added mouse caret placement and drag selection for focused TextBoxes.
  • Made hit-testing follow individual Unicode graphemes, so selection grows one character at a time.
  • Updated the blue highlight to reflect the selected range.
  • Made Ctrl+C copy only the selected text; with no selection, it leaves the clipboard unchanged.

Validation

  • Built the input runtime successfully.
  • Ran 73 relevant input, text-editor, and overlay tests; all passed.
  • Added tests for intermediate letter positions, Unicode graphemes, selection highlighting, and copying a mouse-selected range.

Closes #115

PS: this PR in the future will need be get more polished to be more closer to native Roblox production.

@qutad qutad changed the title fix textbox mouse selection and clipboard copy using mouse [fix]: textbox mouse selection and clipboard copy using mouse Sep 23, 2026
// pointer gesture owned by the editor until release, even in that frame.
return !begin && mouse_selecting_;
}
const Utf8Layout layout = Layout(text_);

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.

In password fields, hitest returns the byte position in the ••• mask, and the editor applies it to the original text. Each • occupies 3 bytes: for abcdef, clicking after the first dot will place the cursor after c instead of a.

This branch has not been deployed

No deployments
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.

[Bug]: Unable to copy text from text boxes

2 participants