Bug 352981

Summary: Newline \n does not work with --inputbox
Product: [Applications] kdialog Reporter: Tristan Miller <psychonaut>
Component: generalAssignee: Brad Hards <bradh>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version First Reported In: 1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Fixes Bug 352981
Fixes Bug 352981

Description Tristan Miller 2015-09-21 12:42:43 UTC
As mentioned in the first comment to Bug 148575, the newline escape sequence ("\n") does not work with --inputbox.

The code

kdialog --msgbox "foo\nbar"

works as expected, but

kdialog --inputbox "foo\nbar"

does not. I'm using KDialog 1.0 on KDE 4.14.9.

Reproducible: Always

Steps to Reproduce:
1. kdialog --inputbox "foo\nbar"


Actual Results:  
2. Dialog appears with the following text:

foo\nbar

Expected Results:  
2. Dialog should appear with the following text:

foo
bar
Comment 1 Benedikt Geißler 2015-09-27 16:03:28 UTC
I can confirm this bug with Debian testing/stretch.
The output from kdialog --version is:
Qt: 4.8.7
KDE: 4.14.10
KDialog: 1.0
Comment 2 Tristan Miller 2015-09-27 19:23:35 UTC
Created attachment 94746 [details]
Fixes Bug 352981

The attached patch fixes this bug.
Comment 3 Tristan Miller 2015-09-27 19:54:47 UTC
Created attachment 94749 [details]
Fixes Bug 352981

Please ignore the previous patch; I mistakenly uploaded the wrong file.
Comment 4 Tristan Miller 2020-09-30 07:31:49 UTC
Problem is still reproducible with KDialog 20.08.1.
Comment 5 Tristan Miller 2020-09-30 07:55:36 UTC
The --password and --newpassword dialogs have the same problem.  Possibly further dialogs are also affected.
Comment 6 Tristan Miller 2020-09-30 07:56:26 UTC
Comment on attachment 94749 [details]
Fixes Bug 352981

Patch is now obsolete due to API changes and refactoring/further development of kdialog.cpp.
Comment 7 Tristan Miller 2020-10-12 14:03:40 UTC
Git commit 3a34c761a0ef28d8ae1028caae82ead2059a079b by Tristan Miller.
Committed on 12/10/2020 at 13:59.
Pushed by sitter into branch 'master'.

make \n work with (img)inputbox and (new)password

Note that \n in password prompts are converted to spaces due to
bug#427141.

M  +6    -4    src/kdialog.cpp

https://invent.kde.org/utilities/kdialog/commit/3a34c761a0ef28d8ae1028caae82ead2059a079b