Bug 414530 - Searching using multi-line text increases the size of the search field, causing it to expand outside of the panel on which it is located
Summary: Searching using multi-line text increases the size of the search field, causi...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: discover (show other bugs)
Version: 5.16.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2019-11-26 11:24 UTC by Alexander Potashev
Modified: 2019-12-02 16:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot (23.13 KB, image/png)
2019-11-26 11:24 UTC, Alexander Potashev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Potashev 2019-11-26 11:24:41 UTC
Created attachment 124125 [details]
screenshot

SUMMARY
Search bar screwed up after pasting multi-line text.

STEPS TO REPRODUCE
1. Prepare multi-line text in a text editor, e.g. "1\n2\n" in Kate, where "\n" stands for a line break.
2. Select All (Ctrl+A) in Kate, then copy (Ctrl+C)
3. Run Discover
4. Press Ctrl+F to focus the search bar
5. Press Ctrl+V to paste

OBSERVED RESULT
6. The search bar explodes, see screenshot.

EXPECTED RESULT
Should probably replace every "\n" with a space when pasting.

SOFTWARE/OS VERSIONS
Operating System: Fedora 31
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.61.0
Qt Version: 5.12.5
Kernel Version: 5.3.7-301.fc31.x86_64
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15,4 ГиБ

ADDITIONAL INFORMATION
Comment 1 SensoRR 2019-12-01 07:40:27 UTC
Hi Alexander,

I am afraid I am unable to reproduce this bug in the latest version of Discover.
The steps I have followed:

1. In Kate, I have added "first line" and then "second line" in the next line below.
2. CTRL+A and CTRL+C to copy the text I have prepared in Kate
3. Opened Discover, CTRL+F to start searching
4. CTRL+V to paste my text from Kate in
5. Text is pasted in fine with spaces in place of line breaks as expected

Please note I have tested this with:
Discover Version: 5.17.3
Operating System: Arch Linux 
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Kernel Version: 5.3.13-arch1-1

Could you just confirm that the steps I have followed are correct?
Comment 2 Alexander Potashev 2019-12-01 10:59:10 UTC
(In reply to SensoRR from comment #1)
> 5. Text is pasted in fine with spaces in place of line breaks as expected

Please add another step:

6. Press Enter.
Comment 3 SensoRR 2019-12-01 15:27:32 UTC
Hi Alexander,

Thank you, I can now reproduce the bug.

STEPS TO REPRODUCE
1. Add multi-line text to your clipboard from another source. I have added two lines to a new document in Kate and then copied them using CTRL+C.
2. Open Discover and paste the multi-line text into the search form at the top.
3. Press Enter to run the search.

OUTCOME
The height of the field is increased, causing it to overflow the panel in which it is located.

EXPECTED OUTCOME
Text provided in the search field should not affect it's dimensions.

TESTED WITH
Discover Version: 5.17.3
Operating System: Arch Linux 
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Comment 4 Aleix Pol 2019-12-02 16:24:06 UTC
Git commit 5181714fb39e597e81030c737947bd1c30281817 by Aleix Pol.
Committed on 02/12/2019 at 16:23.
Pushed by apol into branch 'Plasma/5.17'.

Don't include newlines in searches

M  +3    -1    discover/qml/SearchField.qml

https://commits.kde.org/discover/5181714fb39e597e81030c737947bd1c30281817