Re: [gedit-list] Auto-closing brackets in selected area



On Thu, 2008-09-04 at 22:41 -0300, Christiano Farina Haesbaert wrote:
> Hello there, this is my first post to the list, so take it easy :P
> 
> I don't know if there is a feature like this in gedit, I've tried to
> find it in some plugin but failed.
> 
> I'll try to explain, suppose I'm there doing some happy coding and I
> want to select some text, be it 
> using ctrl + shit + arrow right or even with the mouse, than I want
> all this selection to be enclosed
> be it in () or in {}, so I press ( and the selected text becomes
> enclosed, like this.
> 
> 1 - I have the text:
> This is a very dummy text.
> 
> 2 - I select all the text with the mouse
> 3 - I press (.
> 4 - The text becomes:
> (This is a very dummy text.)
> 
> Is it possible ? if not I think I will write a plugin to do that.

It is possible, and would have do be done using a plugin. I believe the
bracket matching feature in gedit is provided by gtksourceview. You can
look at that lib's code to see how the matching bracket is found. The
selection is created from the two textiters that are set to the
positions of the brackets. (See GtkTextBuffer and GtkTextView).

If you write the plugin in C, it might be prove useful enough to port
the feature directly to gtksourceview.

-- 

__C U R T I S  C.  H O V E Y_______
Guilty of stealing everything I am.

Attachment: signature.asc
Description: This is a digitally signed message part



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