[gedit-list] Plugin development question



Hi there,

A few weeks ago I ported the trailsave plugin to Gedit 3
(https://github.com/jonleighton/gedit-trailsave).

It worked, but I found it to be pretty slow, particularly on large
documents. So today I have been looking at a new strategy:

* Get the contents of the buffer as a python string
* Use regular expressions for the replacement
* Save the result back to the buffer

This seems to be much faster.

One issue is preserving the state of the window to the user. I have
managed to cook up some code which restores the cursor position.

However, I am struggle to restore the scroll position of the view. I
found that the Gedit.View implements the Gtk.Scrollable interface, so I
have been trying to use set_vadjustment. However, it simply doesn't
work.

Any hints would be much appreciated. I am not really a python or a gtk
programmer, so apologies in advance for any ignorance on my part :) The
code in question is:

https://github.com/jonleighton/gedit-trailsave/blob/master/trailsave.py#L87

Many thanks,

Jon Leighton

-- 
http://jonathanleighton.com/

Attachment: signature.asc
Description: This is a digitally signed message part



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