You might be able to fiddle around with the newlines at the end of the buffer
to get something to work with the textview.
Eric
//gcc -Wall text_space1.c -o text_space1 `pkg-config --cflags --libs gtk+-3.0`
#include
static void value_changed(GtkAdjustment *v_adjust, GtkWidget **widgets)
Thanks.
IMO, that's too much to do for this feature :-)
So I will just use a keyboard shortcut to do the scrolling, when the cursor
gets too low in the window.
Meanwhile, I want to make a GTK feature suggestion to have a signal emitted
when the TextView window scrolls to reveal the next line in
Thanks Joël,
I don't see how your code reacts to scrolling ? But I used your idea to
check the buffer length. That helped filter out a lot of the signals. But
other non-keyboard actions can change the buffer length, of course, so it's
not dependable. :-/
On Tue, Sep 25, 2018 at 10:17 PM Joël
Hi again,
For sure you should probably use:
g_signal_connect_after(your_text_buffer, "changed",
G_CALLBACK(your_text_buffer_changed_callback), your_data);
and YOUR_DATA(your_data) just casts to your pointer to a struct or
object containing some information:
struct _YourData{
gint
Hi,
g_object_get(your_text_view,
"buffer", _text_buffer,
NULL);
g_signal_connect(your_text_buffer, "changed",
G_CALLBACK(your_text_buffer_changed_callback), your_data);
void your_text_buffer_changed_callback(GtkTextBuffer
*your_text_buffer, gpointer your_data)
{
gint line_count;
Eric, thanks for the ideas!
I tried a bunch of things to distinguish the callbacks, but it got too
complicated. Checking for a different line number is a clever idea, but
PgUp and PgDown also move the cursor which changes the line number.
Similar problems for tracking the char offset in the
Hi Doug,
Try getting the vertical adjustment of the scrolled window and connect to
"value-changed". See if that will work. Something like
...
static void value_changed(GtkAdjustment *v_adjust, gpointer user_data)
{
}
...
GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);