Need to Disable Added Space in Copy and Paste

One thing that has long bugged me, and is a particular nuisance in a current project, is LO, particularly LO Writer, adding an extra, unwanted, space in a copy and paste operation. For example, id I am editing these lines:

  "70" 1790-1791
    Deeds 1791-1792 Volume 71 (Images 308-591)

I need to change the “70” to “71” and then copy the 1791-1792 and paste it in place of the 1790-1791. When I do so LO Writer always adds an extra space after “71” with the result:

  "71"  1791-1792
    Deeds 1791-1792 Volume 71 (Images 308-591)

There is now a double space after “71” - LO has added a space that was not copied. How can I disable this incorrect and unwanted behavior?

  • No operating system given
  • No information about desktop manager / clipboard manager
  • No LibreOffice Version given
  • No paragraph styles used (details) given
  • No third party tool / extension used given (the thing looks to be part of citation operation).

To make sure for what is copied: have you enabled View>Formatting Marks so that you see accurately what is present in your file? Have you checked settings in Tools>Options, LibreOffice Writer>Compatibility? I’m thinking of Do not add leading between lines of text and Word-compatible trailing blanks if it is relevant (both unchecked here and no problem).

Don’t use an answer but a comment (or edit your question) to provide additional information. Don’t forget OS and LO version.

I have not done any of those yet but I will when I have a chance. What I have done is to use ClipSpy to view the contents of the clipboard immediately after the copy operation, and there is no leading space on the clipboard after the copy, so the error is occurring in the paste operation. I will advise when I have tried your suggestions. For reference the OS is Win10 Pro 64 bit in the most recent update. LO is 6.1.4.2 (x64). I cannot run the current version because it cannot launch batch files from hyperlinks, even though batch files are still supported and fully functional in the current version of Win10. I have about 300 reference CD-ROMs stored on my HD as ISO image files. The batch files that are hyperlinked to are used to load an image into a virtual drive and launch the executable used with that CD-ROM. There are several executables from several vendors used with those CD-ROMs and manually handling those steps is not feasible.

Neither of those suggestions worked (and I saved and restarted after the second suggestion). The formatting marks show nothing unusual - just a tick for a single space before the section that I am replacing. After the paste there are two ticks for spaces instead of one.

Selecting a whole word, copying it and pasting it by default would indeed add spaces. E.g., if you type some text like “Lorem ipsum dolor sit amet”, select word “ipsum” without spaces before/after, then put cursor inside “dolor” (say, between “o” and “l”) and paste (Ctrl+V), the inserted word would be separated by spaces. But pasting as unformatted text would prevent the spaces.

However, no idea what could cause added spaces after quoted number.

1 Like

It seems to me that adding leading or trailing spaces when pasting inside a word is a flaw, or at least something that should be able to be disabled by the user. For decades I have used a powerful programmer’s editor for plain text files, and with its built-in macro capability I also use it for creating HTML and for some other purposes. It does not, however, support adding hyperlinks to documents, which is a feature that I need in my dozens of index files that provide hyperlink access to 18,000 individual files store on my HD. Whenever a computer program thinks it knows more about how edit a file than I do I consider that a flaw. Maybe I am just old-fashioned - after all, I took my first college-level computer programming class at MIT in the fall of 1967.

MeToo: Although it is some months later, I stumbled over the same “feature”, which I would call an outright bug. Linux RHEL 7.8, LO Writer 5.3.6.1. I was documenting some process and showing the code which I wanted to use afterwards, and sure enough, there was a blank somewhere in between. I first had to realize what was going on, then correct the code and the errors caused by the process, then analyse how come… PLEASE!

I don’t know if this is relevant, but experiment shows the copy part adds some context information to the operation.

Starting from “Lorem ipsum dolor sit”, select part of a word (meaning not the full word, selection limit may or may not extend to word start or end but not both). Copy and paste anywhere; the pasted segment is exactly as selected. Now select a word, either by swiping the mouse or double-clicking. Note that the visual feedback for the selection does not include the spaces. Copy and paste. Write seems to apply some “smart” strategy: since a word was selected, then a separate word will be pasted, eventually adding a space at left, right or both to make sure it remains a word. The algorithm is “smart” enough to cope with punctuation.

