I agree. If I type a ' character I get 2 of them (''), then if I hit a backspace I delete the first one, but not the second one. How is this saving me typing?
--
Mike Jackson  [[email protected]]
Typz <mailto:[email protected]>
March 9, 2016 at 10:35 AM
Not sure this patch really does the expected behavior: with this patch, backspace will remove the *opening* quote, and the cursor will be before the quote instead of after it... It seems to me that the backspace should really just "undo" the auto-close quote in this case, e.g. remove the closing quote.

--
Francois


_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator
Nikolai Kosjar <mailto:[email protected]>
March 9, 2016 at 10:10 AM

https://codereview.qt-project.org/#/c/151822/
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator
Nikolai Kosjar <mailto:[email protected]>
March 9, 2016 at 8:09 AM
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.

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
Jason H <mailto:[email protected]>
March 8, 2016 at 5:10 PM
A while back, I started a discussion about Creator's quoting policy. There was a lot of support, and a few people were concerned about changing the behavior that has been there since the beginning.

However, I'm again tired of fighting with creator inserting "" when I type " and deleting both when I backspace over one. This behavior only occurs in QtCreator, and no other editor _ever_, and it needs to go. It is a "clever trick" that costs more than it is clever. At least for me, YMMV.

Yes, there is a checkbox, but that applies to brackets and braces as well.

Fundamentally, I want to changes to the behavior:
1. If the character after the cursor is not whitespace, do NOT double quote ("")
2. If backspacing over a double quote, do not remove both double quotes.

For the love of all that is binary!!!

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

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

Reply via email to