Bug 103350 - Paste from Clipboard - it changes format of whole word as per last letter on previous line
Summary: Paste from Clipboard - it changes format of whole word as per last letter on ...
Status: RESOLVED DUPLICATE of bug 42638
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks: Paste
  Show dependency treegraph
 
Reported: 2016-10-20 13:52 UTC by Kamil Landa
Modified: 2020-03-25 12:12 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
A screencast showing difference between absent bold attribute vs explicit "no bold" (442.75 KB, image/gif)
2020-03-25 07:14 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Landa 2016-10-20 13:52:59 UTC
1. In Writer, open New document and write one word. 
2. Select last letter (by mouse or Shift+Left arrow) and set some format - Bold, Italic, Underline, Color, Highlight, Superscript or Subscript …
3. Select whole word (mouse or Ctrl+A) and copy it to clipboard (mouse or Ctrl+C). 
4. Go to end of word (by mouse or End) and press ENTER (it goes to new line). 
5. Paste from Clipboard (Ctrl+V) and whole pasted word is formated as last letter in previous line.
Comment 1 Buovjaga 2016-11-03 11:22:50 UTC
I reproduce.

If you undo the paste and do it again, it works.

I was unable to find an existing report.

Win 7 Pro 64-bit Version: 5.3.0.0.alpha1+
Build ID: 4b4abb73fcd7f2802e73102b3e7c30face8d309c
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: old; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-31_02:54:50
Locale: fi-FI (fi_FI); Calc: group

LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735

Ubuntu 16.04 64-bit
Version: 5.2.3.2
Build ID: 1:5.2.3~rc2-0ubuntu1~xenial1
CPU Threads: 2; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 2 QA Administrators 2017-11-04 09:01:05 UTC Comment hidden (obsolete)
Comment 3 Roman Kuznetsov 2019-01-26 11:55:58 UTC
still repro in

Версия: 6.1.4.2
ID сборки: 1:6.1.4-0ubuntu0.18.10.1
Потоков ЦП: 4; ОС:Linux 4.18; Отрисовка ИП: по умолчанию; VCL: gtk3_kde5; 
Локаль: ru-RU (ru_RU.UTF-8); Calc: group threaded

>If you undo the paste and do it again, it works.

it isn't for me now
Comment 4 Kamil Landa 2019-07-30 08:54:47 UTC
If apply on paste-location 'Format/Clear direct formatting' before Paste, then Paste is OK.

Probably if location where it will Paste has some properties (bold, italy, underline etc.), during the Paste process the properties from this location join with the properties of copy text.

Verze: 6.2.5.2 (x64)
ID sestavení: 1ec314fa52f458adc18c4f025c545a4e8b22c159
Vlákna CPU: 8; OS: Windows 10.0; Vykreslování UI: výchozí; VCL: win; 
Národní prostředí: cs-CZ (cs_CZ); Jazyk UI: cs-CZ
Calc: threaded
Comment 5 Michal Janoušek 2019-08-11 07:59:07 UTC
I must using FreeOffice TextMaker, because LibreOffice do not useable for this very bug when copying formating text. It is a big waste of time to fix incorrect text insertions all the time. 

Myy see video saved to my box account https://app.box.com/s/efmvcwwbot71sxhg7g9fldl4i48v3e6s

Why isn't it easy? 

However, FreeOffice has its own bugs.
Comment 6 Kamil Landa 2019-08-12 15:36:36 UTC
Solution via macro.

Sub resetAndPaste 'reset attributes before paste via inserted space
	dim document as object, dispatcher as object
	document=thisComponent.CurrentController.Frame
	dispatcher=createUnoService("com.sun.star.frame.DispatchHelper")
	dim args1(0) as new com.sun.star.beans.PropertyValue
	args1(0).Name="Text" : args1(0).Value=" "
	dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) 'insert space
	dim args2(1) as new com.sun.star.beans.PropertyValue
	args2(0).Name="Count" : args2(0).Value=1
	args2(1).Name="Select" : args2(1).Value=true
	dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args2()) 'select space
	dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array()) 'reset attributes (need if cursor is at start of line)
	dim args4(1) as new com.sun.star.beans.PropertyValue
	args4(0).Name="Count" : args4(0).Value=1
	args4(1).Name="Select" : args4(1).Value=false
	dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args4()) 'back to end of space
	dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args4()) 'go to start of space
	dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array()) 'reset attributes (need if cursor isn't at start of line and before space is formatted text)
	dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) 'Ctrl+V
	dispatcher.executeDispatch(document, ".uno:Delete", "", 0, Array()) 'delete space
End Sub

Verze: 6.2.6.1 (x64)
ID sestavení: 1f09ad467b449704e317fb11998b9a2ad7184670
Vlákna CPU: 8; OS: Windows 10.0; Vykreslování UI: výchozí; VCL: win; 
Národní prostředí: cs-CZ (cs_CZ); Jazyk UI: cs-CZ
Calc: threaded
Comment 7 Timur 2020-03-24 10:53:08 UTC
If worD means that D is bold, then when you type enters, they carry direct formatting of D. So when you paste, it's all bold. 
Not a bug.
Solution: clear direct format after D.
Comment 8 Kamil Landa 2020-03-24 13:43:05 UTC
I'm really not sure if the strictly dicta "it is not a bug" is well, because sometimes it seems as a good behavior, but sometimes it seems more as a bug. 
If you have some bold word and you will paste some formatted text - for example no-bold but italic text, then outcome will be bold&italic text. But if user wants to paste only the copied italic text and no to get the bold&italic text, it seems as a bug. 

