GNOME Bugzilla – Bug 321252
Clicking gedit line numbers should jump to line
Last modified: 2006-01-15 11:30:40 UTC
When line numbers are shown, they don't do anything when clicked. They might as well move the cursor to the beginning of the line when they are clicked - this would provide a much more conveniently large clicking target for this operation.
I agree with this, I also think double click showld select the whole line. It belongs to gtksourceview though. Paolo (Maggi), are you ok with it? Patch should be easy to do if the behavior is agreed on.
Created attachment 57350 [details] [review] patch here is the patch to do it :) [key_press_event renamed for consistency]
Comment on attachment 57350 [details] [review] patch I have given a look at eclipse. If you click on the on line number it selects the entire line. Clicking and dragging you can select multiple lines. I'd suggest: - single click -> jump to the line - double click -> select the line - single click + Ctrl -> select the line - single click + Shift -> extended current selection to the beginning of the clicked line - single click + Shift + Ctrl -> extended current selection to the end of the clicked line We can implement click and drag in a second step. >+ >+ gtk_text_buffer_place_cursor (buf, &line_start); >+ >+ return TRUE; May be it should be FALSE.
*** Bug 112686 has been marked as a duplicate of this bug. ***
Created attachment 57367 [details] [review] Patch implementing the behavior I described in my previous comment. Does not implement dragging. pbor: could you please review my patch? What do you think?
Looks good to me. Some minor comments: > +static void > +extend_selection I'd rename the function to extend_selection_to_line, extend_selection is a bit too generic > + if ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == > + (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) can't you simply do if ((event->state & GDK_CONTROL_MASK & GDK_SHIFT_MASK) != 0) > + return TRUE; you can place it out of the 'if' so that we have just one 'return TRUE'. And yes, TRUE is more correct IMHO, since we are not chaining up in that case.
Some minor comments from me: + buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); Why not GTK_TEXT_BUFFER (view->source_buffer) instead. Saves you a method call. How does the button_press_event code work with line markers? Don't we show 2 columns in the left margin? (line numbers + markers) In the folding branch of gtksourceview i explicitly check if the cursor is in the "fold" column.
Created attachment 57398 [details] [review] committed patch the patch that was committed. After testing we decided that it's better to always extend the selection to include the clicked line on shift+click, dropping the ctrl+shift case. This patch also fixes ctrl+click on an empty line to not select line+1.