RE: [gtk-list] Re:Center text

I'm not sure what exactly the find_line_at_point function in gtktext.c does,
and why it isn't made public, but if you're trying to find a way to get the
widget to jump to a certain line versions greater than 0.4.5 of gEdit (meaning
CVS) have fixed that problem... Off of GNOME's cvs tree the function is in
search.c and is named seek_to_line, and in version 0.4.5 it's at the bottom of
commands.c... Basically it just calculates the number of lines in the text
widget, and with that information sets the vertical adjustment to the value
that corresponds to the specified line number.. The algorithm isn't exact, but
seems to work pretty well...

On 12-Aug-98 Marc wrote:
> Pelaez Valdes Canek wrote:
>>         Yeah, in fact I'm using that right now, but I dont like it.
>>         And I want that the view area "jump" to the  point in question, not
>> scrolling to it.
> So do I !
> Last month, this problem was already raised (Subject: GtkText: annoying
> scroll):
> Some Guy wrote:
>>   I saw a question in the archives about a search+replace function, to
>> scroll to a certain point when a string is found.  The answer posted was
>> to just do a insert_text/delete_text combo where the string was found.
>> There are two problems with this solution: one, if the text is frozen,
>> this doesn't work. Two, instead of just zipping down to where the text is
>> inserted, it scrolls (which can take quite a long time if there is a lot
>> of text between the current point and the insertion point).
>>   I looked through the gtktext.c source, and found a static function
>> find_line_at_point, which is called by gtk_text_insert_text if the text is
>> unfrozen. My question is, why is this function static? It seems like a
>> very valuable function, and if it were available to use by an application
>> it would really help with stuff like search+replace (there is even a flag
>> to set whether it scrolls to the line or just zaps right there!).
>> Can this function be made public in the next gtk release, or at least a
>> wrapper function? It would be very useful.
> Marc wrote:
>> I recently posted a question on this subject but no-one answered... 
> --  
> Marc
> ** ERROR **: sigsegv caught
> -- 
> To unsubscribe: mail -s unsubscribe < /dev/null

Evan Lawrence

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