Re: [gedit-list] Fwd: hiliting words that contain digits and underscores by double clicking

Honestly I don't know if this same method is called for other cases where the word selection may be triggered. I know it was called when GtkTextView capture GDK_2BUTTON_(something, I don't recall). Well, at least now i know that it's not a simple configuration issue. Maybe gsv should capture (somehow, I don't know) this mouse event, and then signal the managing program (gedit, in our case). In case there is no slot registered, it can return it back to gtk so that it can do whatever it is doing right now. But I don't know how it will capture this mouse event or how to hand it back to gtk. Even a proof of concept would be nice, I think.

From: Jesse van den Kieboom <jesse icecrew nl>
To: Jesse van den Kieboom <jesse icecrew nl>
Cc: gedit-list gnome org
Sent: Sunday, November 30, 2008 6:52:08 AM
Subject: Re: [gedit-list] Fwd: hiliting words that contain digits and underscores by double clicking

Op 30 nov 2008, om 12:47 heeft Jesse van den Kieboom het volgende geschreven:

I have investigated it a little bit, and indeed the culprit is  in gtktextview.c file of gtk. The following method:

* Move @start and @end to the boundaries of the selection unit (indicated by
* @granularity) which contained @start initially.
* If the selction unit is SELECT_WORDS and @start is not contained in a word
* the selection is extended to all the white spaces between the end of the
* word preceding @start and the start of the one following.
static void
extend_selection (GtkTextView *text_view,
 SelectionGranularity granularity,



It seems that medit author solved this by messing with the logic here.

Since GtkTextView is a general purpose widget, gsv sounds like the right place. But does GtkTextView provide a hook so that gsv can change the behavior without changing the gtk source?

I think we can yes. I haven't looked at the source, but it seems to me that we could act in an appropriate way to the mouse event in either gsv, or in a gedit plugin as a proof of concept. It should be possible to handle the word selection ourselves, though I'm not sure if there might be any nasty side effects (cases where we might disable some other behavior because we cannot detect whether a word selection is triggered by the mouse event, or something else).


--- On Sat, 11/29/08, Jesse van den Kieboom <jesse icecrew nl> wrote:
From: Jesse van den Kieboom <jesse icecrew nl>
Subject: Re: [gedit-list] hiliting words that contain digits and underscores by double clicking
To: "Doug McNutt" <douglist macnauchtan com>
Cc: gedit-list gnome org
Date: Saturday, November 29, 2008, 5:16 PM

This is also something I want to see implemented/changed. There are
several options here. Either we change 'fix'/change it in gsv and make
it a permanent fix, or we can set a string property on gsv setting the
characters which are considered to be word characters. Another option
might be to use triple click to expand further including characters
currently not considered to be word characters (like _), and do
quadruple click for line selection. There could even be an option in
gedit setting which characters are considered word characters.

As an intermediate solution, this could be implemented as a plugin, but
in the end I think it belongs in gsv.


Op zaterdag 29-11-2008 om 09:55 uur [tijdzone -0700], schreef Doug
At 05:35 -0800 11/29/08, Jason Walker wrote:
How can I change the behavior of gedit so that when i double click on
a C/C++ identifier, the whole identifier is selected, not just part
of it. For instance, if I double-click on _t|his_is_my_identifier
where | represents my mouse pointer's approximate position, only
"this" is selected. What should I modify to change this?

Date: Fri, 16 Nov 2007 09:55:41 -0200
Subject: [gedit-list] selecting whole words when variables

That posting generated some comparisons to the way terminal behaves.
The general conclusion of the resulting thread was that the operation
is performed not in gedit but by the underlying text methods of GTk.

What's really needed is a variable, set  for each document , that is
a list of the characters that may comprise a word.  $, &nbsp;, -, _,
[0-9], / ,. , and some more need to be included for different
languages. Unicode could make the whole thing non-trivial. The usual
technique is to step backwards until finding a non-word character and
then forward for another.

Auto license plate numbers are my current frustration.

Jesse van den Kieboom


gedit-list mailing list
gedit-list gnome org

gedit-list mailing list
gedit-list gnome org

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