On 29 September 2013 18:47, Pavel Roschin <rpg89@post.ru> wrote:
> It is. If I understand correctly the original reason for this is because
> when you set the scintilla buffer (at least as it goes currently), it
> pushes the cursor to the end of the inserted text, and so it needs to be
> pushed back to the start by default (if no other position is stored or
> specified). Please excuse if I'm mistaken here.

Geany with my patch behaves normally without unnecessary goto_pos. But today
I added more clear-looking patch that skips goto-ing if pos == current_pos.
Isn't? Try, it will take 2 minutes:

void sci_goto_pos(ScintillaObject *sci, gint pos, gboolean unfold)
{
        if (unfold) SSM(sci, SCI_ENSUREVISIBLE, (uptr_t) SSM(sci,
        SCI_LINEFROMPOSITION, (uptr_t) pos, 0), 0);
        /* Do not goto if we are already here */
        if(pos == sci_get_current_position(sci)) return;
        SSM(sci, SCI_GOTOPOS, (uptr_t) pos, 0);
}

The problem with this is that by not calling the SSM(sci, SCI_GOTOPOS, (uptr_t) pos, 0); you don't schedule an updateUI and you then don't get the associated notifications.  I don't know what impacts that might have, especially as plugins can depend on those notifications.

I would be *very* wary changing the semantics of such low level functions without great care, checking where they are used and all the side effects, such as the notification callbacks.

Cheers
Lex
 

--
Best regards,
Pavel Roschin aka RPG
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel