Description
Consider the following C++ code. | indicates my cursor.
(The cursor is actually a box in normal mode, so it's on rather than between characters...)
const std::string r = R"( { "Key1": "V|alue1", "Key2": "Value2" })"
In regular Vim, typing ci" produces the following (and also switches to insert mode). This is expected and desired.
const std::string r = R"( { "Key1": "|", "Key2": "Value2" })";
QtCreator's FakeVim behavior is a little different. It produces the following, which I think is incorrect:
const std::string r = R"( { "Key1": "Value1"|"Key2": "Value2" })";
It appears that the following method is to blame.
bool FakeVimHandler::Private::selectQuotedStringTextObject(bool inner, const QString "e)
Some observations:
- As far as I can tell, Vim's behavior with quotes + the a and i modifiers is line-based. That is, doing things like ca' or ci" completely ignores quotes above and below the line in question.
- In contrast, the behavior of FakeVim is influenced by quotes on preceding lines. For instance, introducing an errant " above the const std::string... "fixes" the problem. This behavior is clearly desirable for things like braces (ci{ would be useless if it was limited to individual lines) but I am not sure it is the right thing to do for quotes.
- Even with obvious syntax errors, Vim attempts to do the right thing if you perform one of these commands while on top of a quote. That is, it figures out whether the quote is an opening or closing quote and behaves accordingly. It is possible to confuse it (for example, by putting everything in my example on one line), but its behavior when the cursor is inside the quotes is always correct.
- Vim and FakeVim have different behavior with ci" and the following text.
"quoted1" unqu|oted "quoted2"