proposal for extension of KTextEditor interface

F@lk Brettschneider falk.brettschneider at gmx.de
Sun Jan 12 00:03:04 UTC 2003


Joseph Wenninger wrote:

>Hi
>
>Am Don, 2003-01-09 um 21.23 schrieb F at lk Brettschneider:
>  
>
>>Eray Ozkural wrote:
>>
>>    
>>
>>>On Wednesday 08 January 2003 12:41 am, F at lk Brettschneider wrote:
>>> 
>>>
>>>      
>>>
>>>>What do you mean with "scale up"?
>>>>I can suppose jowenn is now working on the KTextEditor extension (as
>>>>promised ;). Probably I'm going to try the implementation for QEditor...
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>Is it going to be efficient in large projects?
>>>
>>>      
>>>
>>Speed would just depend on the speed of the debugger part to return the 
>>local variable value and on the effeciency of the programming language 
>>parser to analyze the dump text returned from the text editor.
>>But it should be OK since tooltips have a slow response in general (1 
>>second or similar)...
>>
>>Jowenn, what is the news!?
>>
>>    
>>
>
>I'm experimenting a littlebit at the moment, but don't have much time at
>the moment. I'll be committing my stuff into kdelibs at the begin of the
>next week though. At the moment I'm believing that an interface like the
>following should be enough
>methods:
>	void enableUserTextHints(int timeoutTime);
>	void disableUserTextHints(); //that's the default state
>signals:
>	void needTextHint(int line, int col, QString &text);
>		/*should only be emitted if line and col really changed (not inner
>cell moves) when a timeout has happened.
>
Sound good.

>The slot
>
Which slot? Do we miss a 4th interface method? How can we set the text 
for the tooltip?

> sets the text property and if it is not an emtpy string the
>text editor displays it next/above/below the textcell.
>
What is with Roberto's 5th interface method:  (void setWordValidator( 
const QValidator* wordValidator ))? To reduce the number of emitted 
signals out of the texteditor. If the validator is something like:

class CppExpressionsValidator: public QValidator{
...
    virtual State validate ( QString & input, int & pos ) const {
         Context* ctx = computeContextFromCursorPosition( cursorPosition );
         if( ctx->containsVariable( input ) ) 
            return Acceptable;
         ....
    }
}

signals for tooltips in .cpp files were just emitted for things that make sense.


After reviewing the Microsoft Visual C++ debugger I saw that normal text tooltips show the variable values, but addionally, tooltips on selected text are able to show the value of the selected expression! 
Please, can you consider tooltips for selected text in the KTextEditor-Interface too!?!?
The editor just must check if the mouse is over selected or unselected text. In case of unselected text it must use the validator suggested by Roberto (see above), in case of selected text it must emit a signal with the selected text that KDevelop tries to resolve as an expression (e.g. '(d->x * d->y) / 45' ) and send the resolved result as tooltip for the editor.


Cheers
F at lk






More information about the KDevelop-devel mailing list