StyledTextCtrl syntax highlighting

I am working on the StyledTextCtrl.
and I want to highlight only the word not a single character.
below code is for single character, by the way, Is there other way to
get word from start_pos to end_pos ?

code : http://paste.pound-python.org/show/10393/

screenshot : http://ompldr.org/vOXBsOQ

Wonjun, Choi

Hi,

I am working on the StyledTextCtrl.
and I want to highlight only the word not a single character.
below code is for single character, by the way, Is there other way to
get word from start_pos to end_pos ?

code : Paste #10393 at spacepaste

screenshot : http://ompldr.org/vOXBsOQ

Hmm, that code looks familiar :wink:

Do you understand what this line is doing?

self.vowels = [ord(char) for char in "good" + "bad"]

Its make a list of ordinal values for the characters 'goodbad' and the
style needed method is only checking a single character at a time so
it will only highlight the characters in that list.

If you want to highlight the words you need to look a the whole run of
characters in the word as a whole and apply the style to it.

Suggest reading the documentation at scintilla.org for some more
samples of how to work with this interface.

Cody

···

On Mon, Aug 1, 2011 at 8:22 PM, Wonjun, Choi <wonjunchoi001@gmail.com> wrote:

I see. and do you mind if I ask this issue to you later?

Wonjun, Choi

···

2011/8/2 Cody Precord codyprecord@gmail.com

Hi,

On Mon, Aug 1, 2011 at 8:22 PM, Wonjun, Choi wonjunchoi001@gmail.com wrote:

I am working on the StyledTextCtrl.

and I want to highlight only the word not a single character.

below code is for single character, by the way, Is there other way to

get word from start_pos to end_pos ?

code : http://paste.pound-python.org/show/10393/

screenshot : http://ompldr.org/vOXBsOQ

Hmm, that code looks familiar :wink:

Do you understand what this line is doing?

self.vowels = [ord(char) for char in “good” + “bad”]

Its make a list of ordinal values for the characters ‘goodbad’ and the

style needed method is only checking a single character at a time so

it will only highlight the characters in that list.

If you want to highlight the words you need to look a the whole run of

characters in the word as a whole and apply the style to it.

Suggest reading the documentation at scintilla.org for some more

samples of how to work with this interface.

Cody

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en