Bug 462918

Summary: [wayland] Text copied that contains <?php cannot be pasted
Product: [Applications] kate Reporter: Oded Arbel <oded>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Oded Arbel 2022-12-11 17:12:54 UTC
SUMMARY
When copying to the clipboard text that contains the string "<?php", the copied text cannot be pasted anywhere - not even in Kate itself.

STEPS TO REPRODUCE
1.  Start Kate and put in some text, and make sure the text "<?php" appears somewhere
2.  Select a bunch of text, make sure it includes "<?php" (it doesn't have to be at the beginning).
3. Go to somewhere else in the document and try to paste the text.

OBSERVED RESULT
Nothing happens

EXPECTED RESULT
The copied text should be pasted

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
The copied text cannot be pasted in anything else that I could find: I tried Firefox, konsole, visual studio code and gedit.

The problem appears to be that when Kate copies text that contains the string "<?php" it marks its content-type as "application/php" *only* - there's no "text/plain" content type option. As a result, no editor - and that includes Kate itself - will recognized the current clipboard content, and using the "paste" command does nothing.

The copied text can be seen by Klipper (at least the system tray widget - the mouse position menu behaves a bit weird), but after selecting something else in Klipper and selecting the offending text again - it cannot be pasted either: klipper dutifully replaces the problematic content type.
Comment 1 Christoph Cullmann 2023-01-02 18:46:55 UTC
Hmm, works for me, text below pasted from Kate on Wayland, master build

<?php rstrsat rast arst
Comment 2 Oded Arbel 2023-01-02 19:51:40 UTC
I also cannot repro with current Kate (23.03.70 with Frameworks 5.102.0) - copying PHP code, even with the "<?php" text puts just "text/plain" content-type into the clipboard.