Not had the time to check the documentation about it, but I think there is a mention somewhere. So this is specification. Don’t know it there is an advanced setting to enable/disable it.

Well, I think I can confirm this - sort of.
I have a string like /this_word_one/this_word_two/this_word_three/
which I need to convert to /xxxxx/yyyyy/this_word_three (no ending slash).
So, I write /xxxxx/yyyyy/
then I copy this_word_three from above – and LO adds the space before the real pasting action.
If I only copy word_three it does just the same, this means in fact it regards this_word_three as 3 words.
You are right in that if I copy a string like ord_thre , the space is not added.
Sooo, I REALLY do not want to have to cope with LO’s idea of what is and is not a word. And if it tries to be smarter than its user (oh my, this reminds me of my favorite rant about some other software I replaced with LO), it should clearly provide (that is OFFER or even propose, not hide) an option to change this behaviour.

I see that no solution has become available in two years. I have discovered another flaw. I needed to replace all occurrences of “(NEHGR)” with “(The New England Historical and Genealogical Register)”, but LibreOffice ignores the parenthesis and replaces all occurances of “NEHGR” with “The New England Historical and Genealogical Register.” I really **** coders who think they know more about how I want to use a program than I do. Any “feature” which alters an operation should be provided with the ability to disable that feature.

Just a quick guess without test:
Uncheck " regular expression " or
use quotes for the paranthesis.

And if you are keen on rules: New questions for new topics. Please don’t create a “all my findings” thread on an ask-site.

1 Like

I unchecked the regular expressions checkbox, saved the file, and closed LO Write. When I opened another file it was still unchecked. Does LO preserve the last state of that checkbox? Is there any way to disable preserving that last state? I don’t often use regular expressions in LO. I do use them frequently in my programmer’s editor, but it doesn’t preserve states unless explicitly told to do so.

I’m sorry if I violated any rules here - I do all of my heavy lifting with my programmer’s editor, but it does not support embedded hyperlinks, so I have to use LO for some files.

@Wanderer is correct. Turning off Regular Expressions does what you want.

If you have Regular Expressions ticked then parentheses are used for grouping so in this case (NEHGR) would be the same as NEHGR and it will also pick up NEHGR without parentheses in the text. If you are using Regular Expressions then in the Find field enter \(NEHGR\), the \ makes the following character literal.

What I don’t quite understand is why you didn’t get double parentheses in the replaced text where it was replacing (NEHGR), e.g. ((The New England Historical and Genealogical Register))

This has been an issue for me while writing a long documents in English featuring a word, usually a name, which has accent marks, as switching the keyboard layout to make that easier to type switches the text language. As I’m pasting the same word over and over in these instances, my workaround is to paste it into notepad and re-copy it, as it then doesn’t get treated as a word and the extra spaces aren’t added. Not useful where you’re pasting varying text from within the same document, unfortunately.

Just paste in Writer using Shift+Ctrl+Alt+V (“Paste unformatted text”)?

Are you under Windows? This doesn’t happen under Linux.

Another workaround is to create an AutoText for your word and associate it with a shortcut (3 unfrequent letters or signs should be adequate). You then type the shortcut followed by F3 to replace the shortcut by the word.

… unless you use Qt integration.
And where it works, it is configurable in language settings.

Way harder to reach than just ctrl-v - painful with just my left hand and likely to mess up the subsequent word if I move my right hand to get to the v - and I’m copying once at the start of an extended writing session and pasting dozens of times because its the name of the person I’m writing about.
I probably would do that if moving multiple individual things around, but in this case, as I can’t turn the undesirable behaviour off, and dont want to develop behaviour that will screw me up when using other machines/apps (ie, not typing the space before the name) or to be doing something uncomfortable every couple of minutes, the extra step which takes about a second when I start for the day works for me.

Not sure about what you’re talking. If it is about my AutoText suggestion, you configure it only once. The word and its abbreviation/shortcut is entered into your user profile. So, it is readily available when you start a new session. And … F3 can be reached with a single finger of your left hand.