<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 29 September 2013 19:45, Pavel Roschin <span dir="ltr"><<a href="mailto:rpg89@post.ru" target="_blank">rpg89@post.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Shouldn't updateUI called only for _visible_ documents? Anyway it will when you<br>
click on tab and change document.<br></blockquote><div><br></div><div>No it also does notifications, which doesn't depend on visibility.  It shouldn't render if the document is not visible, but it still should do the callbacks.  sci_goto_pos() is called in lots of places in Geany, not just at load time, and probably lots more in plugins, missing notifications has an unknown impact.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Considering problem more deeper - actually bottleneck function is<br>
SCI_ENSUREVISIBLE, not exactly sci_goto_pos. Ok, there are many things to<br>
thinking about.<br></blockquote><div><br></div><div>Well, the costly part is the rendering, which happens from a delayed GTK idle callback inside scintilla.  As Matthew said when the text is inserted into the buffer the cursor is at the end, getting it back to the start before the rendering is important, the less of the text Scintilla renders the better, and if the position is set at zero it *should* only render the start of the text, not the whole file, which would happen if the position was still at the end.</div>
<div><br></div><div>Cheers</div><div>Lex</div><div><br></div><div>PS please only reply to the list, not directly to people as well, thats how stuff gets disconnected from the list.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5"><br>
> On 29 September 2013 18:47, Pavel Roschin <<a href="mailto:rpg89@post.ru">rpg89@post.ru</a>> wrote:<br>
><br>
> > > It is. If I understand correctly the original reason for this is because<br>
> > > when you set the scintilla buffer (at least as it goes currently), it<br>
> > > pushes the cursor to the end of the inserted text, and so it needs to be<br>
> > > pushed back to the start by default (if no other position is stored or<br>
> > > specified). Please excuse if I'm mistaken here.<br>
> ><br>
> > Geany with my patch behaves normally without unnecessary goto_pos. But<br>
> > today<br>
> > I added more clear-looking patch that skips goto-ing if pos == current_pos.<br>
> > Isn't? Try, it will take 2 minutes:<br>
> ><br>
> > void sci_goto_pos(ScintillaObject *sci, gint pos, gboolean unfold)<br>
> > {<br>
> >         if (unfold) SSM(sci, SCI_ENSUREVISIBLE, (uptr_t) SSM(sci,<br>
> >         SCI_LINEFROMPOSITION, (uptr_t) pos, 0), 0);<br>
> >         /* Do not goto if we are already here */<br>
> >         if(pos == sci_get_current_position(sci)) return;<br>
> >         SSM(sci, SCI_GOTOPOS, (uptr_t) pos, 0);<br>
> > }<br>
> ><br>
><br>
> The problem with this is that by not calling the SSM(sci, SCI_GOTOPOS,<br>
> (uptr_t) pos, 0); you don't schedule an updateUI and you then don't get the<br>
> associated notifications.  I don't know what impacts that might have,<br>
> especially as plugins can depend on those notifications.<br>
><br>
> I would be *very* wary changing the semantics of such low level functions<br>
> without great care, checking where they are used and all the side effects,<br>
> such as the notification callbacks.<br>
><br>
> Cheers<br>
> Lex<br>
><br>
><br>
> ><br>
> > --<br>
> > Best regards,<br>
> > Pavel Roschin aka RPG<br>
> > _______________________________________________<br>
> > Devel mailing list<br>
> > <a href="mailto:Devel@lists.geany.org">Devel@lists.geany.org</a><br>
> > <a href="https://lists.geany.org/cgi-bin/mailman/listinfo/devel" target="_blank">https://lists.geany.org/cgi-bin/mailman/listinfo/devel</a><br>
> ><br>
<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Pavel Roschin aka RPG<br>
</div></div></blockquote></div><br></div></div>