Re: How to scroll to a specific line



On Fri, 27 Jul 2018 07:32:13 -0400
Reuben Rissler <silrep emypeople net> wrote:

I have also seen place_cursor_onscreen() work well. Now the thing is, 
none of this will work until the Gtk.SourceView has properly been 
rendered. This means doing something like:

         self.source_buffer.set_text("my text")
         GLib.idle_add(self.scroll_function)

     def scroll_function (self):
         # your scroll code here, like you use already

So you see, the scroll part is not the problem, but rather the 
calculations of iters fails, because these iters are not yet, or are 
invalidated when the buffer/view changes.

Hello Reuben.

Thanks for the suggestion. Believe it or not, I had just arrived at that
same solution! I first tried to use GLib.timeout_add(), and that worked too,
if the time was larger than 300 - 400 ms, which is on the verge of annoying.
I then tried idle_add(), and I guess that makes the 300-400ms 'built-in'.

Now, can this visible delay be eliminated? Maybe disabling the scroll
animation alltogether? (it's really visually a scrolling issue) I haven't seen
this problem in Geany (which I believe uses scintilla).

I did a more complete description of the issue on Stackoverflow, because, at
first, I didn't see my question appearing on the mailing list here:

https://stackoverflow.com/questions/51558047/how-to-select-and-scroll-a-specific-line-in-gtksource

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]