Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added copy/paste in module options #492

Merged
merged 5 commits into from
May 5, 2023

Conversation

Edouard127
Copy link
Contributor

Describe the pull
Add a simple control v control c function into the StringButton

Describe how this pull is helpful
Copying and pasting text without having to edit the module json config file

Comment on lines 68 to 77
Keyboard.KEY_V, Keyboard.KEY_INSERT -> {
if (!GuiScreen.isCtrlKeyDown() && keyCode != Keyboard.KEY_INSERT) return
componentName = GuiScreen.getClipboardString().substring(0, min(GuiScreen.getClipboardString().length - 1, 256)).replace("\n", "")
onStopListening(true)
}
Keyboard.KEY_C -> {
if (!GuiScreen.isCtrlKeyDown()) return
GuiScreen.setClipboardString(componentName)
onStopListening(true)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Using KEY_V and KEY_C in this when condition prevents those characters from being typed normally which only happens in the else condition.
  2. The last character is cut-off when pasting.
  3. 256 characters is far more than what can be displayed on the gui. I can only see roughly 50 at most. I think we need to limit this down and/or have a key to clear the text box.
  4. I'd prefer calling string.trim() on pasted text so leading or following spaces get cut-off. These are often mistakes in copying.

@Avanatiker Avanatiker merged commit 36b02e5 into lambda-client:master May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants