Bug 100189 - copy paste in writer inserts unwanted leading space
Summary: copy paste in writer inserts unwanted leading space
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-02 10:49 UTC by Dr. Matthias Weisser
Modified: 2020-08-24 13:00 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test file with pictures showing bug (27.41 KB, application/vnd.oasis.opendocument.text)
2016-06-03 19:05 UTC, Dr. Matthias Weisser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Matthias Weisser 2016-06-02 10:49:13 UTC
when editing a text and doing a copy with the mouse the word is shown correctly but when inserting this an unwanted additional space is also inserted.
Comment 1 Dr. Matthias Weisser 2016-06-02 10:50:12 UTC
this is Win7 64bit system.
Comment 2 V Stuart Foote 2016-06-02 16:56:15 UTC
Sorry can not reproduce. Please provide screen clips and perhaps a small sample document.

Also, as of the 5.1 release you can now toggle each character to its Unicode value, you can tease out exactly the character being pasted.
Comment 3 Dr. Matthias Weisser 2016-06-03 19:05:01 UTC
Created attachment 125473 [details]
test file with pictures showing bug
Comment 4 V Stuart Foote 2016-06-03 19:39:37 UTC
@Matthias,

Notice in your sample document and inserted clip that the location receiving the pasted text already has a "space" prior to the Pilcrow for the paragraph end.

In fact all paragraphs are ending with a "space" prior to the Pilcrow.

Meaning when you copy paste to that spot you'll have the existing space, plus the white space surrounding the word paste.

Not sure why or how you are inserting a space prior to ending a paragraph. But the insert is correct, the inclusion of a space preceeding the copied text is expected behavior.
Comment 5 Dr. Matthias Weisser 2016-06-03 20:23:56 UTC
thank you very much Stewart for your comment.

just to clarify:
as can be seen the word that I choose to copy "test" does not contain any space.

I would expect that LO just pastes what I had copied. Because I did not want to copy a space I do not expect to see an additional space.

If I copy "test" and paste this 5 times I would expect getting: testtesttesttesttest.

What in fact I am getting is: test test test test test. This is clearly not what I am expecting here. Why is there a white space added around the word "test" which I do not want to have?

It seems to be hard inserting a word without spaces in between. Even if I delete the last space with each paste an unwanted space comes up each time. This does not happen when I use "Inhalte einfügen" "unformatierter Text" which costs much more time because of using the pull down menu.
Comment 6 V Stuart Foote 2016-06-03 23:26:19 UTC
(In reply to Dr. Matthias Weisser from comment #5)
> 
> What in fact I am getting is: test test test test test. This is clearly not
> what I am expecting here. Why is there a white space added around the word
> "test" which I do not want to have?
> 
> It seems to be hard inserting a word without spaces in between. Even if I
> delete the last space with each paste an unwanted space comes up each time.
> This does not happen when I use "Inhalte einfügen" "unformatierter Text"
> which costs much more time because of using the pull down menu.

Yes, believe this is intended behavior of the edit engine and is correct. 

Set up this simple test case:
<quote>
Test test test

mist mist mist
</quote>

So, IIUC if you double click select the center "test" the entire word is selected because it has "protected" word boundaries. If you position the edit cursor between the "mi" and "st" of the center mist and <Ctrl>+V it will paste with white space boundaries intact.

You can directly paste unformatted text "test" by using the <Ctrl><Alt><Shift>+V short cut to avoid the GUI paste special.

Conversely, if you select the initial "Test" or the ending "test" (so its ^Test or test$) the word boundaries are not protected and when you paste between "mi" and "st" you'll get either "miTestst" or "mitestst".

Likewise if you select "est" from the center test, it is does not consider  word boundaries so when you insert between "mi" and "st" you'll get "miestst" and so on.

Again I believe this is as intended and is inherited from OOo.

Version: 5.1.3.2 (x64)
Build ID: 644e4637d1d8544fd9f56425bd6cec110e49301b

Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432

Version: 4.1.5.2
Build ID: a02f36998a4af5e2f9fbec2b7e9f70a8b0bc934

LibreOffice 3.5.7.2 
Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

=-ref-=
http://opengrok.libreoffice.org/xref/core/vcl/source/edit/textview.cxx#789
http://opengrok.libreoffice.org/xref/core/vcl/source/edit/texteng.cxx#2405