how to access the editor configuration from the cppsupportpart.cpp

jbb jbb at
Thu Dec 19 20:08:06 UTC 2002

On Fri, 20 Dec 2002 01:29, Roberto Raggi wrote:
> Hi,
> On Thursday 19 December 2002 11:53, Victor Röder wrote:
> > Hi,
> >
> >  > I wouldn't it like if the cppsupportpart knows about all the editors
> >  > and how they can be accessed. It results in a huge switch statement
> >  > for the single editors.
> >  > Better is to extend the KTextEditor interface with a for instance
> >  > putStringInFile(const QString& text, int line, int column) method.
> >  > Then the editor can handle it by itself (or not).
> >
> > Isn't there a insertText ( line, col, text ) method in the KTextEditor
> > interface (EditInterface)?
> yes, but would be nice to have more methods suitable for IDE like kdevelop,
> e.g.
>   void indent( int line );
>   void indentBlock();
>   void markTextAsError( int fromLine, int fromColumn, ... )


Surely when inserting text the editor code should then apply it's rules as if 
you were typing at the keyboard. So \t would becomes spaces and indenting 
would happen automatically (if set). This removes the burden on formatting 
the text from the app and keeps it in the editor (where it currently is 
anyway). Perhaps there could be another method insertRaw so that formatting 
isn't applied as some apps may require that.

Also markTextAsError should really be markText(fromLine, fromColumn, markIcon, 
markHighlight) - or something similiar. That is, the editor doesn't need to 
know _why_ it's marking text, just that it should. This should also be used 
to mark the breakpoints as well. I've never understood why an editor should 
know about breakpoints.

There is more that one way to mark text. With an icon in the icon border or 
the text could be highlighted with a specific colour if there is no icon 
border. Hence the markHighlight parameter would be a QColor (probably?)


More information about the KDevelop-devel mailing list