Bug 128595 - Document difference for words and characters and spaces when copying and pasting text
Summary: Document difference for words and characters and spaces when copying and past...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
6.3.3.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Paste
  Show dependency treegraph
 
Reported: 2019-11-04 19:21 UTC by contestcen
Modified: 2019-11-24 15:07 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test cases for copying text (11.10 KB, application/vnd.oasis.opendocument.text)
2019-11-07 07:30 UTC, contestcen
Details
Copying text enclosed in dots/periods (11.66 KB, text/plain)
2019-11-12 07:24 UTC, contestcen
Details
Extra blanks when copying text (11.84 KB, text/plain)
2019-11-14 22:13 UTC, contestcen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description contestcen 2019-11-04 19:21:49 UTC
Description:
I find that when I copy text LibreOffice Writer either (1) copies exactly what I selected, or (2) adds an extra blank after the copied text, or (3) adds extra blanks both before and after the copied text.  I have no idea why I sometimes get one behavior, and sometimes another.  My preference would be always to copy exactly the selected text, and never add extra blanks.  But regardless of which behavior you choose, it should be consistent.  I can delete the unwanted blanks if I know I will always get them.

Steps to Reproduce:
Select a few characters and copy them to another place using ctrl-C and ctrl-V.  Try characters from the start, middle and end of a word.  Simply notice whether any extra blanks appear.

Actual Results:
The results are inconsistent.  Sometimes I get extraneous blanks, sometimes not.  It is this inconsistency that is the problem.

Expected Results:
Only the text that I selected should appear.  Nothing else should be added or inserted.  If I wanted to copy the text with a blank I would have selected the text and the blank together.


Reproducible: Sometimes


User Profile Reset: No



Additional Info:
Comment 1 Xisco Faulí 2019-11-05 11:41:36 UTC Comment hidden (obsolete)
Comment 2 contestcen 2019-11-05 17:41:55 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2019-11-06 03:33:00 UTC Comment hidden (obsolete)
Comment 4 Dieter 2019-11-06 07:37:12 UTC Comment hidden (obsolete)
Comment 5 Octavio Alvarez 2019-11-06 08:40:49 UTC
1. Have "a b c" in a document.
2. Select and copy "b". No spaces selected before or after.
3. Place right after the "b" and paste.

Expected result by OP: "a bb c"
Actual result: "a b b c".

Also try:

3. Place right before the "c" and paste.

Expected result by OP: "a b bc"
Actual result: "a b b c".

BUT...

1. Have "abc" in a document.
2. Select and copy "b".
3. Place right after "b" and paste.

Expected result by OP: to be consistent with the automatic space insertion, so either "ab bc" or "abb c".

Actual result:  "abbc".

@Contestcen: please confirm that this is what you are observing and reporting.

I think this is LibreOffice automatically detecting whether the selection is in word limits and trying to be smart about it by making sure it's inserted as a word without repeating spaces before and after or inserting them accordingly. In the first two cases Writer understand "b" is a word. In the third case it's clearly not.
Comment 6 Dieter 2019-11-06 09:06:57 UTC
Sorry, you're right. I misunderstood your report. I confirm that behaviour, but I don't think that this is a bug.

If you have a b c every character is treated as a single word. If you paste it directly before or after a word, LO adds a blank space to separate the words. That's what I expect.
If you have abc and copy b it is a character and therefor it is the correct behaviour if no space is added.

So in my view NOTABUG

See also bug 112011.
Comment 7 Octavio Alvarez 2019-11-07 02:38:38 UTC
I am noticing that pasting as unformatted text will follow OP's desired behavior.

LibreOffice can be customized to bind Paste Unformatted to a keyboard shortcut, so a fast workflow can be prepared.
Comment 8 contestcen 2019-11-07 07:30:40 UTC
Created attachment 155598 [details]
Test cases for copying text

I have attached some test cases which confirm what Octavio has suggested, however, I believe I have seen other behavior where I copy a single letter from the middle of a word into another word and blanks sometimes get added.  I will try to find and isolate this.  Meanwhile -- is there any way to turn off this automatic blank feature?
Comment 9 Timur 2019-11-09 19:28:01 UTC
We have two options here. 
First, this is NotABug. As explained, difference is characters and words. So you cannot turn off feature, but solution for a user is Paste Unformatted.
Other is to update Documentation, which I prefer.

Unless it's already explained, because I couldn't find, we can add some text in Paste section like https://help.libreoffice.org/6.4/en-US/text/shared/guide/pasting.html?&DbPAR=WRITER&System=WIN:

