Bug 386265 - Shortcuts from used KParts plugins conflict with app shortcuts
Summary: Shortcuts from used KParts plugins conflict with app shortcuts
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: plugin-preview (show other bugs)
Version: Git
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 386596 389683 405488 425937 430473 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-27 20:22 UTC by Friedrich W. H. Kossebau
Modified: 2022-09-24 22:33 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Video (457.54 KB, video/mp4)
2020-11-02 22:33 UTC, Justin Zobel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2017-10-27 20:22:20 UTC
When previewing a document with a KParts plugin which has actions with shortcuts, those will conflict with the shortcuts used by the application itself. Which typically are the shortcuts of the action for the KTextEditor view currently active and any extensions activated for it.

The KXMLGUI framework, as used by Kate or KDevelop, seems not yet prepared for this challenge: having a central view whose actions are also all integrated in the main menu and having a additional tool/util view with additional actions which are not integrated in the main menu. Where both have shortcuts and might even have the same, like for copy or search actions.
When the tool/util view has the focus, one would assume its gets activated for the registered shortcuts, while if any other part of the app has focus, its shortcuts are ignored/secondary (unless unique). Not sure, needs more thinking.
Comment 1 Friedrich W. H. Kossebau 2017-11-06 19:48:22 UTC
*** Bug 386596 has been marked as a duplicate of this bug. ***
Comment 2 Friedrich W. H. Kossebau 2018-01-31 11:49:31 UTC
*** Bug 389683 has been marked as a duplicate of this bug. ***
Comment 3 Justin Zobel 2020-11-02 02:02:46 UTC
I haven't been able to reproduce the Ctrl A or Ctrl S issues of the linked bug reports so I'm going to resolve this for now. If others report issues we can look into it again but no reports have been received since January 2018.
Comment 4 Kåre Särs 2020-11-02 14:58:49 UTC
Hello,

I'm reopening this because it is still reproducible with latest packages on Neon. 

Steps to reproduce:

1) Open a Markdown file and see the markdown opened in the Okular KPart in the preview tool-view.

2) Try to press space or selecting everything with Ctrl-A in the editor part.
Comment 5 Justin Zobel 2020-11-02 22:33:43 UTC
Created attachment 132973 [details]
Video

I tried to reproduce this but can't.
Comment 6 Simone Gaiarin 2020-11-03 06:50:29 UTC
I can confirm the issue with space, Ctrl+A, Ctrl+S when editing a markdown file. I reset the Kate keyboard shortcuts to their defaults using the 'Default' button in the dialog before testing.

Operating System: Manjaro Linux
Kate version: 20.08.1
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Kernel Version: 5.4.72-1-MANJARO
OS Type: 64-bit
Comment 7 Kåre Särs 2020-11-03 07:27:05 UTC
I think the difference here is the KPart that is loaded. It seems my system loads the Ocular part while Justin's system it loads the markdownpart. Installing markdownpart makes this issue go away for markdown files, but the underlying problem with shortcuts and multiple KParts in one application is still there.... I wonder if this bug should be moved to KPart?
Comment 8 Justin Zobel 2020-11-03 07:32:52 UTC
(In reply to Kåre Särs from comment #7)
> I think the difference here is the KPart that is loaded. It seems my system
> loads the Ocular part while Justin's system it loads the markdownpart.
> Installing markdownpart makes this issue go away for markdown files, but the
> underlying problem with shortcuts and multiple KParts in one application is
> still there.... I wonder if this bug should be moved to KPart?

I'm happy to test the Okular KPart if you explain the steps to test.
Comment 9 Kåre Särs 2020-11-03 07:35:12 UTC
I think you just need to uninstall the markdownpart for the test
Comment 10 Friedrich W. H. Kossebau 2020-11-03 12:01:16 UTC
Be reminded that the KPart preference is taken from the global Plasma System Settings, and there in the "File Associations" page.
Select the MIME type "text/markdown" and in the "Embedding" tab in the "Service Preference Order" group make sure "Markdown View (markdownpart)" is on top of the list.

No need for install/uninstall here.
Comment 11 Kåre Särs 2020-11-12 12:03:41 UTC
*** Bug 425937 has been marked as a duplicate of this bug. ***
Comment 12 Ganton 2021-02-25 21:28:22 UTC
*** Bug 430473 has been marked as a duplicate of this bug. ***
Comment 13 Armin 2021-05-17 01:03:02 UTC
I believe I am experiencing the same bug, though in a slightly different form/setup.

In my setup, I use kate in a vertical split-view mode with a terminal view at the bottom of the window and the "Documents" view on the left.  I have defined a shortcut (Alt+x) to toggle the focus between the editor window and the terminal plugin.  I have been using this setup without problems for more than 5 years.  With the most recent update from Fedora 31 to 34 this initially also works,  but after some time (without any modifications in the settings) this results in an "Ambiguous shortcut detection error".

To be more precise, I started with a fresh setup (also tested it with a completely new user accounted) and while using the editor for several hours, and excessively using the Alt+x shortcut, the "Ambiguous shortcut detection error" appears out of the blue.  I checked all configuration files and could not find a second usage of the "Alt+x" shortcut anywhere.  Also, redefining the shortcut to "Alt+z" makes the setup work again for some time, but eventually leads to the same error (and again, I could not find any usage of the Alt+z shortcut either, not in the settings menus accessed via the GUI nor by "greping" the ~/.config, ~/.local /etc or /usr directories).

The very strange thing is that the error only occurs with a delay indicating that it is not in any of the user-editable configuration files as that would most definitely trigger the issue straightaway.

Also to note, there is a 10 year old bug report which seems relevant here and that recently got revived: https://bugs.kde.org/show_bug.cgi?id=188764


SOFTWARE/OS VERSIONS:
 OS: Fedora 
 Kernel: x86_64 Linux 5.11.19-300.fc34.x86_64
 DE: KDE 5.81.0 / Plasma 5.21.5
 WM: KWin
 CPU: Intel Core i7-7600U
 GPU: Mesa Intel(R) HD Graphics 620
Comment 14 Bug Janitor Service 2021-05-27 21:13:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/419
Comment 15 Christoph Cullmann 2021-05-29 12:13:00 UTC
Git commit 40ec8280266a89052612cef289a24caf172690bd by Christoph Cullmann, on behalf of Christoph Roick.
Committed on 29/05/2021 at 12:11.
Pushed by cullmann into branch 'master'.

Work around conflicting shortcuts in preview plugin

Do not let shortcuts issued within a preview widget
propagate to the application's shortcut event handler.
Instead handle the event while it's still a ShortcutOverride
event to prevent the detection of seemingly ambiguous
shortcuts.
Also do not let actions defined inside the preview KPart
capture shortcuts that are handled on the application level.
Related: bug 407869

M  +26   -0    addons/preview/kpartview.cpp
M  +4    -0    addons/preview/kpartview.h

https://invent.kde.org/utilities/kate/commit/40ec8280266a89052612cef289a24caf172690bd
Comment 16 Christoph Cullmann 2022-09-24 22:17:58 UTC
*** Bug 405488 has been marked as a duplicate of this bug. ***