LibreCalc - Ctrl + Enter = Horrible Shortcut

Hello fellow libre enthusiasts,

I love LibreOffice.

In LibreCalc, when you are editing the text/content of a cell, and you want to add a break line, you have to press Ctrl + Enter.

All other softwares use Shift + Enter to add a break line. And Ctrl + Enter to “send message” or “send email”. Even this very forum. Try typing your topic or reply then hit Ctrl + Enter, and it will be submitted.

You can see the problem.

Using LibreCalc, I’m getting into the habit of pressing Ctrl + Enter to add a break line.

And then when I’m writing an email, due to habit, I press Ctrl + Enter… and OOoops, email has been sent.

When I should’ve pressed Shift + Enter.

I tried modifying this shortcut with a Macro and with a Custom Python script using LibreOffice’s API. Nothing worked. Since it’s not possible to get the mouse cursor position and execute the macro/script where the cursor is.

So please for the love of god, allow us to change Ctrl + Enter to Shift + Enter.

I don’t care about moving 1 cell up, using Shift + Enter. So if there’s an option to choose what Shift + Enter does, and I can assign a break line, I would immediately choose that.

Please consider this.


Feature requests

Thank a lot you for the correction!

Not sure why I wrote that, I meant to say Shift + Enter, as you pointed out. It’s edited now.

I’ll chuck it off to submitting this topic at 2 AM, and being very tired.

1 Like

Somebody who doesn’t know all other softwares, but uses LibreOffice (including predecessors possibly) for decades might be irritated.
However, it is actually strange that Calc associates the “line break inside a SheetCell text” with Ctrl+Enter while the same modified key is used for “hard page break” in Writer.
If you just occasionally rely on the API in user code, you may also be buffled by the fact that lines inside cells are enumerated on a first level like paragraphs are in Writer texts though they are coded to the string as Chr(10)…

It may be next to impossible to re-systematise irritating behaviour based on decisions made decades ago under (forgotten?) different propositions.

1 Like

On a side note:

LO Help 7.5 says the Ctrl+Enter keys will not work at the input line.

Calc Guide 7.5 (p.172) states that Shift+Enter will work in the Input line.

Both shortcuts work at the input line.

1 Like

Did you read the also ?

1 Like

Yes, I did.
However my main point was what Calc Help states about the Ctrl+Enter keys.

Thanks for that, Yeah it doesn’t make much sense, indeed.

I dabbled with the API and wrote a custom python script which did work, but not at the precise cursor position. It only appended the line break at the end of the cell text. Which is totally useless.

Hopefully, there is a way to re-configure that.

I mean, how hard could it really be? I’m not fully aware

Me neither. This is definitely the domain of LO developers / gurus.

If you submit a feature request, as robleyd suggested, you might receive a knowledgeable response.

Take also a look at tdf#63994 (“Calc Multiline Input (input line at top of document): Allow creating new line with Shift-Return”). It mentions Shift-Return in the context of cell editing.

1 Like

Here is a silly workaround idea without usage of the Ctrl-Enter/Shift-Enter (entering a multiline text as a formula):

="First line of the string"&CHAR(10)&"second line of the string"

And here is a more silly idea with usage the macros. I can assign the sub “CHR_10” to a hotkey, even to the Shift-Enter key too:

sub CHR_10
end sub

sub my_insert_a_char(SpecChar as string)
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("")
rem ----------------------------------------------------------------------
'dim args1(0) as new
'args1(0).Name = "Text"
'args1(0).Value = SpecChar
'dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
dim args2(0) as new
args2(0).Name = "Symbols"
args2(0).Value = SpecChar

dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args2())
end sub

Of course the original function of the Shift-Enter key will be eliminated.

And you can to write another subs by usage the character codes and by calling the sub “my_insert_a_char”

1 Like

Thanks a lot for the suggestions!
Your first one, with the multiline formula, is interesting, but one needs to know exactly where the break lines should be ahead of writing the text. In which case, I rather just write the text with the correct break lines in another text editor (like Obisidan) and just copy+paste it into the designated LibreCalc cell.
Your second suggestion still faces the same issue my macro and python scripts faced. The break line is inserted at the end of the cell text. Meaning, the macro doesn’t consider the mouse cursor position. Which makes them totally useless.
The only solutions I can foresee are:

  1. The LIbreOffice team makes a change to allow for Shfit+Enter to create a new line
  2. The LibreOffice team changes the API in a way which it accounts for the mouse cursor position. Therefore, we can create python scripts and macros.

As @robleyd and @cwolan suggested, I’ll submit a feature request.

Of course YOU need to know where you want to insert the line feed character. If you want automatic multiline cell, then just use a custom Cell Style with “Wrap text automatically” option and w/o automatic hyphenation.

Not for me. It works as you expected it. I can not upload a sample file with customized hotkeys, because it is not possible to save the hotkey settings into a file. I can assign my macro to a custom toolbar icon, or to a menu item, or to a Form control element.
But you can try my macro assigned to a hotkey. And it works when you edit a cell. It will insert the CHAR(10) character into the cursor position.

My new sample file contain a custom menu item in the Insert menu. The first item is CHR_10 now. Try to enter some string into a cell, and use the Menu item where you want to insert a line feed into the text.
Insert - CHR_10.ods (14.0 KB)

Thanks for the extra effort of sending the .ods file!
I downloaded and tried running your macro, but it doesn’t work.
I also recreated your macro via the code you provided above myself, it also doesn’t work.
Here’s a screen recording of your .ods file that you sent above. I executed your CHR_10 from the insert drop-down menu. Nothing happens.
(had to convert the screen recording to a gif, so I can attach it here)

Have you enabled the macro running from the file?

Yeah, I have it set to the lowest security:

But I did get it to work. I switched from the flatpak version of LO to the deb version.
Even in the deb version, the macro still doesn’t work when assigned to Shift+Return (Enter).
But it works with Alt+Q for example. So at least that’s something!
Does it work with Shift+Return (Enter) on your end?

Yes, it works assigned to the hotkey (of course from the MyMacros, but not from the file) “Shift-Enter” on Windows10x64Prof., and in LO 7.5.7, LO 7.6.2. Works in the Imput line, and works in an empty cell. (Works in the input line, when I reedit a cell content, but not work, when I reedit the cell content in the cell itself.)