After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 321252 - Clicking gedit line numbers should jump to line
Clicking gedit line numbers should jump to line
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
: 112686 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-11-11 19:34 UTC by John Spray
Modified: 2006-01-15 11:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.71 KB, patch)
2006-01-14 16:23 UTC, Paolo Borelli
needs-work Details | Review
Patch implementing the behavior I described in my previous comment. Does not implement dragging. (4.49 KB, patch)
2006-01-14 21:39 UTC, Paolo Maggi
none Details | Review
committed patch (4.86 KB, patch)
2006-01-15 11:29 UTC, Paolo Borelli
none Details | Review

Description John Spray 2005-11-11 19:34:02 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.
Comment 1 Paolo Borelli 2005-11-11 20:02:35 UTC
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.
Comment 2 Paolo Borelli 2006-01-14 16:23:55 UTC
Created attachment 57350 [details] [review]
patch

here is the patch to do it :)

[key_press_event renamed for consistency]
Comment 3 Paolo Maggi 2006-01-14 19:09:35 UTC
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.
Comment 4 Paolo Maggi 2006-01-14 19:12:00 UTC
*** Bug 112686 has been marked as a duplicate of this bug. ***
Comment 5 Paolo Maggi 2006-01-14 21:39:04 UTC
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?
Comment 6 Paolo Borelli 2006-01-15 09:56:33 UTC
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.
Comment 7 Jeroen Zwartepoorte 2006-01-15 10:06:16 UTC
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.
Comment 8 Paolo Borelli 2006-01-15 11:29:19 UTC
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.