[Qt-creator] It's time to fix double redundant quotes
Coda Highland
chighland at gmail.com
Wed Mar 9 19:49:27 CET 2016
I think one thing that would make a big difference is if the behavior
were keyed off of more than JUST the current state of the document and
the position of the caret.
As I alluded to upthread, the other editors I've used that have
automatic brace/quote insertion only do magic on
automatically-inserted brace/quote characters, and they highlight that
character differently to indicate that its behavior is in fact magical
-- if you type that character, it'll be overwritten, and if you
backspace its mate, it'll be deleted.
In all such cases, the magic goes away once you've navigated away from
it. (The definition of "navigated away from" isn't precisely clear,
but the visual highlighting at least makes the behavior obvious.)
If you position your cursor next to a quote or brace that was already
in the document, no magic should occur whatsoever. You should be able
to edit the document without unexpected behaviors.
/s/ Adam
On Wed, Mar 9, 2016 at 10:07 AM, Jonathan S. Shapiro <shap at eros-os.org> wrote:
> I don't care one way or the other how this issue gets resolved, but I did
> want to offer an observation.
>
> Because it is surprising, it is helpful if modal behavior is as consistent
> as possible. In this case, the behavior involves how "backspace" behaves
> when the input looks like:
>
> "|"
>
> where '|' represents the position of the caret. There are several small
> suggestions that I wanted to make:
>
> 1. The behavior of backspace in the "inside double-quote" case should match
> the behavior in the "inside single quote" case.
>
> 2. It should perhaps *also* match the behavior in the "inside curly braces",
> "inside square braces" and "inside parentheses" cases. This is the point
> that I suspect will want some discussion.
>
> 3. I don't know if we have enough information in the editor to do so, but we
> should think about whether the modal backspace behavior should only occur
> between an opening and a closing pair. That is, we should think about what
> happens in the following case:
>
> "some"|"text"
>
> And we should also consider the cases:
>
> ""|"
> ""|""
>
> Unless I am missing something in my thoughts, the modal backspace behavior
> does the right thing in these cases. It deletes the "wrong" quote (that is:
> the one *after* the caret), but the end result has the desured number of
> double quotes and the same caret position that the "normal" backspace would
> have produced.
>
> We also need to consider cases similar to:
>
> ab(|)xz
>
> What should be the behavior of backspace when the bracketing open and close
> characters do not "match". I actually think it is reasonable in this case to
> delete the closing bracket. It seems reasonable to me for [], (), and {}.
> Initially surprising, but something the use will quickly get used to.
>
> That is: it does not appear to me that any special heuristic "magic" is
> needed to deal with any of this. But I may be wrong, and it would be good to
> think these cases through to be sure.
>
>
> Good day to all,
>
>
> Jonathan Shapiro
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
More information about the Qt-creator
mailing list