GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 25, 2016 7:55 am

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Complicated - TextView/Buffer
PostPosted: Mon Mar 03, 2008 5:37 pm 
Familiar Face

Joined: Mon Feb 11, 2008 12:28 pm
Posts: 15
Hey everyone.

I have a text view which displays the contents of a file.
When i select/highlight some text, i use the get_selection_bounds() function to get the selected text and then i display the selection in another text view.

what i want to do now is to check wether the selection has characters on either side (i.e is it part of a word?)

for example:
"Hello world"

if "or" is selected, there are characters on either side. any ideas on how to
find this?

here is my code to find the boundary of selected text and store it:

gtk_text_buffer_get_selection_bounds (widget->buffer1, &start, &end);   
selected = gtk_text_buffer_get_text (widget->buffer1, &start, &end, FALSE);

 Post subject:
PostPosted: Wed Mar 19, 2008 8:56 am 
GTK+ Guru

Joined: Tue Feb 05, 2008 8:39 am
Posts: 130
GtkTextIter i0, i1;

if (gtk_text_iter_starts_word(&i0) && gtk_text_iter_ends_word(&i1))
  // it's not a part

or similar methods

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group