Bug 314530 - [PATCH] "highlight selection" plugin is missing from kate since update to kde 4.10
Summary: [PATCH] "highlight selection" plugin is missing from kate since update to kde...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: VHI normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 314957 315120 315795 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-06 16:18 UTC by Dorian Scholz
Modified: 2013-02-26 09:37 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.1


Attachments
proposed patch (1.35 KB, patch)
2013-02-08 01:48 UTC, Loïc Yhuel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dorian Scholz 2013-02-06 16:18:41 UTC
Today I updated KDE from 4.9 to 4.10 and kate is not showing the "highlight selection" plugin (hlselection) anymore.

The plugin is not visible in the extension manager anymore and also does not highlight seletected words anymore.


Reproducible: Always

Steps to Reproduce:
1. update to KDE 4.10 (on Ubuntu 12.04 using ppa:kubuntu-ppa/backports)
2. in Kate open menu Settings > Configure Kate
3. look at Editor Component > Extensions

Actual Results:  
I see no entry for Highlight Selection...

Expected Results:  
I saw this entry befor and had working highlighting in the editor.

Ubuntu 12.04
gnome-fallback session
ppa:kubuntu-ppa/backports
Comment 1 Dorian Scholz 2013-02-06 16:29:04 UTC
This feature can be seen here in action, just so we are clear what I'm talking about: http://kate-editor.org/2010/11/14/highlight-selected-text/

The only bug entry I found regarding this plugin has been fixed for a long time and is likely not related, even if the symptoms are the same: https://bugs.kde.org/show_bug.cgi?id=275548
Comment 2 Dorian Scholz 2013-02-06 16:48:14 UTC
Figured out how to get it working again...still a bug though.

On the console kate only showed 4 other plugins:
kate(9195)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ktexteditorexporter"
kate(9195)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ktexteditorinsertfile"
kate(9195)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 1 offers for "ktexteditorautobrace"
kate(9195)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "kdeviconinserter"

But the hlselection plugin's files actually exsist on my system:
$ locate hlselection
/usr/lib/kde4/ktexteditor_hlselection.so
/usr/share/kde4/services/ktexteditor_hlselection.desktop

Comparing the desktop files of the working plugins to the non-working one revealed only one significant difference:
$ grep X-KDE-Version /usr/share/kde4/services/ktexteditor_hlselection.desktop /usr/share/kde4/services/ktexteditor_insertfile.desktop
/usr/share/kde4/services/ktexteditor_hlselection.desktop:X-KDE-Version=4.3
/usr/share/kde4/services/ktexteditor_insertfile.desktop:X-KDE-Version=4.0

When I changed the X-KDE-Version to 4.0 in hlselection's desktop file, it showed up in kate again is is now working.
Setting the value to 4.1, 4.2 or 4.10 hides the plugin, setting it to 4.0 shows it again (kate needs two restarts to pick up the change though).
So this actually seems to be some bug in the version comparison...
Comment 3 Burkhard Lück 2013-02-07 03:24:24 UTC
Confirmed in 4.10 + master compiled from sources
Comment 4 Loïc Yhuel 2013-02-08 01:48:43 UTC
Created attachment 76999 [details]
proposed patch

In KatePartPluginManager::setupPluginList(), it uses "([X-KDE-Version] >= 4.0) and ([X-KDE-Version] <= 4.10" constraint when querying the plugins.
It's doing float comparison, so 4.3 > 4.10.

I don't see a way to check the version using the constraint, but it can be done in C++ instead.
Comment 5 Dominik Haumann 2013-02-08 09:56:16 UTC
@Dorian and Loïc: Good catch.
Imo the patch looks good, but I haven't tested it yet, since I'm still on KDE 4.9.

@Kate devs: can you look into this?
Comment 6 Marian Kyral 2013-02-08 23:25:10 UTC
Tested on gentoo. Compillation OK,  works as expected.

Thanks a lot.
Comment 7 Kyrylo Bohdanenko 2013-02-09 12:57:04 UTC
Can approve too. Tested on kubuntu 12.10. Works fine.
Comment 8 FiNeX 2013-02-09 13:10:25 UTC
I didn't tested the patch but I really hope to have this functionality back to Kate.
Comment 9 Tonurics 2013-02-10 00:20:31 UTC
Tested manual fix on Arch Linux: works.
Comment 10 Andreas Sturmlechner 2013-02-10 13:51:03 UTC
Tested on Gentoo and confirmed fixed with the patch. :)
Comment 11 Dominik Haumann 2013-02-10 21:18:50 UTC
Git commit f934575613d7efc60b9b6be6203c777d42ab7ffc by Dominik Haumann.
Committed on 10/02/2013 at 22:18.
Pushed by dhaumann into branch 'KDE/4.10'.

fix plugin loading in KDE SC 4.10.0

Thanks to Dorian and Loïc for finding the root of this issue.
FIXED-IN: 4.10.1

M  +14   -6    part/utils/katepartpluginmanager.cpp

http://commits.kde.org/kate/f934575613d7efc60b9b6be6203c777d42ab7ffc
Comment 12 Dominik Haumann 2013-02-10 21:30:37 UTC
Git commit 3adf3cc5473c533f382ae8a481e452289a56bab3 by Dominik Haumann.
Committed on 10/02/2013 at 22:18.
Pushed by dhaumann into branch 'master'.

fix plugin loading in KDE SC 4.10.0

Thanks to Dorian and Loïc for finding the root of this issue.
FIXED-IN: 4.10.1

M  +14   -6    part/utils/katepartpluginmanager.cpp

http://commits.kde.org/kate/3adf3cc5473c533f382ae8a481e452289a56bab3
Comment 13 Will Stephenson 2013-02-11 20:05:24 UTC
Did anyone look at fixing this properly in kdelibs yet?
Comment 14 Mike Robinson 2013-02-12 00:54:28 UTC
*** Bug 314957 has been marked as a duplicate of this bug. ***
Comment 15 Dominik Haumann 2013-02-12 08:42:05 UTC
@Will: no, and I'm not even sure it's a real kdelibs issue.

@David: see commit diff above:
  KService::List traderList = KServiceTypeTrader::self()->query("KTextEditor/Plugin",
    "([X-KDE-Version] >= 4.0) and ([X-KDE-Version] <= "
    + QString("%1.%2").arg(KDE::versionMajor()).arg(KDE::versionMinor()) + ')');

Here, "4.3 <= 4.10" did not hold, if I understand correctly.
Comment 16 Burkhard Lück 2013-02-15 05:40:01 UTC
*** Bug 315120 has been marked as a duplicate of this bug. ***
Comment 17 David Faure 2013-02-15 10:03:55 UTC
4.3 is not smaller than 4.10, ask any mathematician :-)

The examples in the KMimeTypeTrader documentation show integer numbers, for "the version of the interface used by the plugins". If the interface didn't change between 4.9 and 4.10, there is no real reason to reject the 4.9 plugins, is there?

Or if there is, just use an integer that increases everytime, or even simply 100 * versionMajor + versionMinor.
Comment 18 Dominik Haumann 2013-02-26 09:37:39 UTC
*** Bug 315795 has been marked as a duplicate of this bug. ***