> On Mar 9, 2016, at 2:09 PM, Nikolai Kosjar <[email protected]> 
> wrote:
> 
> Hi!
> 
> Let me summarize for myself and others the ways we can add quotes to some 
> text. Default settings are assumed, the relevant one is:
> 
> [x] Automatically insert matching characters.
> 
> 
> a) Insert quote before text:
>  Type: "foo
>  This results in: "foo"
>  The closing quote was added after typing the initial ".
>  Looks fine.
> 
> b) Insert quotes afterwards by using selection.
>   1. Type: foo bar
>   2. Select the typed text
>   3. Hit "
>  This results in: "foo bar"
>  Looks fine.

Actually this is often wrong. E.g. select
“foo”
and pressing “ will add quotes around the already quoted text.
Also in many other cases I just want to replace the selected text when pressing 
a key, even if it is a "

> c) Insert quotes afterwards by starting with the closing quote
>  You have: foo bar
>  Type: "
>  This results in: foo bar""
>  Ops 1: The second " was not intended.
>  Hit backspace.
>  Ops 2: Both quotes are removed and you are the beginning again.
> 
> 
> Note that if you hit " and another one is added, your cursor is then between 
> the quotes: "|". Hitting backspace here removes then both quotes. If the 
> cursor is behind both quotes (e.g. you've moved it there manually), only one 
> quote is removed. This also applies to () and [], but not to {} (thinking of 
> lambdas we probably should include that one, too).
> 
> Although the option in the settings is named "Automatically insert matching 
> characters" it seems to also handle the removal of the pairs, at least when 
> the cursor is in-between. We probably should change this if we do not 
> introduce further options.
> 
> I agree that we should address the "Ops 2" from above, that is not removing 
> both quotes if the cursor is in-between them. This will make it inconsistent 
> when looking at () and [], but I think that's justified in this case. The 
> problem here is the single quote by itself - you can't tell whether it's an 
> opening or closing one without further information (typing ')' does not add 
> you the opening one automatically).
> 
> Regarding "Ops 1", I don't think we can reliably detect whether the users 
> inserts an opening or closing quote. Your heuristic is not enough:
> 
> On 03/08/2016 11:10 PM, Jason H wrote:
>> Fundamentally, I want to changes to the behavior:
>> 1. If the character after the cursor is not whitespace, do NOT double quote 
>> ("")
> 
> Would break case a) from above for e.g. function arguments:
> 
>       foo(|)
>       foo(|,1)
> 
>> 2. If backspacing over a double quote, do not remove both double quotes.
> 
> Agree, see above.
> 
> 
> Nikolai
> _______________________________________________
> Qt-creator mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Principle Software Engineer - The Qt Company GmbH
 
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 
144331 B

_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to