Bug 405089 - Closing the quotation mark is not smart enough
Summary: Closing the quotation mark is not smart enough
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.55.0
Platform: Archlinux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-04 20:28 UTC by Piotr Mierzwinski
Modified: 2019-03-24 12:51 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2019-03-04 20:28:26 UTC
SUMMARY
I have turned on option: "Enable automatic brackets".
I start typing some string which starts with quotation mark and when I want to close quotation mark  I get at end double quotation marks (two quotation marks). This is really annoying. I know I could turn off above option, but sometime I need to automatic closing of quotation marks. I don't want several time switch this option. I wonder if it could be a little bit smarter and always don't put two characters of quotation marks at end of string.

STEPS TO REPRODUCE
1. Turn on option "Enable automatic brackets".
2. Start type string like this: "abcd
3. Put quotation mark at end of string

OBSERVED RESULT
"abcd""

EXPECTED RESULT
"abcd"

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: YES
(available in About System)
KDE Plasma Version: 5.15.2
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.1

ADDITIONAL INFORMATION
Comment 1 Lothar 2019-03-06 21:37:55 UTC
Well, sometimes there is such similar behavior, but in the here mentioned way can I not reproduce this.
After first hit of double quotes you got "|" (the bar is the cursor) so, typing then abcd ended in "abcd|", which is fine.

You can have some odd result when you try to add the quotes afterwards to some word. With our abcd, adding a quote to the begin "abcd is fine, adding then a quote to the end ended in the mentioned result "abcd"" 

As workaround could you select the word and hit the quote, which ended in "|abcd". However, I'm annoyed too of that and will take a look at it.
Comment 2 Lothar 2019-03-07 17:08:20 UTC
https://phabricator.kde.org/D19598
Comment 3 Piotr Mierzwinski 2019-03-07 20:35:09 UTC
(In reply to Lothar from comment #1)

> As workaround could you select the word and hit the quote, which ended in
> "|abcd". However, I'm annoyed too of that and will take a look at it.

Yes is simple and easy when you have only one word (double click solves it, I mean selects), but in case of sentence it is not so fast, obvious just because there is need to select whole longer or shorter collection of words and this of course takes more time.

BTW. I case of selection one word I wasn't able to find any shortcut (in editor). I think this for sure would speed up selection. Let me explain showing situation like this:

I have such string:  abcd|e  and I invoke some keyshortcut, which selects this word, and after just invoke quotation character. In result I get for example: "abcde"|
and all of this without taking your hands off the keyboard.

Thank you that you will take look at this.
Comment 4 Lothar 2019-03-08 05:15:13 UTC
> BTW. I case of selection one word I wasn't able to find any shortcut (in editor).

Ctrl-Shift-Left/Right See also Settings->Configure-Shortcuts... But, yes, no "Select word where cursor is in"

> I have such string:  abcd|e  and I invoke some keyshortcut, which selects this > word, and after just invoke quotation character. In result I get for example: >"abcde"|
> and all of this without taking your hands off the keyboard.

There is some scripting stuff in KTE, perhaps you can help yourself
https://docs.kde.org/stable5/en/applications/katepart/dev-scripting.html

If so, offer your result in https://phabricator.kde.org , if not open a new bug report for that different issue.
Comment 5 Christoph Cullmann 2019-03-24 12:51:10 UTC
Git commit 714948cac1d12a96f3d6bad9351480f1fb347450 by Christoph Cullmann, on behalf of loh tar.
Committed on 24/03/2019 at 12:48.
Pushed by cullmann into branch 'master'.

DocumentPrivate: Skip auto quotes when these looks already balanced

* Improve readability, const correctness
* const QChar as value, not reference
Related: bug 382960
FIXED-IN: 5.57

Differential Revision: https://phabricator.kde.org/D19598

M  +60   -0    autotests/src/katedocument_test.cpp
M  +2    -0    autotests/src/katedocument_test.h
M  +33   -19   src/document/katedocument.cpp

https://commits.kde.org/ktexteditor/714948cac1d12a96f3d6bad9351480f1fb347450