D19795: Add Variable interface to KTextEditor::Editor

2019-03-18 Thread Dominik Haumann
dhaumann added a comment. It's committed now: - quoting is now not supported at all anymore - expandText() now returns void REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D19795 To: dhaumann, cullmann Cc: kwrite-devel, kde-frameworks-devel, gennad, domson,

D19795: Add Variable interface to KTextEditor::Editor

2019-03-18 Thread Dominik Haumann
This revision was automatically updated to reflect the committed changes. Closed by commit R39:a4083c7cf0d6: Add Variable interface to KTextEditor::Editor (authored by dhaumann). REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D19795?vs=54264&id=54265 REVISI

D19795: Add Variable interface to KTextEditor::Editor

2019-03-18 Thread Dominik Haumann
dhaumann updated this revision to Diff 54264. dhaumann added a comment. This revision is now accepted and ready to land. - Drop KWordMacroExpander in favor of own simple implementation (50 slocs) REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D19795?vs=54

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann planned changes to this revision. dhaumann added a comment. Will do another change: since recursive expansion of macros is not supported by KMacroExpander (e.g. %{JS:if(true) %{Document:Selection}}), I'll provide an implementation that does not use KMacroExpander at all. Have that wo

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Christoph Cullmann
cullmann accepted this revision. cullmann added a comment. This revision is now accepted and ready to land. Looks reasonable to me and the interface is nicely minimal ;=) REPOSITORY R39 KTextEditor BRANCH variable-interface REVISION DETAIL https://phabricator.kde.org/D19795 To: dhauma

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann updated this revision to Diff 54089. dhaumann added a comment. - Enum: Use NoQuoting and ShellQuoting REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D19795?vs=54078&id=54089 BRANCH variable-interface REVISION DETAIL https://phabricator.kde.

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Christoph Cullmann
cullmann added a comment. Ok, then I am fine with this beside that I think the Quoting stuff should be more explicit that it is "Shell" quoting. Isn't it even different for Windows vs. unices? I still think QuotationMode NoQuoting + ShellQuoting would be more easy to understand. WhenNeede

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann added a comment. In D19795#432612 , @cullmann wrote: > Hmm. the Variable class and files is just an artifact now or? Yes, it's just used internally. Without it, I'd need to add ugly std::tuple into the QHash. It's still in the KT

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Christoph Cullmann
cullmann added a comment. Hmm. the Variable class and files is just an artifact now or? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D19795 To: dhaumann, cullmann Cc: kwrite-devel, kde-frameworks-devel, gennad, domson, michaelh, ngraham, bruns, demsking, cullma

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann updated this revision to Diff 54078. dhaumann added a comment. - Support optional quoting, default is Never REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D19795?vs=54069&id=54078 BRANCH variable-interface REVISION DETAIL https://phabricato

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Christoph Cullmann
cullmann added a comment. Hmm, I am actually not sure we want the quoting per default at all. You use expandMacrosShellQuote, I am not sure that that is that often wanted (at least not if not passing to commandline/shell). Perhaps the Enum should more state "NoQuoting, ShellQuoting, ..."

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann added a comment. Unfortunately, I still see one issue: In the unit test, expanding the variable to "World" works, but expanding it to "Smart World" leads to single-quoted text "'Smart World'" because of the space. That of course makes sense, but is not always what you want. The

D19795: Add Variable interface to KTextEditor::Editor

2019-03-17 Thread Dominik Haumann
dhaumann updated this revision to Diff 54069. dhaumann added a comment. - Hide class Variable REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D19795?vs=53975&id=54069 BRANCH variable-interface REVISION DETAIL https://phabricator.kde.org/D19795 AFFEC

D19795: Add Variable interface to KTextEditor::Editor

2019-03-16 Thread Christoph Cullmann
cullmann added a comment. I think without the Variable class it would be nicer. One can extend it later easier, too, by just adding a new overload with a different function type (if needed). REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D19795 To: dhaumann, cu

D19795: Add Variable interface to KTextEditor::Editor

2019-03-15 Thread Dominik Haumann
dhaumann added a comment. What I wonder is whether we really need the "Variable" class. Maybe it would be better to just have - registerExactMatch(QString name, QString description, function) - registerPrefixMatch(QString prefix, QString description, function) If such a change woul

D19795: Add Variable interface to KTextEditor::Editor

2019-03-15 Thread Dominik Haumann
dhaumann created this revision. dhaumann added a reviewer: cullmann. Herald added projects: Kate, Frameworks. Herald added subscribers: kde-frameworks-devel, kwrite-devel. dhaumann requested review of this revision. REVISION SUMMARY The Variable interface allows to register either exact matches