dhaumann requested changes to this revision.
dhaumann added a comment.
This revision now requires changes to proceed.


  The KTextEditor::Command implementation is wrong, see my other comments. 
Please fix this first :-)

INLINE COMMENTS

> plugin_kateopenselection.cpp:80
> +{
> +    return new PluginViewKateOpenSelection(this,mainWindow);
> +}

A PluginViewKateOpenSelection instance is created here for every 
KTextEditor::MainWindow - this is ok and works as designed / intended.

However, PluginViewKateOpenSelection inherits KTextEditor::Command, which 
itself registers in its constructor with the command "open-selection" in the 
Kate's command line. Now when you create multiple  MainWindows in Kate (View > 
New Window), then you will add *the same* "open-selection" command twice, which 
is wrong.

In short: PluginViewKateOpenSelection must not inherit KTextEditor::Command. 
Instead, the PluginKateOpenSelection should inherit it.

> plugin_kateopenselection.cpp:107
> +        if (selection.isEmpty()) {
> +            const KTextEditor::Cursor &cursor = editView->cursorPosition();
> +            const QString line = editView->document()->line(cursor.line());

Please factor this code part out into a separate function: QString 
findPathAtCursor(...).

Reasoning: Currently, you are mixing different levers of logic, i.e. 
slotOpenSelection() should open the selection, but not itself do the work to 
find the path under a cursor.

REPOSITORY
  R40 Kate

REVISION DETAIL
  https://phabricator.kde.org/D22199

To: nononux, dhaumann
Cc: dhaumann, pino, yurchor, kwrite-devel, kde-doc-english, gennad, 
fbampaloukas, domson, michaelh, ngraham, demsking, skadinna, cullmann, sars

Reply via email to