Skip to content

Implement commands to make command line text selected#5339

Merged
vadi2 merged 3 commits intoMudlet:developmentfrom
chrio:add_selectCmdLine_function#5277
Aug 2, 2021
Merged

Implement commands to make command line text selected#5339
vadi2 merged 3 commits intoMudlet:developmentfrom
chrio:add_selectCmdLine_function#5277

Conversation

@chrio
Copy link
Copy Markdown
Contributor

@chrio chrio commented Jul 30, 2021

Brief overview of PR changes/additions

Adds commands to make the text in commandline selected.

Implements the command selectCmdLineText() together with the Geyser CommandLine variant Geyser.CommandLine:selectText()

Examples:

  • selectCmdLineText() -- selects all text in the main command line
  • selectCmdLineText('extraCmdLine') -- selects the text in the command line named extraCmdLine
  • extraCmdLine:selectText() -- same as above, but using a Geyser.CommandLine stored assigned to extraCmdLine

Motivation for adding to Mudlet

Implements requested command from issue #5277

Other info (issues closed, discussion etc)

See #5277 for more comments.

Testing

To test this I created an extra commandline with the following lua script:

inputContainer = inputContainer or Adjustable.Container:new({
x = 0, y = "-4c",
name = "InputContainer", padding = 2,
width = "100%", height = "4c",
autoLoad = false
})

extraCmdLine = extraCmdLine or Geyser.CommandLine:new({
name = "extraCmdLine",
x = 0, y = 0, width = "100%", height = "100%"
}, inputContainer)

inputContainer:attachToBorder("bottom")

After that I called the functions as in the above examples using a temptimer to give enough time to make changes, deselect text etc:
lua tempTimer(2, function() selectCmdLineText() end)

Release post highlight

Added functions to select all text from the commandline

@chrio chrio requested a review from a team as a code owner July 30, 2021 16:30
@chrio chrio requested review from a team July 30, 2021 16:30
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jul 30, 2021

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

if (n >= 1) {
name = CMDLINE_NAME(L, 1);
}
auto commandline = COMMANDLINE(L, name);
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.

warning: local copy name_ of the variable name is never modified; consider avoiding the copy [performance-unnecessary-copy-initialization]

auto commandline = COMMANDLINE(L, name);
                       ^
src/TLuaInterpreter.cpp:166:23: note: expanded from macro 'COMMANDLINE'
        const QString name_ = (_name);                                                         \
                      ^

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This wasn't added by your code, we can ignore this warning 👍

Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

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

Looks quite good, thank you!

@Kebap?

@vadi2 vadi2 merged commit 5a39588 into Mudlet:development Aug 2, 2021
@chrio chrio deleted the add_selectCmdLine_function#5277 branch August 4, 2021 08:59
@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Sep 11, 2021

Docs for new functions are missing.

@vadi2 vadi2 added this to the 4.13.0 milestone Sep 11, 2021
@vadi2 vadi2 added the needs documentation This pull request changes things the players would use/see and thus needs an update in the manual label Sep 11, 2021
}


// Documentation: https://wiki.mudlet.org/w/Manual:Lua_Functions#selectCmdLineText
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.

Added said documentation to wiki

@Kebap Kebap removed the needs documentation This pull request changes things the players would use/see and thus needs an update in the manual label Sep 20, 2021
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.

4 participants