[Kommander-devel] KTextEditor in Kommander

Eric Laffoon eric at kdewebdev.org
Tue Sep 5 02:09:15 EDT 2006


On Monday 04 September 2006 1:56 pm, Andras Mantia wrote:
> On Sunday 03 September 2006 13:35, Eric Laffoon wrote:
> > So it should be easy not only give a different color for functions,
> > but even for types of functions.
>
> Ok, it's done now. The functions have different color based on which
> group they are (DCOP, Kommander, File, Input, etc.). You can customize
> the colors at the end of kommander.xml:
>       <itemData name="KmdrMethod" defStyleNum="dsKeyword" italic="1"
> color="#008000" />
>       <itemData name="DCOPMethod" defStyleNum="dsKeyword" italic="1"
> color="#21E52B" />
>       <itemData name="KmdrString" defStyleNum="dsKeyword" italic="1"
> color="#D0D000" />
>       <itemData name="KmdrArray" defStyleNum="dsKeyword" italic="1"
> color="#C0C0FF" />
>       <itemData name="KmdrFile" defStyleNum="dsKeyword" italic="1"
> color="#FF0000" />
>       <itemData name="KmdrInput" defStyleNum="dsKeyword" italic="1"
> color="#FF8000" />
>       <itemData name="KmdrMessage" defStyleNum="dsKeyword" italic="1"
> color="#800000" />
>
> KmdrMethod = used for @Command where there is no "." after it or when
> the method name after "." is unknown, like @Foo.bar().
> DCOPMethod = used for DCOP commands, like the "setEnabled" part of
> @Form1.setEnabled()
> KmdrString = used for @String methods
> KmdrArray = for @Array methods
> KmdrFile = for @File methods
> KmdrMessage = for @Message methods
>
> The names of the methods are defined at the beginning of the file, so if
> you introduce new ones, they should be added there, otherwise
> KmdrMethod color and style will be used.

Thanks Andras, this is a big improvement. Unfortunately a few things are not 
handled well yet. At least one may be a real headache but most should be 
easy. I'm sure you're way faster at this than me...

1) functions that don't use method definitions lock highlighting until 
something else comes along...
@dcop()
@global()
@setGlobal()
@exec()
@readSetting()...
These continue highlighting into the parenthesis and beyond.
2) Loop variables (@i) are not handled and I'm not sure how much of a pain 
they are, but if we could at least stop highlighting on a space after 
@unknown that would be good.
3) This function statement seems to confuse quote and parenthesis highlights
@exec(@readSetting(photoviewer, kuickshow) 
"@String.section(@TreeWidget3.selection(),"\t", 0)")
4) Maybe I should apologize for making too much work. ;-) The following is 
utterly trashed...
@if(@String.length(@readSetting(photopath, "")) < 5)
  @exec(kdialog --title "khphoto setup" --msgbox "You will need to set your 
root directory for where your photos are. This only offers this the first 
time it runs, but it helps it to start faster if it doesn't have to search 
your whole home directory.")
  @writeSetting(photopath, @exec(kdialog --getexistingdirectory --title "Photo 
Root?"))
@endif
It appears the period after "are" ends the green function highlighting, but 
the apostrophe in doesn't starts red quote highlighting which overrides 
everything for the remainder of all text.

I'm not sure how difficult it is to get more rational quote handling, but we 
should remove a degree of ugliness still before releasing. This is much 
improved over before but the dialog I chose to look at it in had problems in 
about half the KTs I looked at.
-- 
Eric Laffoon
Project Lead - kdewebdev module


More information about the Kommander-devel mailing list