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
Enable adding custom input lines #1897
Comments
All 💡
Updated: done, with follow up work in progress... |
I strongly oppose replacing simple booleans with the more complicated bitwise flags - I'm having a hard enough time dealing with the existing ones that have been added 😞 Bitwise flags do make sense when you have gigabytes of repeating data, but here we're dealing with a few booleans, let's keep the code simple and approachable. |
Updated: done, with follow up work in progress... |
🤔 that makes sense if it's a single state. The pain I was specifically referring to was when multiple states are being saved in a bitflag. |
Yeah, fair enough, for instance there might be an inclination to include the docked/floating state in such an enum to distinguish between them for floating/dockable (user) windows - whereas it is clear you would want that to be flagged completely separately - I will take that on-board! 😉 |
As soon as it becomes multi-state, it should be booleans. Bitwise flags are not simple or fun to deal with - I've given it a fair go. |
Isn't the list above (with the exception of floating/dockable) mutually exclusive? In that case, I agree with @SlySven about using an enum (but without explicitly listing the values as powers of 2, because you shouldn't if (mType == Type::MainConsole || mType == Type::SubConsole || mType == Type::UserWindow) {
layerCommandLine->show();
} else {
layerCommandLine->hide();
} I also agree with @vadi2 that as soon as we have multiple states to handle, it's better to use different members for them: One for dockable and one for the type for example. Bitwise flag sare just not very readable and have the tendencies to lump unrelated stuff together. |
When the condition/types ARE mutually exclusive then the use of powers of two (and which then enables the use of |
Another request for this maybe? See #2146 |
Well I've done the classifying the |
just to add this we need to consider how aliases will respond to the different console/window other than the main console. maybe to add "console" so it will know which to respond or not to respond to:
|
Depending on what we want to allow in the mini-console / user window command line we may need a |
I don't see why - the usr clicks on an input line in a miniconsole, it'll get the focus. We'll be okay here! |
But isn't that PR about making the input focus stay in/go back to the main |
Yeah, somewhere in the text part - but this input line part would be exempt :) |
I would imagine, if I click into a text area of a miniconsole, and that miniconsole has its own custom input line, then I would expect my focus to go in that input line, not back in the main window. |
Using QString::toLatin1() when transferring text to and from the Hunspell library will miss-encode any characters that are not in the ISO 8859-1 (Latin 1) character set and will not work if used with languages that use characters outside of that set. The existing code only installed the user selected dictionary for spell- checking in the constructor of the `TCommandLine` class instances which meant that changes with the profile active did not take effect until the next profile load - which is less user friendly than changing it when requested. This commit corrects that problem. At the moment there is (or should be?) only one `TCommandLine` per profile - for the Main Console. I have chosen to use the signal/slot method for the `Host` class to inform the rest of the profile that the dictionary has been changed. This is so it can be extensible in the future if Mudlet#1897 is implemented, so that we could: 1. centralise access to a profile dictionary 2. provide a custom dictionary for each profile 3. give Lua API access to both a custom and indeed the selected dictionary although we will probably want to consider moving the code accessing the Hunspell library to the main profile `TConsole` class. I have also added a qDebug() line to report on the loading of a dictionary, during development of this PR the output from this showed me that each dictionary could have a different character encoding and that it was essential to use the indicated one when transferred text into and out of the Hunspell library. Further exploration of that library also revealed that there was an extra return value from the Hunspell_spell(...) call. It is necessary to include both the C and the C++ header file for it to be available. This value indicated that the word was spelt correctly but there was some problem with it. I originally thought that it was a marker for obscene words and decided to include handling that in the spell-checker. However testing revealed that that did not appear to be the case. The exact meaning of the HUNSPELL_OK_WARN value is not currently clear to me, but since they make the information available I decided to use it. Should a word be flagged in that way it will be underlined in a blue dash-dot line (to distinguish it from the wavy red line that is used for misspelled words). Remove useless cruft from class: * (bool) TCommandLine::mAutoCompletion * (QPalette) TCommandLine::mAutoCompletionPalette * (QString) TCommandLine::mAutoCompletionTyped * (QMap<QString, int>) TCommandLine::mHistoryMap * (QString) TCommandLine::mLastCompletion * (bool) TCommandLine::mTabCompletion * (QPalette) TCommandLine::mTabCompletionPalette Clean up initialisation list. Improve the context menu action so that the spelling suggestions are presented on top of the normal context menu rather than separately as (before). Fixup some CLazy else-after-return code style warnings. The context menu spelling checker will now report "no suggestions" rather than producing no information at all if it cannot find a suggestion which helps to make it different from the case where the word is correctly spelled. Replace one use of `for (;;)` with the more obvious `forever`. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…rs (#2269) Using QString::toLatin1() when transferring text to and from the Hunspell library will miss-encode any characters that are not in the ISO 8859-1 (Latin 1) character set and will not work if used with languages that use characters outside of that set. The existing code only installed the user selected dictionary for spell- checking in the constructor of the `TCommandLine` class instances which meant that changes with the profile active did not take effect until the next profile load - which is less user friendly than changing it when requested. This commit corrects that problem. At the moment there is (or should be?) only one `TCommandLine` per profile - for the Main Console. I have chosen to use the signal/slot method for the `Host` class to inform the rest of the profile that the dictionary has been changed. This is so it can be extensible in the future if #1897 is implemented, so that we could: 1. centralise access to a profile dictionary 2. provide a custom dictionary for each profile 3. give Lua API access to both a custom and indeed the selected dictionary although we will probably want to consider moving the code accessing the Hunspell library to the main profile `TConsole` class. I have also added a qDebug() line to report on the loading of a dictionary, during development of this PR the output from this showed me that each dictionary could have a different character encoding and that it was essential to use the indicated one when transferred text into and out of the Hunspell library. Remove useless cruft from class: * (bool) TCommandLine::mAutoCompletion * (QPalette) TCommandLine::mAutoCompletionPalette * (QString) TCommandLine::mAutoCompletionTyped * (QMap<QString, int>) TCommandLine::mHistoryMap * (QString) TCommandLine::mLastCompletion * (bool) TCommandLine::mTabCompletion * (QPalette) TCommandLine::mTabCompletionPalette Clean up initialisation list. Improve the context menu action so that the spelling suggestions are presented on top of the normal context menu rather than separately as (before). Fixup some CLazy else-after-return code style warnings. The context menu spelling checker will now report "no suggestions" rather than producing no information at all if it cannot find a suggestion which helps to make it different from the case where the word is correctly spelled. Replace one use of `for (;;)` with the more obvious `forever`. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@epsilon-phase @druuimai @Symple85 help test it over at #4055 (comment) :) |
Brief summary of issue / Description of requested feature:
When creating a miniconsole/userwindow, it would be nice for it to have a seperate input line of its own, where you can input text, which will then be processed by functions for that specific window.
Steps to reproduce the issue / Reasons for adding feature:
Error output / Expected result of feature
Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:
Discussion on Discord with demonnic, Kasa, Vadi, etc.
The text was updated successfully, but these errors were encountered: