Bug 391947

Summary: Document corruption due to random pasting from clipboard
Product: [Applications] kate Reporter: Adam <sharpzq4300>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 16.04   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Adam 2018-03-16 21:40:22 UTC
Hi there,

I have twice found that a document was being "interfered with" while writing plain text in Kate.  The first time, I was moving chunks around with the copy/paste function and using undo often, and had difficulty understanding why unexpected changes were occurring.  I kept seeing text that I recently pasted in the wrong places, and I thought it might have had to do with Kate's undo function but this was incorrect.

The second time, I knew of possible problems with the clipboard or undo functions, so I did not use them at all.  I was writing a monthly list of things to do and apart from going up and down to append to different sections, I pretty much wrote the document from beginning to end.  Point being, this bug happens easily, if it is not isolated to my system alone.

What happens is while writing out plain text without any formatting other than hitting enter for new lines and occasionally using tab to indent, I can use the mouse to scroll back up to areas of the document which ran out of view, and the contents of my clipboard (at the time a link to a Youtube video) had appeared at one or two random places in the text.  Sometimes at the end of a line and sometimes right in the middle of a word, splitting it apart.  Because I had not entered in any URLs in the document, it was very easy to spot.

Please note that this cannot be accidental triggering of the "Paste" function by any component of the hardware, OS or Kate.  The insertions always occur in areas off-screen and never where the cursor is. As such it goes unnoticed until reviewing the document.

I don't know if the insertions occur while I scroll with the mouse clicked on the scrollbar to move back up the document, or if they occur randomly while I am typing.


Here is the information about my OS and Kate:
$ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description:    Linux Mint 18.1 Serena
Release:        18.1
Codename:       serena
$ apt-cache policy kate
kate:
  Installed: 4:16.04.3-0ubuntu1~ubuntu16.04~ppa63
  Candidate: 4:16.04.3-0ubuntu1~ubuntu16.04~ppa63
  Version table:
 *** 4:16.04.3-0ubuntu1~ubuntu16.04~ppa63 500
        500 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     4:15.12.3-0ubuntu2 500
        500 http://mirror.csclub.uwaterloo.ca/ubuntu xenial/universe amd64 Packages

Help -> About Editor Component: "Kate Part Version 5.36.0"
Help -> About Kate: "Kate Version 16.04.3"
Comment 1 Adam 2018-03-26 06:12:04 UTC
After further timid attempts to use Kate regularly with what appeared to be a risk of the corruption, I spotted something.

This may be entirely a result of Kate's reaction to right-clicking being different than what I have become accustomed to.

To copy text, I can click and drag as usual.  Then when I right click, I get a drop-down menu *without any relocation of the cursor* and I select copy.

However, when I paste, I have never been aware of the need to place the mouse cursor at the place where I intend to paste.  What happened today is I had the mouse cursor about 10 lines lower then where the text cursor was, and I right clicked *and did not notice the text cursor move* and when I selected paste, it was obvious that the text went to an unintended location in the document.

If nobody else experiences unexpected pasting, then this could be filed as a feature request.

I am used to gedit/pluma and mousepad editors where right-clicking never relocates the text cursor, and I would like (at least) an option to set this as my preference so I can use Kate without this subtle yet annoying difference.

Something to note: even within Kate, this behaviour is inconsistent.  When text is highlighted, the location of the mouse does not change anything when right-clicking.
Comment 2 Christoph Cullmann 2018-08-17 21:22:49 UTC
Hi, I am sorry that this behavior is not what you are used, too.
But it is consistent both with other Qt based editors like QtCreator and with Kate/KWrite/... itself (at least for >> 10 years).
Adding an option that is likely only used by a very small fraction of our users isn't really a feasible solution, too. If we start with that, we will end up with an incredible amount of options.
Therefore this will stay as it is. Sorry for the inconvenience.