Bug 398661

Summary: The problem with deleting the lines when selecting the source text
Product: [Applications] lokalize Reporter: Віталій <vitalijrabicev>
Component: editorAssignee: Simon Depiets <sdepiets>
Status: RESOLVED FIXED    
Severity: major CC: aspotashev, enolp, faure, karl, sdepiets, vitalijrabicev
Priority: NOR    
Version: 2.0   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:

Description Віталій 2018-09-15 11:40:47 UTC
Problem with deleting the lines when selecting source code (just select the source text with double clicks mouse and it is deleted).
The problem manifests itself on KDE Frameworks 5.49+, Qt 5.11.1, from the KDE application suite 18.08.1

Video bug: https://youtu.be/FCeAt7wtSDY
Comment 1 Simon Depiets 2018-09-16 11:35:02 UTC
Hello,
Can I have more details on your distribution (Manjaro flavor you're using for instance)
Comment 2 Віталій 2018-09-16 12:03:22 UTC
(In reply to Simon Depiets from comment #1)
> Hello,
> Can I have more details on your distribution (Manjaro flavor you're using
> for instance)

Ofcourse. I used original Manjaro "Stable Branch" without AUR, 17.1.12, kernel 4.14.69-1-MANJARO, Plasma 5.13.5. 

Screenshot: https://pp.userapi.com/c846218/v846218225/eeba5/Wwx8rj3MzPY.jpg
Comment 3 Simon Depiets 2018-09-17 06:46:53 UTC
Confirmed
Comment 4 Simon Depiets 2018-09-17 09:59:27 UTC
It's actually the spellchecker (sonnet) which is removing the text. For now I can suggest you to disable spellcheck by adding the following two lines in your .config/lokalizerc
[Editor]
AutoSpellcheck=false

I'm adding David Faure who maybe can help me if he's seen that behavior with sonnet before.
I suspect the code below replaces the selected text by an empty string (maybe triggered by the last commit on sonnet ?).

in sonnet/src/ui/highlighter.cpp
void Highlighter::slotRehighlight()
{
...
cursor.insertText(QString());
...
}
Comment 5 Alexander Potashev 2018-09-17 17:37:01 UTC
Victor Ryzhykh found the guilty commit in sonnet:
https://cgit.kde.org/sonnet.git/commit/?id=6fef78fa99dda1e00f40e1887d91d65c03e63ac2

His email in Russian: https://www.mail-archive.com/kde-russian@lists.kde.ru/msg07444.html
Comment 6 Simon Depiets 2018-09-22 08:40:42 UTC
Git commit ffd715bc17b3617ca741fc3530bba863d0e86757 by Simon Depiets.
Committed on 22/09/2018 at 08:40.
Pushed by sdepiets into branch 'master'.

Prevent highlighter from erasing selected text

Summary:
https://phabricator.kde.org/D14447 introduced a regression on Lokalize, the slotRehighlight method is called when text is selected and the insertText(QString()) call inside that method removes all text selected in the cursor.

Clearing the selection before doing that call solves this issue.

Reviewers: #framework_syntax_highlighting, mlaurent, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15686

M  +3    -0    src/ui/highlighter.cpp

https://commits.kde.org/sonnet/ffd715bc17b3617ca741fc3530bba863d0e86757
Comment 7 Simon Depiets 2018-10-09 01:04:41 UTC
*** Bug 399518 has been marked as a duplicate of this bug. ***