Recent

Author Topic: TMemo WantReturns=False Fails on Linux  (Read 12411 times)

msintle

  • Full Member
  • ***
  • Posts: 106
TMemo WantReturns=False Fails on Linux
« on: March 30, 2024, 07:38:31 pm »
Expected behavior: When WantReturns is FALSE, Ctrl+Enter still enters a new line in TMemo.

Actual behavior: Ctrl+Enter does nothing.

The expected behavior is realized properly on Windows and macOS.

Any thoughts for fixes and/or workarounds?

jamie

  • Hero Member
  • *****
  • Posts: 6225
Re: TMemo WantReturns=False Fails on Linux
« Reply #1 on: March 30, 2024, 08:06:39 pm »
Must be one of those forgotten features.

what Widget are you using ?
The only true wisdom is knowing you know nothing

Thaddy

  • Hero Member
  • *****
  • Posts: 14614
  • Sensorship about opinions does not belong here.
Re: TMemo WantReturns=False Fails on Linux
« Reply #2 on: March 30, 2024, 08:12:24 pm »
i suspect a hardcoded #13#10 instead of LineEnding. Not the Tmemo at fault.
« Last Edit: March 30, 2024, 08:16:00 pm by Thaddy »
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

msintle

  • Full Member
  • ***
  • Posts: 106
Re: TMemo WantReturns=False Fails on Linux
« Reply #3 on: April 02, 2024, 01:17:06 pm »
Must be one of those forgotten features.

what Widget are you using ?

Reproduces equally with both Qt5 and GTK2.

msintle

  • Full Member
  • ***
  • Posts: 106
Re: TMemo WantReturns=False Fails on Linux
« Reply #4 on: April 02, 2024, 01:18:05 pm »
i suspect a hardcoded #13#10 instead of LineEnding. Not the Tmemo at fault.

Pressing the Enter key works fine when WantReturns=True.

It is only Ctrl+Enter that fails when WantReturns=False.

AlexTP

  • Hero Member
  • *****
  • Posts: 2417
    • UVviewsoft
Re: TMemo WantReturns=False Fails on Linux
« Reply #5 on: April 02, 2024, 01:42:34 pm »
Seems you need to handle CTRL+Enter by hands. It is not handled by native Memo code on Windows.

rvk

  • Hero Member
  • *****
  • Posts: 6199
Re: TMemo WantReturns=False Fails on Linux
« Reply #6 on: April 02, 2024, 02:05:35 pm »
Isn't this just default behavoir?
The WantReturns is only for the Enter.

Even in Delphi this is the case.
Quote
Note: If WantReturns is false, users can still enter return characters into the text by pressing Ctrl+Enter.
https://docwiki.embarcadero.com/Libraries/Sydney/en/API:Vcl.StdCtrls.TMemo.WantReturns

O, and this is also documented for Lazarus:
Quote
The Enter key is normally used to press the default button in a form, so it cannot be used to add line breaks into the text by default. Set WantReturns to True to allow line breaks to be entered using Enter when the control has the input focus. Ctrl+Enter can be used to insert a line break, even if WantReturns is set to False.
https://lazarus-ccr.sourceforge.io/docs/lcl/stdctrls/tcustommemo.wantreturns.html

msintle

  • Full Member
  • ***
  • Posts: 106
Re: TMemo WantReturns=False Fails on Linux
« Reply #7 on: April 03, 2024, 02:32:06 pm »
Seems you need to handle CTRL+Enter by hands. It is not handled by native Memo code on Windows.

Not sure what the confusion is.

Ctrl+Enter works perfectly fine on both Windows and macOS when WantReturns=False.

It only fails on Linux.

Are you saying it fails on Windows, which is definitely not the case?

msintle

  • Full Member
  • ***
  • Posts: 106
Re: TMemo WantReturns=False Fails on Linux
« Reply #8 on: April 03, 2024, 02:33:14 pm »
Isn't this just default behavoir?
The WantReturns is only for the Enter.

Even in Delphi this is the case.
Quote
Note: If WantReturns is false, users can still enter return characters into the text by pressing Ctrl+Enter.
https://docwiki.embarcadero.com/Libraries/Sydney/en/API:Vcl.StdCtrls.TMemo.WantReturns

O, and this is also documented for Lazarus:
Quote
The Enter key is normally used to press the default button in a form, so it cannot be used to add line breaks into the text by default. Set WantReturns to True to allow line breaks to be entered using Enter when the control has the input focus. Ctrl+Enter can be used to insert a line break, even if WantReturns is set to False.
https://lazarus-ccr.sourceforge.io/docs/lcl/stdctrls/tcustommemo.wantreturns.html

I don't understand what you're trying to say.

Ctrl+Enter does NOT enter a new line in a TMemo control on Linux ONLY when WantReturns is FALSE.

rvk

  • Hero Member
  • *****
  • Posts: 6199
Re: TMemo WantReturns=False Fails on Linux
« Reply #9 on: April 03, 2024, 03:30:52 pm »
Ctrl+Enter does NOT enter a new line in a TMemo control on Linux ONLY when WantReturns is FALSE.
Ha, then I misunderstood.

Yes. It seems like the CTRL+Enter is also blocked when setting WantReturns to false.
That's a bug.

The weird part is... Alt+Enter does still work  ;)
« Last Edit: April 03, 2024, 03:33:06 pm by rvk »

msintle

  • Full Member
  • ***
  • Posts: 106
Re: TMemo WantReturns=False Fails on Linux
« Reply #10 on: April 06, 2024, 08:25:24 pm »
Ctrl+Enter does NOT enter a new line in a TMemo control on Linux ONLY when WantReturns is FALSE.
Ha, then I misunderstood.

Yes. It seems like the CTRL+Enter is also blocked when setting WantReturns to false.
That's a bug.

The weird part is... Alt+Enter does still work  ;)

That is a brilliant workaround - thanks :)

Edit - Spoke too soon :(

Doesn't work on, for example, Kali 23 with Qt5 Lazarus!

Any thoughts on what a proper fix for this problem would entail?
« Last Edit: April 06, 2024, 08:40:18 pm by msintle »

rvk

  • Hero Member
  • *****
  • Posts: 6199
Re: TMemo WantReturns=False Fails on Linux
« Reply #11 on: April 07, 2024, 09:50:25 pm »
The weird part is... Alt+Enter does still work  ;)
That is a brilliant workaround - thanks :)

Edit - Spoke too soon :(

Doesn't work on, for example, Kali 23 with Qt5 Lazarus!

Any thoughts on what a proper fix for this problem would entail?
The problem is that Qt5 doesn't support the Alt+Enter trick.

If you want either one (Alt+Enter or Ctrl+Enter) to work in Qt5 you would need to create a bug report.

BTW. Qt5 also doesn't support Ctrl+Enter, even when WantReturns is set to true.

 

TinyPortal © 2005-2018