Edbee editor implementation, take two#985
Edbee editor implementation, take two#985vadi2 merged 39 commits intoMudlet:developmentfrom tomcss:development
Conversation
There was a problem hiding this comment.
To allow the project to compile I think you will have to add the Edbee source files into our (recently fitted) 3rdParty sub-directory and add the build instructions to the qmake (top level /src/src.pro and additional .pro files in sub-directories for 3rd party items) and cmake (CMakeList.txt files in main and sub-directories) project build systems...
... our Travis C.I. setup may need tweaking - although adding the source files and emending/supplementing the project files in may be sufficient
src/dlgTriggerEditor.cpp
Outdated
| mpTriggersMainArea->lineEdit_trigger_name->clear(); | ||
| mpTriggersMainArea->perlSlashGOption->setChecked( false ); | ||
| mpSourceEditor->clear(); | ||
| mpSourceEditorEdbeeDocument->setText(""); |
There was a problem hiding this comment.
It doesn't have a clear() method to remove the contents?
Please avoid using raw string literals {we will only have to go through later and mark whether they are part of the UI and need marking as something that has to be translated (or not) for Mudlet 4.0...} - I'd suggest the following:
mpSourceEditorEdbeeDocument->setText(QString());
There was a problem hiding this comment.
There isn't a clear. http://docs.edbee.net/html/classedbee_1_1_text_document.html
| <verstretch>0</verstretch> | ||
| </sizepolicy> | ||
| </property> | ||
| <property name="font"> |
There was a problem hiding this comment.
Do you have to specify a font here - if you omit this won't it inherit the parent widget's font - or are you looking to override that here?
| _options.setFlags( _flags ); | ||
| mpSourceEditorDocument->setDefaultTextOption( _options ); | ||
|
|
||
| connect( mpSourceEditor, SIGNAL( cursorPositionChanged() ), this, SLOT( slot_cursorPositionChanged() ) ); |
There was a problem hiding this comment.
You are removing the cursor positioning data from the status bar - does the new widget provide the same sort of information from it's updateStatusTextSignal SIGNAL?
There was a problem hiding this comment.
Cursor positioning isn't necessary anymore because this widget actually has line numbers!
| void slot_color_trigger_fg(); | ||
| void slot_color_trigger_bg(); | ||
|
|
||
| void slot_updateStatusBar( const QString statusText); // For the source code editor |
There was a problem hiding this comment.
This should probably be const QString& statusText.
|
Speaking as someone who is currently hitting the issue face on, how well does this editor widget behave in the presence of non-BMP "characters" or other non-normal things in the text? I see, for instance in that linked to documentation: " Or, I read: " This is a really evil test passage that I have lifted from Stack Exchange: http://stackoverflow.com/a/1732454/4805858 to exercise things to the extreme, the tail end of which, when written as a single single appears thus in the current editor: and when display with the code I am working on in another PR: How well does Edbee work with this, I wonder - 😈 ? |
|
You are making some headway - 2 out of 6 Travis C.I. builds are now completing those being the Linux - Qmake ones (both using whilst the qmake one on MacOS that platform is having 3 problems because a (it also has a warning about something else in the editor library code as well...!) Hope that helps - for the full gory details click on the "Details" link on the: |
|
We've been in contact over discord for the compile stuff:
|
|
Awesome work guys! Keep us posted on the 5.8 support - we must have faith
in any library we adopt that it'll work for us going into the future.
…On Fri, 5 May 2017 5:56 pm keneanung, ***@***.***> wrote:
We've been in contact over discord for the compile stuff:
- The macOS stuff seems to be an issue of Qt 5.8, we should probably
make at least an upstream bug report, if not propose fixes.
- We didn't touch cmake builds yet, especially since the edbee project
needs CMakeLists.txt files made
- I'm also annoyed about the thousands of warnings in the library, but
we're looking at turning warnings off for that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#985 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAGxjJUtlxSF4rjW9mLDVsy0c8dFYOAKks5r20akgaJpZM4NNFOy>
.
|
…re overloads than 5.6
SlySven
left a comment
There was a problem hiding this comment.
Somehow my review comments didn't get posted at the time...
From the screen-shots I can see you have got the status bar done in some way after all - and your "column" value is effectively a "grapheme" count (which I think is appropriate in the context in which we will be using it), so is "offset" equivalent to bytes into the file then?
I am a bit suspicious in that this "new" editor is, IMHO, not just something that can be dropped in but is itself quite a substantial piece of code - is it perhaps, a bit too much for our needs, I wonder? Are there any other project using it that we might see it in action as it were?
.travis.yml
Outdated
| - cd ../build | ||
| - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export LDFLAGS=" -L/usr/local/opt/qt5/lib ${LDFLAGS}"; export CPPFLAGS=" -I/usr/local/opt/qt5/include ${CPPFLAGS}"; fi | ||
| - if [ "${Q_OR_C_MAKE}" = "qmake" ]; then qmake -v; qmake ../src/src.pro && make -j2; else cmake --version; cmake .. && make -j2 && make check; fi | ||
| - if [ "${Q_OR_C_MAKE}" = "qmake" ]; then qmake -v; qmake ../mudlet.pro && make -j2; else cmake --version; cmake .. && make -j2 && make check; fi |
There was a problem hiding this comment.
💭 I do like the idea of renaming the main qmake project file from src.pro to mudlet.pro given that we now have other files in sub-projects that are also called src.pro but changing the build structure so that the original ./src/src.pro is not the "top-level" project file may throw up odd effects - I believe that the communi library is now correctly configured as a sub-project of the original src.pro file and the yajl code has also been moved into a 3rdparty sub-directory position relative to the main application but these changes seem to position the edbee editor as an entity on the same level as the Mudlet application (even though it is also now positioned in a 3rdparty sub-driectory) which may throw up some oddities in getting both of the project build systems to work as intended. 😕
There was a problem hiding this comment.
I'm not into this idea because it would mean everyone compiling Mudlet would stop being able to do so and be really confused until they figure out that we introduced a new, high-level makefile. Is this absolutely mandatory and can we make edbee work without causing a lot of pain to everybody?
Yes, we'll update the instructions, but everyone knows that nobody reads the instructions.
3rdparty/edbee-lib/LICENSE
Outdated
|
|
||
| * Redistributions of source code must retain the above copyright notice, this | ||
| list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright notice, this |
There was a problem hiding this comment.
This means, I think, that the "About Mudlet" dialog might need to include something about this...? Though IANYL !
Definitely not - if you look at user feedback, nobody is saying is saying our current editor is too feature-rich. There is consistent feedback throughout the years that it is too basic. I mean, it can't even do highlighting right when the standard for an IDE these days is auto-completion of functions sorted in the order of usage across the world... |
src/dlgSourceEditorArea.cpp
Outdated
| // QDir::homePath() + "/.config/mudlet/edbee/" | ||
|
|
||
| edbee::TextGrammarManager* grammarManager = ei->grammarManager(); | ||
| edbee::TextGrammar* grammar = grammarManager->readGrammarFile( QDir::homePath() + "/.config/mudlet/edbee/Lua.tmLanguage" ); |
There was a problem hiding this comment.
Put this into the mudlet_alpha.qrc please - see mudlet-mapper.xml for an example of how to load it once there :) that'll ensure the file is always in the application. It won't be overwritable by the users, but we should support custom themes more properly than swapping files around anyhow.
|
Jotting down what we discovered on Discord - the editing widget is corrupted and crashes if you try to select text on all but the latest opened profile. |
…pened. I moved the initialisation code for the editor instance to mudlet.cpp so that it would only get executed once.
|
Yeah, works, nice! What's next for this? |
|
As mentioned on discord, I finished the cmake build of the project and created the PR edbee/edbee-lib#10. So I need to wait a bit until it's accepted, then I'll add the sub-module and integrate edbee into our compilation for good. I also have the feeling that we may be able to get rid of the second project file again. |
|
Here's my take on getting a theme that's closest to what we've got now. It has a few bugs but mostly things I can live with. |
Unfortunatly they can't be platform-specific as they were before
It's incorrect right now as it doesn't actually track modified status.
|
I've filed the rendering error with reproduction steps over at edbee/edbee-lib#23. |
| SLOT(slot_updateStatusBar(QString)) | ||
| ); | ||
| simplifyEdbeeStatusBarRegex = new QRegularExpression(R"(^(.+?) \|)"); | ||
| simplifyEdbeeStatusBarRegex = new QRegularExpression(R"(^(?:\[\*\] )?(.+?) \|)"); |
There was a problem hiding this comment.
👎 I think this will need/ought to be reverted as I suspect fixing the undo/redo history issue will also cure this - so it actually works as intended - i.e. [*] shows up only when the content has been changed from what was initially painted into the widget...
| <string>#D68B78</string> | ||
| <string>#000080</string> | ||
| <key>fontStyle</key> | ||
| <string> bold</string> |
There was a problem hiding this comment.
You have a leading space - is that significant as part of that XML entity?
There was a problem hiding this comment.
It doesn't seem to be - bolding works.
The online editor spits it out that way and edbee doesn't see it as a problem, so I'm leaving it be.
Essential update to mudlet.cpp
clearDocument function - still bugged
|
We've decided to shift it over to the next milestone so we have more time to test edbee, iron out the existing issues, and add new features. I'd also like to merge this PR into |
|
In a recent commit the following change was made: 💡 You may be interested to know that the Qt creators also include an extended: |
|
That's code inside the edbee library, Stephen! Not ours haha. I know this PR has a few issues, but they are minor, and it is getting klunky to track them all. @SlySven per #985 (comment) would you mind if I merged this now and we ironed out the minor issues in the course of the month? The undo bug has been fixed, by the way! |
|
OK, it would be nice if the modified indicator was present on the status bar but I can live without it. With all the changes the commit message for the "Squash and Merge" will be interesting to see...! 😀 |
* Removed duplicate clear event handlers call * Revert back to dev version. 3.3 here we go! * Adds saveWindowLayout() call to AutoSaveOnExit processing. * Edbee editor implementation (#985) * Added a frame to edbee so it looks nicer * Got utf8 module to load (#1074) (update packaging!) * Modified tooltip for Save and Save Profile to clearly indicate their keyboard shortcuts * Added: shortcut for delete action in editor (#1084) * shortcut added for delete action * Removed redundant edbee config related code (#1091) * Delete TScriptEditorManager.h * Delete TScriptEditorManager.cpp * BugFix: import some fixes by "Zolder" from Mudlet (Realms of Legends) fork import: some Zoilder fixes from the MudletRL fork: * in TBuffer::translateToPlainText(...): make some MXP related code execute only if Host::mFORCE_MXP_NEGOTIATION_OFF is NOT set as well as another condition. * in TBuffer::wrap(...): change a for(...) {...} loop termination condition be a "<" rather than a "<=" test - which sounds like an "off-by-one" error fix-up. * In TTextEdit:updateScreenView(): revise code that seems to prevent the width of a "main" console being set too small and NOT written to the "parent" Host::mScreenWidth variable - the original modification removed such a restriction completely, but I have just lowered the minimum from 100 to 40 and ensured it is always stored both in the local "main" console and to the parent record in the Host class for that console. * In TTextEdit::drawForeground(...): revise the behaviour *I think* when at the point where a console "split" becomes unnecessary... Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Cut down on the length of some variable names (#1086) * Clarified use of QLatin1String * Adding GCC 5 for C++14 requirement (#1098) * Fixed "reset map colors" button to work (#1049) * Fixed "reset map colors" button to work That's a 5 year old bug out of the way! * Change travis configuration to use installed gcc-5 (#1108) * Change travis configuration to use installed gcc-5 * Fixes #1104 (#1109) Thanks to Rick for his prompt response on this * Fixed typo in GeyserLabel.lua Per #1112 * Fix locale to C Enforce uniform locale so scripts don't get tripped up on number representation differences (. vs ,) * IRC client update of UI and logic (#1072) * Add Communi Model & Util libs * Full refactor of IRC Client code & UI This retains the primary functions of the old IRC client but adds many more new IRC commands by default. The UI is slightly more organized and interactive now. * Adds QPointer to IRC Dialog pointer variable. * Update Lua `sendIrc()` slightly. * Added /msg command, Input History, and updated display colors. Input History stores a total of 8 previously entered commands the user can cycle through using the Up Arrow key. The previously include /msg command has been added again. Colors of some messages have been updated for (relatively) easier distinction of message lines. * Updated channel handling. * Fix CMake builds Things needed to fix CMake builds: - communi CMake builds needed `include_directories` explicitly specified - more MOC calls in communi - more explicit dependencies to MOC files in communi - ircmessageformatter must be compiled into mudlet * IRC3 with more Lua features (#1087) Changes IRC client to run with settings given per-profile, making the IRC client more visible and configurable within Lua. This adds configuration options to the settings window in the "Special Options" tab for configuring an IRC client on the host profile which opens the settings window. See the PR summary comment for details on available Lua functions and IRC Client commands. * Add a Code of Conduct (#1110) * Create CODE_OF_CONDUCT.md * Fix for the QMake warnings caused by the IRC library includes. * Finished formatting all filed & added braces (#1115) * Finished formatting all filed & added braces * Re-enabled map load on profile load (#1118) * Re-enabled map load on profile load - disabling it broke scripts that relied on map data w/o the map open * updated assignments. * Event-based gamepad functionality (#1106) * Add theme switching to code editor (#1095) * Fix more Toolbar & Button bugs (#1080) (#1090) * Fix bugs with Buttons & Toolbars. - Fixed change detection for location, orienation, and CSS data. - Buttons are not rendered unless they are part of a group, Toolbar/Menu. - ToolBars whos locations are changed now hide their previous TToolBar or TEasyButtonBar instance as needed. * Fix Buttons being left behind when parent toolbar is deleted. Also allows TAction to use QPointer<T> * Update old sourceforge page links (#1132) (#1134) * Fixed blank command separator to not separate as people expect * Replaced isTempKey, isTempAlias, etc with isTemporary (#1102) * also pushed isFolder() and setIsFolder() to the parent Tree class * Give meaning to encodings (#1107) * Delete dev_README Deleted outdated dev_README file. It also didn't seem to be used all that often, else people would have raised the fact that it's outdated... * Update travis to use Qt 5.9 for compiling (#1141) * Re-add single QT 5.6 build job Since we want to keep sure that the minimal Qt version is still compilable (currently we need at least 5.6), we add a single job for that version. * Refactor: rename QMake project/sub-project files (#1103) * refactor: rename QMake project/sub-project files It is down right confusing having several project files in the Qt IDE which are all labelled "src" - this commit renames the main project file from "src.pro" to "mudlet.pro" and also renames: * the lua_yajl module from src.pri to lua_yajl.pri * the luazip module from src.pri to luazip.pri it also: * adds a new communi.pri file (see below) I also took the liberty of renaming the project resource file from: * mudlet_alpha.qrc to mudlet.qrc (we are well past the alpha stage now!) and sorting a couple of items into the right order. By creating a local project file 3rdparty/communi/communi.pri it is possible to group the three separate but related communi libraries into one - as it happens the effective content of the new file is identical to that of the communi libraries own libcommuni/src/src.pri but it has some notes on how the portion of the upstream library that we are using was picked out of there; how to identify the effect version and how to (hopefully) recreate things if upstream gets revised in the future! By not using the upstream "src.pri"/"src.pro" files we avoid the confusion of having a generic "src" project in the Mudlet project as a whole and it is clearly identify-able as a file from the Mudlet project rather than the sub-project that it pulls into the whole thing... There is an minor nuisance side-effect in that having the main project src.pro file open in a Qt Creator IDE or stored in a session will get confused when this commit takes effect as the file will disappear from the repository - it will be necessary to close the project and open the new src/mudlet.pro project file (and possibly re-enter the build steps) - OTOH the main project will now be identified as "mudlet" in Creator rather than the previous "src". 😄 Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Removed accidental debug echo left in (#1151) * initialize int nIrcPort with dlgIRC::DefaultHostPort value. (#1153) * Removes false from sendIrc() return, ignores command filtering status (#1154) * Removes false from sendIrc() return, ignores command filtering status (not used). * Remove punctuation from lua messages * Improved layout of IRC preferences (#1152) * Fix get map events (#1120) * Adapt addMapEvent error messages to current standard * Fix getMapEvents() The function now returns a proper indexed table of objects that each describe a map event. * Add missing call to set Editor as editable. (#1159) * Fixed tab indent to be two spaces again * Fixed getComputerEncoding in case no key found It'll now return the original value passed - it's way better than returning the wrong value. * Add linux ci deployment (#1128) * Modify files needed for CI deployment of linux builds * Syntax fix in .travis.yml * tar the CI AppImages as well * Add lua sqlite runtime dependency * Unset LD variable for linuxdeployqt * Bugfix: unset LD_LIBRARY_PATH in every codepath * Test: install appmenu-qt5 for global menus * Revert 781ef97 (Install appmenu-qt5) The issue was that the first AppImage used Qt 5.6.2 instead of Qt 5.9 (which is how 3.2 was built and how it is build now after merging development in) * Remove manager again (#1163) * Improved map load output to be condensed down if it's all successful (#1117) OK! Would be happy to see that in as well for maps that take a while to load (>1s). * Re-enable search highlighting (#1096) * Remove mainwindow statusbar (#1162) * Replaced statustips with tooltips in the mapper menu * Removed statusbar * Tagging 3.3.0 * Initial QTextToSpeech additions * Further TTS additions and bugfixes * Wrapping TTS functions in #ifdefs for QT_TTS_LIB * Missing #ifdefs * More misplaced #ifdef lines for TTS functions * More QT_TTS_LIB ifs * Adding QTextToSpeech to cmake lists * Various TTS updates * Adding GetState to TLuaInterpreter.h * Minor fixes * Tts temporary fixes * Exchanging toLatin1 with toUtf8 * Fix cmake TTS module includesion * Install Qt 5.9 TTS module on linux * Use Qt provided definition for enabled modules We don't need (and possibly don't want) to provide our own definition for when a module is enabled. Let's use the Qt provided definition instead. * Output confirmation messages of enabled Qt modules * Use upper case "Gamepad" in output * ttsClearQueue crash fix * Fix for global speech events * Whitespace replacement * Various minor fixes * More minor fixes. * Cleanup: make CMakeList.txt have uniform indenting and adjust CMake message The minimum versions of the Qt TextToSpeech and Gamepad reported in the CMake project files needed tweaking. I have also tried to regularise the indentation in the Mudlet CMake project files to standardise on 2 spaces. Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Reformat: clean up code-loyout of new TTS TLuaInterpreter code Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * BugFix: fixup a switch() in (int) TLuaInterpreter::ttsGetState(lua_State*) This switch was missing "break;" on all the cases and must have been defective without them - for all but the last case extra strings would have been pushed onto the lua stack but as the return value was 1 they may have been discarded... Signed-off-by: Stephen Lyons <slysven@virginmedia.com> * Enable Qt 5.9 Windows builds for testing * Deploy Qt 5.9 builds for testing * Fixing double-events for queueing purposes * Added missing symbol * Added missing symbol * Updating tts events to globals and adding voice * Create TTSValues.lua * Adding TTSValues to LuaGlobal * Adding TTSValues to Mudlet project * Update CMakeLists.txt * Update TTSValues.lua * Update Qt to 5.10 for trusty This is needed to hopefully have some TTS backend plugins in Linux * Queueing and crash fixes * Renaming tts funcs * Renaming internal functions * Adding functions for retrieving settings * Fixing typo * Making ttsGetState public * Improve error messages for ttsGetCurrentLine() It can be incredibly frustrating to just get a boolean back as an error message when you don't know what is going on * Update error message to be consistent with the new style * Aligned error messages to be consistent with the new style * Fix ttsClearQueue to return nil+error, not actually error on invalid index * Minor code formatting * Floats to doubles * Update documentation links






Using edbee-lib.
It requires two files in ~/.config/mudlet/edbee, the syntax file and the theme. You can just unzip the following file in ~/.config/mudlet :
edbee.zip
--
Some of the comments showed up as changed with an extra space. I really don't know why - I didn't touch them manually.