title: Detect cursor movement in GTK text buffer
body: <p>I am working on a GTK+ editor in C. I have added a feature of displaying the current line number and column number of the cursor position in the textview. Its working well. But the drawback is when I attempt to move the cursor with the arrow keys the line number and column number do not get updated. Below is my code for updating the line number and column number</p>
  
  <pre><code>    update_statusbar(GtkTextBuffer *buffer,GtkStatusbar  *statusbar)
  {
    gchar *msg;
    gint row, col;
    GtkTextIter iter;
  
    gtk_statusbar_pop(statusbar, 0); 
    g_print("c");
    gtk_text_buffer_get_iter_at_mark(buffer,
        &amp;iter, gtk_text_buffer_get_insert(buffer));
  
    row = gtk_text_iter_get_line(&amp;iter);
    col = gtk_text_iter_get_line_offset(&amp;iter);
  
    msg = g_strdup_printf("Col %d Ln %d", col+1, row+1);
  
    gtk_statusbar_push(statusbar, 0, msg);
  
    g_free(msg);
  }
  
  int main ( int argc, char *argv[])
  {
  .
  .
  .
  .
  .
  .
    g_signal_connect(buffer, "changed", G_CALLBACK(update_statusbar), statusbar);
    update_statusbar(buffer, GTK_STATUSBAR (statusbar));
  
  }
  </code></pre>
  
  <p>I guess the problem is with "changed" signal. Since the cursor is moved with arrow keys, buffer doesn't get changed. So can anyone suggest me a better way to solve the problem .</p>
  
  <p>Thanks in advance :).</p>