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

Add Command Line Tab Complete blacklist #6509

Merged
merged 9 commits into from
Mar 4, 2023

Conversation

CorTheWin
Copy link
Contributor

@CorTheWin CorTheWin commented Jan 21, 2023

Brief overview of PR changes/additions

This changes adds Add/Remove/ClearCmdLineBlacklist which allows a user to blacklist any words from being used in Tab complete.

Motivation for adding to Mudlet

allow for slightly more customized tab completion filtering for words/names in middle of fights. Ex: Allows you to blacklist allied names with similar spellings to enemies names on tab complete.

Other info (issues closed, discussion etc)

none known

@CorTheWin CorTheWin requested a review from a team as a code owner January 21, 2023 05:38
@CorTheWin CorTheWin requested review from a team January 21, 2023 05:38
@mudlet-machine-account mudlet-machine-account added this to the 4.17.0 milestone Jan 21, 2023
@add-deployment-links
Copy link

add-deployment-links bot commented Jan 21, 2023

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.

@CorTheWin CorTheWin changed the title Command Line Tab Complete changes Add Command Line Tab Complete blacklist and priority Jan 21, 2023
@Kebap Kebap modified the milestones: 4.17.0, 4.18.0 Jan 21, 2023
@Kebap
Copy link
Contributor

Kebap commented Jan 21, 2023

Thanks for your interesting suggestion!
Please be aware that Mudlet is currently in feature freeze for the upcoming 4.17 release.
That means, this PR will be reviewed and hopefully included in due time afterwards.

…ab complete was initially built, still adding the blacklist and with the open possibility to add a config option to remove the buffer autoadd
@CorTheWin CorTheWin changed the title Add Command Line Tab Complete blacklist and priority Add Command Line Tab Complete blacklist Jan 28, 2023
@mudlet-machine-account mudlet-machine-account modified the milestones: 4.18.0, 4.17.0 Jan 28, 2023
@Kebap Kebap modified the milestones: 4.17.0, 4.18.0 Feb 3, 2023
@vadi2 vadi2 self-assigned this Feb 27, 2023
@vadi2 vadi2 modified the milestones: 4.18.0, 4.17.0 Feb 27, 2023
@vadi2
Copy link
Member

vadi2 commented Feb 27, 2023

A quick update - because 4.17 was delayed, the feature freeze was reset and this improvement will make it into 4.17 should it all work well.

Copy link
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

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

🤔 I think the fact that this only works local to a single command line is not what is wanted - I'd move this (and someone will have to do the other (QSet<QString> TCommandLine::commandLineSuggestions) to the TMainConsole and get the getters/setters work on that...

src/TCommandLine.cpp Outdated Show resolved Hide resolved
src/TCommandLine.cpp Outdated Show resolved Hide resolved
src/TCommandLine.cpp Outdated Show resolved Hide resolved
@@ -121,6 +124,8 @@ public slots:
char** mpSystemSuggestionsList = nullptr;
char** mpUserSuggestionsList = nullptr;
QSet<QString> commandLineSuggestions;
QSet<QString> tabCompleteBlacklist;

Copy link
Member

Choose a reason for hiding this comment

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

Unneeded as well. 😉

Suggested change

Comment on lines +1315 to +1329
void TCommandLine::addBlacklist(const QString& word)
{
tabCompleteBlacklist += word;
}

void TCommandLine::removeBlacklist(const QString& word)
{
tabCompleteBlacklist.remove(word);
}

void TCommandLine::clearBlacklist()
{
tabCompleteBlacklist.clear();
}

Copy link
Member

Choose a reason for hiding this comment

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

See other Note A.

Comment on lines 126 to +127
QSet<QString> commandLineSuggestions;
QSet<QString> tabCompleteBlacklist;
Copy link
Member

Choose a reason for hiding this comment

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

Note A

I don't know if the coder of the commandLineSuggestions considered this, but it also applies to tabCompleteBlacklist in that this is local to THIS TCommandLine instance so if the user has any additional command lines set up for their game then these things are going to be independent for each command line - which is probably NOT what is wanted. TBH If I was using this I might even have a separate "command lines" put aside to enter the names of friends and foes in.

As a separate coding note these are also public so having dedicated getters and setters introduces pointless calling overheads - the callers could just as easily call the Qt methods in those methods directly.

src/TCommandLine.cpp Outdated Show resolved Hide resolved
src/TCommandLine.cpp Outdated Show resolved Hide resolved
@vadi2
Copy link
Member

vadi2 commented Feb 28, 2023

@SlySven I think it is actually desired that it only works on a single command line. Just because you don't want certain words to be used for auto-completion in the main command line, it doesn't mean that all command lines in a profile should not autocomplete it too.

It would be nice if you could make this list be per-command line as well but lets wait if there's player interest in it.

@SlySven
Copy link
Member

SlySven commented Feb 28, 2023

It would be nice if you could make this list be per-command line as well but lets wait if there's player interest in it.

Well as written it is - let's ask @CorTheWin which they intended?

Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
@vadi2
Copy link
Member

vadi2 commented Mar 4, 2023

@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 Mar 4, 2023
@vadi2 vadi2 merged commit 6e0573d into Mudlet:development Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs documentation This pull request changes things the players would use/see and thus needs an update in the manual
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants