Bug 164475 - Spaces added when they shouldn't be in specific cases when copy-pasting text, plus related inconsistent behavior
Summary: Spaces added when they shouldn't be in specific cases when copy-pasting text,...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.7.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Paste
  Show dependency treegraph
 
Reported: 2024-12-27 08:20 UTC by Ben J
Modified: 2025-04-04 18:13 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben J 2024-12-27 08:20:52 UTC
Description:
LibreOffice Writer tries to add spaces intelligently when copy-pasting whole words with CTRL+C, CTRL+V. Usually it works like this:

Step 1. Open a new LO Writer document.
Step 2. Type this three-word line:
     start middle end
Step 3. Copy “middle” with CTRL+C.
Step 4. Place the cursor inside a word and paste with CTRL+V. Note that LO adds both leading and trailing spaces. Undo.
Step 5. Place the cursor immediately before a word and paste with CTRL+V. Note that LO adds a single trailing space to separate them. Undo.
Step 6. Place the cursor immediately after a word and paste with CTRL+V. Note that LO adds a single leading space to separate them. Undo.
Step 7. Type two spaces anywhere, place the cursor between them, and paste with CTRL+V. Note that LO doesn't add spaces (to avoid double spaces). Undo.

This behavior breaks in at least three cases (A, B, C).


Case A:

Instead of Step 3, copy either “start” or “end” with CTRL+C.
Step 4. Place the cursor inside a word and paste with CTRL+V. Observe results, then undo.
Step 5. Place the cursor immediately before a word and paste with CTRL+V. Observe results, then undo.
Step 6. Place the cursor immediately after a word and paste with CTRL+V. Observe results, then undo.
Step 7. Type two spaces anywhere, place the cursor between them, and paste with CTRL+V. Observe results, then undo.

Actual Results:
In each case, LO doesn't add any spaces.

Expected Results:
LO should add leading and/or trailing spaces as appropriate, as it would for any other copied word or group of whole words.

(Comment: This behavior is at least inconsistent, and presumably a bug. It happens specifically when the text selection starts at the start of a paragraph or ends at the end of a paragraph, and contains only whole words and punctuation.)


Case B:

Follow Steps 1-3.
Step 4: Type a space after “end”.
Step 5: Leave the cursor after the space and paste with CTRL+V.

Actual Results:
LO adds an unwanted leading space, resulting in two spaces.

Expected Results:
LO should not add another space.

(Comment: I encounter this bug frequently when I have copied a long word, proper name, or phrase to use throughout a paragraph. When I come to use the copied text, I type a space because I am about to insert a word that I have copied without a leading space, then when I paste it I get two spaces. This is bad enough, but Case A makes it worse because occasionally I happen to have copied the word from the start or end of a paragraph, so I actually DO need to type the space!)


Case C:

Follow Steps 1-3.
Step 1: Select the word “middle”, and paste with CTRL+V. Observe that LO correctly replaces the word without adding any spaces. Undo.
Step 2: Select the word “end”, and paste with CTRL+V.

Actual Results:
LO adds a leading space, resulting in two spaces between the second and third words of the line.

Expected Results:
LO should not add a space.

(Comment: This unwanted space is only created when copy-pasting over the words at the end of a line, similarly to Case B. Note that if there is a period or other symbol after “end”, then this bug occurs if the symbol is included in the selection, and not otherwise. Multiple whole words at the end of a line can be selected and this bug occurs. If the first or last words of a line are copied and pasted, this bug does not occur, due to Case A.)

Steps to Reproduce:
Follow the steps for Cases A, B, and C.

Actual Results:
Case A: No spaces added.
Cases B,C: Unwanted spaces added.

Expected Results:
Case A: Spaces added consistently.
Cases B,C: No spaces added.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: en-GB (en_NZ); UI: en-GB
Calc: CL threaded
Comment 1 Ben J 2024-12-27 08:29:11 UTC
This bug makes copy-pasting unpredictable and actively creates typos on behalf of the user. There is no setting to turn off the behavior where LO adds new spaces to pasted text. Some (see e.g. Bug 81855) don't even want that behavior when it works perfectly. I would rather have LO never add spaces than the current buggy and unpredictable behavior.

Rebinding ‘paste without formatting’ to a shorter combo and using that is a workaround, but a bad one. CTRL-C is deeply ingrained muscle memory, and if I replaced that binding then of course I would lose the text formatting when pasting, which is almost never desirable.
Comment 2 LeroyG 2024-12-30 15:37:11 UTC
If do you select "middle ", there is no added extra space to the left if it is pasted between a word.

Version: 24.2.7.2 (X86_64) / LibreOffice Community
Build ID: ee3885777aa7032db5a9b65deec9457448a91162
CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: es-AR (es_AR); UI: en-US
Calc: threaded
Comment 3 LeroyG 2024-12-30 15:40:43 UTC
Inconsistent or not, I prefer no added space/s automatically. So, it could be added an option to choose or not this behavior.
I see that it is not an autocorrect feature, because Undo do not delete the extra space/s.
Comment 4 meagan.eggert 2025-04-03 21:24:59 UTC
Version 25.2.1.2
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 8; OS: Windows 11 x86_64
UI render: Skia/Raster; VCL: win
Locale: en-US; UI: en-US
Calc: threaded

Bug confirmed. The copy/paste behavior is inconsistent in the way described. Not sure if this is intentional, but I agree with LeroyG that I would also prefer that no spaces were included automatically.
Comment 5 LeroyG 2025-04-03 22:19:44 UTC
Reproducible:
Version: 24.8.4.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 4; OS: Linux 6.4; UI render: default; VCL: gtk3
Locale: es-MX (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 6 LeroyG 2025-04-03 22:21:46 UTC
There is no added spaces if pasted as unformatted text or as rich text formatting.
Comment 7 Octavio Alvarez 2025-04-04 18:13:19 UTC
Reproducible in the master branch.

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: dcd3427149c33852428b4198c22f6f858125c294
CPU threads: 16; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded