Bug 167486 - Paste into formula bar should keep newlines
Summary: Paste into formula bar should keep newlines
Status: UNCONFIRMED
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-07-14 13:02 UTC (History)
3 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 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..