Bug 167486 - Paste into formula bar should keep newlines
Summary: Paste into formula bar should keep newlines
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.4.3 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks:
 
Reported: 2025-07-13 01:47 UTC by jasonkres
Modified: 2025-08-26 06:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Calc (top) vs. Excel (bottom) (57.95 KB, image/png)
2025-08-19 07:54 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jasonkres 2025-07-13 01:47:42 UTC
Description:
This concerns what happens when newlines are pasted into Calc's Formula Bar. 

I have seen pasting into the ***formula bar*** recommended somewhere as a way to Paste (Ctrl+V) unformatted without the contortions of pressing Ctrl+Alt+Shift. This technique has the Paste Unformatted effect in both Calc and Excel, but unfortunately is problematic in Calc when the text contains newlines.

I contend the result should basically be equivalent to entering Cell Edit Mode followed by Paste Unformatted, in regards to how any CR/LF/or any other expression of newline in the data is handled.

Steps to Reproduce:
1. Copy these three lines to the clipboard:

a
b
c

2. In Calc, click on the formula bar.
3. Paste (Ctrl+V)

Actual Results:
The data is pasted all on one line, with newlines replaced by single spaces.

Expected Results:
Match Excel behavior: The newlines are pasted.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 12; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 V Stuart Foote 2025-07-13 12:01:13 UTC
But it does keep the new lines! Specifically via the Paste Special put in place for bug 50746, and to be consistent with internal copy/paste single cell multi-cell selections bug 113571 and bug 119928.

Use Paste Special <Ctrl><Shift><V>, and paste into the Formula bar as 'unformatted text', the target cell receives the content with CR/LF or newlines.

To convince yourself, <Tab> to the next cell. Then <Tab> back to the target cell.

CR/LF or newlines will be present.  That is the way the 'unformatted text' filter handles it.

Just the visual representation the edit shell for the Formula bar on paste does not show--during the paste, but they are there.

The Formula bar will show the new lines when revisiting the cell.

No reason to change current behavior, simple <Ctrl>+V paste does not include the new lines, while <Ctrl><Shift>+V w/ "Unformatted text" selection will.

IMHO => WF
Comment 2 Eike Rathke 2025-07-14 13:01:28 UTC
The request is to handle Paste (Ctrl+V) in the Input Line (Formula Bar) same as Paste Special (Shift+Ctrl+V) Unformatted, preserving newlines; one could indeed expect that a standard Paste preserves as much formatting as possible, at least as much as Paste Special Unformatted.

However, pasting text is quite intertwined as the mentioned bug 113571 (specifically https://bugs.documentfoundation.org/show_bug.cgi?id=113571#c4) and bug 119928 (specifically https://bugs.documentfoundation.org/show_bug.cgi?id=119928#c17) indicate, and the behaviour that different targets (input line, in cell, over cell) for the same source may and should behave differently with multiple cells (thus multi-line unformatted text) doesn't make it easier. Maybe someone wants to deeply investigate..
Comment 3 Heiko Tietze 2025-08-01 09:20:39 UTC
(In reply to V Stuart Foote from comment #1)
> Use Paste Special <Ctrl><Shift><V>...
Does this satisfy you, Jason?
Comment 4 jasonkres 2025-08-15 23:56:04 UTC
(In reply to Heiko Tietze from comment #3)
> (In reply to V Stuart Foote from comment #1)
> > Use Paste Special <Ctrl><Shift><V>...
> Does this satisfy you, Jason?

Some perspective on this:

As a technical user, I know all the different paste commands and how to customize the menus and toolbars as well. What I was really trying to encourage to be addressed is not to find a solution for "me" but to make things easier for users who are confused by this not meeting expectations, especially users coming from an Excel background where this functionality works "better". Consider some users just want to focus on data entry and not learn about idiosyncrasies compared to Excel.

I think Eric Rathke summed up my thinking very well: "one could indeed expect that a standard Paste preserves ... at least as much as Paste Special Unformatted.".
Comment 5 Heiko Tietze 2025-08-19 07:54:05 UTC
Created attachment 202375 [details]
Calc (top) vs. Excel (bottom)

While we provide much more and better functionality with paste special the line break is indeed missing. We apparently understand it as part of the formatting while Excel preserves it. However, I see no way to copy the cell content with formatting in Excel, which makes it a poor comparison.

For consistency we should either make F2 and FB (formula bar) behave similarly and paste with all formatting per Ctrl+V or do exactly the current behavior and clear the new-line along with other attributes. But has there been any request to do so? "Make it available" is to optionally allow pasting unformatted.
Comment 6 Heiko Tietze 2025-08-26 06:20:24 UTC
No further comment, let's resolve this as invalid. There is ctrl+v and shift+ctrl+v allowing to insert text with or without all level of formats. The actual request "Paste into formula bar should keep newlines" can be done per shift+ctrl+v in the formula input line with the choice of "Unformatted text".

If you disagree please feel free to reopen.