Il 04/01/2011 02:12, Pavel Sanda ha scritto:

i was almost going to say that its unintrusive enough for 2.0, but then i saw
changes in Text::insertStringAsLines. what does it do, why does it do?

@@ -796,12 +796,14 @@
                        space_inserted = (*cit == ' ');
                }
        }
+       dit.pit() = pit;
+       dit.pos() = pos;
  }

Sure, this deserves an explanation: AFAICS, after pasting, normally the cursor is supposed to be placed at the *end* of the pasted text. However, in that method, the cursor position was kept at the *beginning* of the paste point. This was behaving in a "weird" way, IMHO. As I didn't have an easy/trivial way to know how much to move the cursor further after the invocation of that method (performing the actual paste), I noticed that, instead, the method itself was perfectly aware of that. The 2 introduced lines and the passing of the cursor by reference (as opposed to by value) simply implement this behavior: they leave the cursor after the inserted string. I have to admit that I have no clue about whether this impacts other uses of that method and causes misbehaviors. If you want, I can go through the code, identify all the call points, and restore the original behavior in all of the other cases except where I used the insertStringAsLines() (or, equivalently, add a further boolean parameter telling whether or not to move the cursor after, defaulting to false).

Bye,

    T.

Reply via email to