https://bugs.kde.org/show_bug.cgi?id=486656

            Bug ID: 486656
           Summary: Selecting text in the navigation widget demolishes
                    clipboard history
    Classification: Applications
           Product: kdevelop
           Version: 5.13.240202
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: m...@theaceblock.dev
  Target Milestone: ---

Created attachment 169236
  --> https://bugs.kde.org/attachment.cgi?id=169236&action=edit
Selection made in KDevelop and the resulting clipboard history

SUMMARY
Selecting text in the navigation widget would _automatically_ copy the
selection to the clipboard, which is nice to have, except that each and every
time the selection changes, a new copy of the current selection would be copied
to the clipboard **immediately**, even if I'm still dragging (to select more
text).

This means if I were to select something from the navigation widget, my
clipboard history would probably look something like this:

```
The QNetworkRequest
The QNetworkReques
The QNetworkReque
The QNetworkRequ
The QNetworkRe
The QNetworkR
The QNetwork
......
```

Which is really inconvenient, not only because I'll have many unnecessary
entries in my clipboard history, but also because one could easily (and quite
quickly!) lost content saved in clipboard history if the clipboard manager has
a history size (e.g. Klipper).

The "correct" behavior should probably be to copy the selected text _once_
**after** the selection has completed (i.e. mouse button has released), which
seems to be the behavior of "Always save in history" in Klipper, but I'm not
entirely sure about that.

Side note: it is also not clear, from the hints in the navigation widget, that
such auto-copy feature exists.


STEPS TO REPRODUCE
1. Open KDevelop
2. Create or open any project
3. Move the mouse cursor to any keywords/variables/errors
4. Select any text in the the navigation widget popup
5. Check clipboard history (e.g. with Klipper in Plasma)

OBSERVED RESULT
One copy is made each time the selection has changed.

EXPECTED RESULT
Only one copy should be made.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux, KDE Plasma w/ Wayland
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION
I did a quick search and found the following code, which is likely responsible
for this behavior:

https://invent.kde.org/kdevelop/kdevelop/-/blob/master/kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp#L99

```
    connect(d->m_browser.data(), &QTextEdit::selectionChanged, this, [this]() {
            Q_D(AbstractNavigationWidget);
            d->m_browser->copy();
        });
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to