EditorProxy

Harald Fernengel harry at kdevelop.org
Sun Jan 26 15:48:05 UTC 2003


Hi,

On Friday 24 January 2003 02:26, Milo Hoffman wrote:
> Hi all,
> EditorProxy::setLineNumber is currently defined as:
>     void setLineNumber(KParts::Part* part, int lineNum);
> and calls to
>     KTextEditor::ViewCursorInterface::setCursorPosition(lineNum, 0);
>
> KTextEditor::ViewCursorInterface::setCursorPosition defines both of it's
> parameters as unsinged int.
>
> As i saw from a recent crash in qEditor, EditorProxy::setLineNumber is
> sometimes called with -1 as lineNum. What should be the correct behaviour
> of the editor in this case? Goto last line? Goto first line? Or has -1 even
> any special meaning in this case? (Actual behaviour seems to be going to
> the first line)
>
> The -1 comes from
>   PartController::editDocument(const KURL& inputUrl, int lineNum=-1)
> which is the only function calling setLineNumber.
>
> Shouldn't this parameters all be changed to unsigned for consistency?

I don't know what the original intention was, but I believe that "-1" means 
"show the document but don't set the line number at all". In case the 
document is already opened, it will just jump there and leave the cursor 
position.

I added a check in editorproxy.cpp, I hope the behaviour is correct now.

Best regards,
Harry




More information about the KDevelop-devel mailing list