Bug 334612 - Selecting text and pressing enter doesn't replace the text but only adds a newline
Summary: Selecting text and pressing enter doesn't replace the text but only adds a ne...
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: 4.13.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-11 15:17 UTC by Florian E.J. Fruth
Modified: 2015-04-29 05:21 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian E.J. Fruth 2014-05-11 15:17:49 UTC
After upgrading to kubuntu 14.04 the kmail composer doesn't replace selected text if you press enter. Instead it just adds a newline at the current position (meaning in front or after the selected text).

Reproducible: Always

Steps to Reproduce:
1. Select a text (e.g. with the mouse or the cursort keys)
2. Press enter
Actual Results:  
Kmail adds a newline

Expected Results:  
Replace the selected text with a newline.
Comment 1 Laurent Montel 2014-05-11 15:32:26 UTC
Ok I understand bug.
I will fix it soon.
Comment 2 Florian E.J. Fruth 2014-05-11 19:05:44 UTC
Sorry for not recognizing this earlier: it seams that this bug only happens if you select text from the signature and press enter. It works fine with the normal email text.
Comment 3 Laurent Montel 2014-05-12 05:46:27 UTC
Git commit dc110d65dcc38af6989ceb3d503271302539c937 by Montel Laurent.
Committed on 12/05/2014 at 05:46.
Pushed by mlaurent into branch 'KDE/4.13'.

Fix Bug 334612 - Selecting text and pressing enter doesn't replace the text but only adds a newline

FIXED-IN: 4.13.1

M  +1    -1    messagecomposer/composer/kmeditor.cpp
M  +1    -1    pimcommon/autocorrection/widgets/lineeditwithautocorrection.cpp
M  +22   -20   pimcommon/autocorrection/widgets/richtexteditwithautocorrection.cpp

http://commits.kde.org/kdepim/dc110d65dcc38af6989ceb3d503271302539c937
Comment 4 markuss 2014-05-15 23:59:20 UTC
No, the bug is sadly not fixed. :-(

Running 4.13.1 under Fedora (kde-unstable packages).
Comment 5 Laurent Montel 2014-05-16 06:09:11 UTC
(In reply to comment #4)
> No, the bug is sadly not fixed. :-(
> 
> Running 4.13.1 under Fedora (kde-unstable packages).

So still update it :)
It's fixed I already tested it.
As you can see in commit:
" -            if(d->mAutoCorrection && !isLineQuoted(textCursor().block().text())) {

   +        if(d->mAutoCorrection && !isLineQuoted(textCursor().block().text()) && !textCursor().hasSelection()) {
"

=> if selection we don't make autocorrection
=> it's fixed.
Comment 6 Gunter Ohrner 2014-05-18 07:36:59 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > No, the bug is sadly not fixed. :-(
> > Running 4.13.1 under Fedora (kde-unstable packages).
> So still update it :)

He says he's already running 4.13.1, so to what version is he supposed to update?

I'm also running 4.13.1 on Kubuntu 14.04 (About dialog: KMail Version 4.13.1 unter KDE 4.13.1) and bug clearly is not fixed.

The behaviour if ENTER is pressed is as expected if the line is quoted (which seems to be what your if statement checks), but it's still wrong if a line is not quoted. In this case, an ENTER or SPACE does not replace the selected text, but simply adds the newline or space character in front of or after the selected text.
Comment 7 Gunter Ohrner 2014-05-18 07:40:22 UTC
Mh, can someone re-open this bug, or should I add a new one for KDE 4.13.1?

Also this bug looks like a duplicate of Bug 334571 which also is not fixed in KDE 4.13.1, so maybe it should be tagged / linked accordingly.
Comment 8 Gunter Ohrner 2014-05-18 08:35:53 UTC
Additional information: If the selection spans multiple lines, some quoted and some not, the behaviour if ENTER or SPACE is pressed does not depend on the selected area but on the row the cursor is positioned in.

If if (parts of) three lines are selected and the cursor is positioned in a quoted line, pressing ENTER or SPACE will replace the selected text by a newline or space character, as expected.

If if (parts of) three lines are selected and the cursor is positioned in a not-quoted line, pressing ENTER or SPACE will simply add a newline or space character in front of or after the selection, contrary to the behaviour of every other GUI text editor I know.
Comment 9 markuss 2014-05-22 11:39:07 UTC
> => if selection we don't make autocorrection
> => it's fixed.

This bug is called "Selecting text and pressing enter doesn't replace the text but only adds a newline" and this is a bug that has not been fixed. Maybe there was another bug about autocorrection but this is not it.
Comment 10 Gunter Ohrner 2014-05-22 11:55:40 UTC
It's "sort of" fixed if
a) text is selected and
b) you press enter (or space) while the cursor is located in a quoted line.

In this case, the selection is replaced.

If, however, some text is selected and the cursor is NOT in a quoted line while you press enter (or space), then the bug prevails and the selection is NOT replaced.
Comment 11 Lastique 2014-06-15 11:12:26 UTC
I'll add to comment 10 that when you select several lines with keyboard, especially at the end of the email you're replying to, the cursor is typically not on the quoted line, and pressing enter does not remove the selected text. This is really annoying.
Comment 12 Gunter Ohrner 2015-04-28 20:01:22 UTC
This bug is fixed in kMail 4.14.2 and 4.14.6, as far as I can tell, and probably can be closed now. :-)