"Writer will copy and paste a word with trailing or leading space, to separate from other word. Same is for single letter, because it's regarded a word.
One or more characters from a word will be pasted without space. 
Words pasted as unformatted text will also not have a space."
Comment 10 Octavio Alvarez 2019-11-10 23:00:54 UTC
(In reply to Timur from comment #9)
> "Writer will copy and paste a word with trailing or leading space, to
> separate from other word. Same is for single letter, because it's regarded a
> word.
> One or more characters from a word will be pasted without space. 
> Words pasted as unformatted text will also not have a space."

I agree that this should be documented.

It's not "trailing or leading" but "trailing and leading". I did some tests to confirm this. I also think that the phrase "single letter" is ambiguous; it can be thought of any character from within a word if the rest of the proposed text has not been read yet.

Allow me to propose a new text:

---
If a text cut or copied from Writer is surrounded by spaces it will be considered as a set of words. When pasted, Writer will surround it smartly by spaces to keep it as a word: separated by spaces from other characters but avoiding any duplication of spaces.

If the text is pasted as Unformatted Text, this consideration is ignored and the text is pasted as is, without adding any spaces.
---

My two cents.
Comment 11 Octavio Alvarez 2019-11-10 23:07:55 UTC
(In reply to Octavio Alvarez from comment #10)
> ---
> If a text cut or copied from Writer is surrounded by spaces it will be
> considered as a set of words. When pasted, Writer will surround it smartly
> by spaces to keep it as a word: separated by spaces from other characters
> but avoiding any duplication of spaces.
> 
> If the text is pasted as Unformatted Text, this consideration is ignored and
> the text is pasted as is, without adding any spaces.
> ---

Small correction: Writer will surround it smartly by spaces to keep it as a set of words.

---
If a text cut or copied from Writer is surrounded by spaces it will be considered as a set of words. When pasted, Writer will surround it smartly by spaces to keep it as a set of words: separated by spaces from other characters but avoiding any duplication of spaces.

If the text is pasted as Unformatted Text, this consideration is ignored and the text is pasted as is, without adding any spaces.
---
Comment 12 contestcen 2019-11-11 07:50:08 UTC
Paste unformatted is not a useful solution for me.  Aside from the difficulty of pressing 4 keys simultaneously, paste unformatted loses ALL formatting, not just word boundaries, namely font, size, and font effects.  The reason that I am copying single characters instead of just retyping them is to preserve this formatting.  It is more work to reformat the copied text than to delete the unwanted blanks.  

BTW, the text that I copied did not have blanks on either side.  It was embedded in a line of dots (periods).  This is another problem I have with LibreOffice.  I have to do a lot of work to prevent periods from being compressed into ellipses.

I disagree that this problem is NotABug.  The fact that the extra blanks were inserted intentionally only means that this is not a programming bug, but it is still a design bug.  Any time that you change something that I type, it's a bug.  If you capitalize a letter that I typed in lower case, that's a bug.  If you change a word I typed, that's a bug.  If you change 3 dots into an ellipsis, or --> into an arrow, change 2nd into 2 with a superscript nd, that's a bug, unless I specifically tell you to make those formatting changes.

Sorry, just sounding off, but this all gets very frustrating constantly fighting against program features that I'm sure the designers thought would actually be helpful.
Comment 13 Octavio Alvarez 2019-11-12 01:48:37 UTC
(In reply to contestcen from comment #12)

[On Paste Unformatted not being useful]
> The reason that I am copying single characters instead of just retyping them
> is to preserve this formatting.

Can you share your use case? This is, why are you copying single characters instead of typing them? Put another way, why is it more difficult to type than to select, copy and paste?

> BTW, the text that I copied did not have blanks on either side. It was
> embedded in a line of dots (periods).

Can you share a sample document and the step-by-step instructions to reproduce it? What we have tested so far does not match your description.
Comment 14 contestcen 2019-11-12 07:24:30 UTC
Created attachment 155723 [details]
Copying text enclosed in dots/periods

I have attached a set of test cases.  On each line I have taken some characters from the original text and copied them, as indicated.

The reason that I copy single characters or single words instead of retyping them is that I want to keep the same font and font effects.  If I retyped the text, I would then have to select it, change it to bold, and then find the desired font by scrolling the drop-down list.  If I do that carelessly, I would then need to unbold the following text and change it back to Times Roman.  

Or, the character might be something special that I can't just type.  I would have to find it in the Special Characters lists.
Comment 15 contestcen 2019-11-14 07:47:30 UTC
I still keep getting extra blanks that are not explained by word boundaries.  When I tried to reproduce this to show you, I got the opposite result.  There was a blank missing according to what you have told me.  Here is an example


aaa bbb ccc   Original text
aaa bbb aaa bbbccc   
   Copied “aaa bbb” before “ccc”  
   Expected “aaa bbb aaa bbb ccc”
Comment 16 contestcen 2019-11-14 22:09:38 UTC
I have now been able to reproduce the copying error that I observed on Monday.  I copied some text that had no leading blank(s) after text that had no trailing blanks, and ended up with 2 blanks between them.  I will attach a file showing the problem.
Comment 17 contestcen 2019-11-14 22:13:21 UTC
Created attachment 155827 [details]
Extra blanks when copying text

BTW, I had the very devil of a time making the text in the second set of brackets boldface.  I had to go word-by-word, and sometimes a character at a time.
Comment 18 contestcen 2019-11-23 09:09:03 UTC
Please see my comments 15 and 16 and their attachments.  These show both of the errors that I reported originally, and they are not explained by the feature that adds blanks at word boundaries if they are missing.

This bug report should be reinstated.
Comment 19 Octavio Alvarez 2019-11-23 17:50:54 UTC
Can you share your use case? Your workflow does not seem to be typical. It would be useful to understand your use case, as asked in comment #13.
Comment 20 contestcen 2019-11-24 07:58:22 UTC
I don't know what you mean by "use case."

I copy text so that I don't have to retype it and re-establish its characteristics such as font, size, bold, italic or special characters.  It is often much faster to copy the text than to scroll through the dropdown list of fonts.

It is not reasonable to send you my entire document, which is now around 115 pages, so I have isolated the problems for you and sent you examples, with explanations of how I got the results.
Comment 21 Octavio Alvarez 2019-11-24 15:07:13 UTC
Maybe your workflow can benefit from using Styles. I didn't understand that much but it may be worth a try. I won't discuss Styles here because that would be too off-topic for this bug report. I just will leave the suggestion.