Port rest of scripting API to QJSValue-based solution

Authored by dhaumann on Aug 15 2017, 8:10 PM.



This completes the scripting API for QJSValue-based Cursor and Range functions. The changes are rather simple, sometimes code is just moved around to make the header file more readable.

Test Plan

make test succeeds.

Diff Detail

R39 KTextEditor
Lint Skipped
Unit Tests Skipped
dhaumann created this revision.Aug 15 2017, 8:10 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 15 2017, 8:10 PM
Restricted Application added subscribers: Frameworks, kwrite-devel. · View Herald Transcript
carewolf accepted this revision.Aug 15 2017, 8:12 PM

Looks good to me

This revision is now accepted and ready to land.Aug 15 2017, 8:12 PM
cullmann edited edge metadata.Aug 16 2017, 7:31 AM

Question: Do we need the overloads with the KTextEditor::Cursor at all or should we limit that to line/column + QJSValue?

A few of the cursor/range functions are used, but not all of them. You could probably rewrite the places using them to use line+col instead.

Yes, Allen is correct: Essentially, we could remove all helper functions that use KTE::Range/Cursor. Shall I update the patch?

Think that would be nice.
Then we always have only that tuple of functions, makes it less confusing (and less to maintain).

dhaumann updated this revision to Diff 18307.Aug 17 2017, 8:15 PM

Remove KTextEditor::Cursor and KTextEditor::Range based API. make test still succeeds.

cullmann accepted this revision.Aug 26 2017, 9:11 AM

Looks ok for me.

To shorten the code, I would have used

const auto cursor = cursorFromScriptValue(jscursor);

at most places, but that is taste, the explicit type makes more clear what the type is ;=)