There was issue in the Czech section https://ask.libreoffice.org/cs-cz/question/202629/libreoffice-625-a-starsi-kopirovani-textu-a-jeho-formatovani/#202747. Michal Janousek was making the English-Czech materials, he had list of the English words (bold text) and then he copied/pasted Czech meanings with italic formatting. And he wanted to get bold English word + italic Czech word, and no to get bold word + bold&italic word. Clear direct format before every Paste was unwished and jarring operation. So I made small macro with uno:commands - it helped, but no in the 100% cases. 

The next problem is, if you want to put formatted (italic) text inside the bold word. For example: worDD -> put cursor between bold DD (worD|D) and if you will use Clear direct format because you want to Paste italic text there, all word will clear. And it also seems as bug if you presume to get bold+italic+bold text and no to get bold+bold&italic+bold, or no to get (with Clear direct format) normal+italic+normal text. So there is "Insert the space" in the macro, then "Clear direct format", then "Paste text", and then "Delete the inserted space" -> then all formatting of the ambient text is intact. 

So it can seems as good behavior with unformatted text (sometimes), but for some formatted text -> it is more complicated and more as a bug (I think).
Comment 9 Timur 2020-03-24 17:36:43 UTC Comment hidden (me-too)
Comment 10 Timur 2020-03-24 17:38:09 UTC
"Reopened* is when there was a fix which is not working. 

Please formulate what you think is a bug with steps, experienced and expected behavior.
Comment 11 Mike Kaganski 2020-03-24 17:45:43 UTC
It is a clear usability issue. With all the formatting layers and their relations, it's next to impossible to provide a single mode of operation that fits all. MS Word has helper buttons appearing near pasted text that allow to modify how formatting is applied to the pasted text (keep original/follow current etc), and that allows to be flexible in such a complex case as pasting of formatted text into formatted text.

Of course the behaviour is not a bug in the sense that "it works as intended": the pasted text has no "bold" property (unlike explicit "no bold" which would have prevented the behaviour - test this: instead of setting last character bold in step 2 in comment 0, set the whole word bold, then select all but last character and unset bold). But as said, there can't be a simple solution here that fits all - thus I suggest to have a UX evaluation how to make pasting behave flexibly wrt which set of properties to apply (none/target/source/both).
Comment 12 Kamil Landa 2020-03-24 19:26:45 UTC
I tested to set the whole word bold and then unset bold for its portion -> and there was the same result (bug) in my testing :-). 

I agree the simple solution doesn't exist. Helper buttons with mentioned variants none/target/source/both - it seems like the superb solution.
Comment 13 Timur 2020-03-24 20:25:43 UTC
I'll course this, because no further value is expected. 
Literally this was NotABug. 
With discussion, I mark as a duplicate of bug which mentions paste options.

*** This bug has been marked as a duplicate of bug 42638 ***
Comment 14 Mike Kaganski 2020-03-25 07:03:34 UTC
(In reply to Kamil Landa from comment #12)
> I tested to set the whole word bold and then unset bold for its portion ->
> and there was the same result (bug) in my testing :-). 

Interesting; did you unset bold using Bold button (as I intended), or using "clear direct formatting" (which would not set the explicit "no bold" attribute, and will not demonstrate the difference I described)?
Comment 15 Mike Kaganski 2020-03-25 07:14:29 UTC
Created attachment 158967 [details]
A screencast showing difference between absent bold attribute vs explicit "no bold"

(In reply to Timur from comment #13)
> *** This bug has been marked as a duplicate of bug 42638 ***

Agreed :-)
Comment 16 Kamil Landa 2020-03-25 08:20:52 UTC
Bold/no-bold is not significant. The cause is Undo (you clicked on Undo button in the video). Use simply Paste/Undo/Paste and then pasted text is alright (I remembered the user wrote it in Czech issue). But it is not functional inside formatted text.
Comment 17 Mike Kaganski 2020-03-25 09:04:19 UTC
(In reply to Kamil Landa from comment #16)
> Bold/no-bold is not significant. The cause is Undo (you clicked on Undo
> button in the video). Use simply Paste/Undo/Paste and then pasted text is
> alright (I remembered the user wrote it in Czech issue).

No, the undo is not significant. Unfortunately I decided to show you the difference. I needed to show you the same sequence without the undo, which works exactly the same: https://imgur.com/HbKeW0X
Comment 18 Kamil Landa 2020-03-25 11:35:19 UTC
I reproduced your steps and really it is the same as your. I tried also some combinations, and today I got the same result as you. I really don't know how strange steps I did with "your progression" yesterday, that there was the "bug" at me :-(. I'm sorry for muddle :-).
Comment 19 Kamil Landa 2020-03-25 12:12:58 UTC
I discovered my yesterday mistake - Mike Kaganski mentioned it in comment 14. I use keyboard shortcuts and I did no-bold with my keyboard shortcut for Clear direct format, and no with Ctrl+B.