WIP: Extend Scripting API
ClosedPublic

Authored by dhaumann on Dec 6 2017, 8:13 AM.

Details

Summary

This patch extends the KTextEditor scripting API by:

  • String editor.clipboardText()
  • StringList editor.clipboardHistory()
  • void editor.setClipboardText(String text)

What's new here is that we introduced a new keyword 'editor'
similar to 'view' and 'document'. We can extend this editor
object with general purpose functions that are related to
the editor.

For now, this review request is mostly to raise a discussion
about whether we really want to go this way, or whether there
is a better way of adding this.

Test Plan

make test, and playing around with this in
.js functions. Seems to work as expected.

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dhaumann created this revision.Dec 6 2017, 8:13 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptDec 6 2017, 8:13 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
dhaumann requested review of this revision.Dec 6 2017, 8:13 AM
cullmann requested changes to this revision.Dec 8 2017, 5:57 PM

I think that extension idea is good.
The functions won't really fit to document or view and an editor object could be used for other global things, too, without further polluting the global namespace with free functions.

This revision now requires changes to proceed.Dec 8 2017, 5:57 PM

@cullmann Did you intentionally request changes or was that by accident and you meant Accept?

Restricted Application edited subscribers, added: kde-frameworks-devel, kwrite-devel; removed: Frameworks. · View Herald TranscriptMay 10 2018, 7:17 PM
cullmann accepted this revision.May 11 2018, 4:40 AM

;=)
Just missed that.
Why not ;)

This revision is now accepted and ready to land.May 11 2018, 4:40 AM
This revision was automatically updated to reflect the committed changes.

This change introduced changes which broke tests that previously passed.
Please see https://build.kde.org/job/Frameworks%20ktexteditor%20kf5-qt5%20SUSEQt5.9/48/testReport/(root)/TestSuite/

Hi, I appreciate the attention on the test, but as you see in

https://build.kde.org/job/Frameworks%20ktexteditor%20kf5-qt5%20SUSEQt5.9/51/

they work again and the breakage was introduced (by me) in

https://phabricator.kde.org/D13394

Cross-module breakage is ugly :/