Bug 90677

Summary: Web Inspector: start searching from the cursor position in the Sources panel.
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web Inspector (Deprecated)Assignee: Pavel Feldman <pfeldman>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch vsevik: review+

Description Pavel Feldman 2012-07-06 05:39:07 PDT
Patch to follow.
Comment 1 Pavel Feldman 2012-07-06 05:41:00 PDT
Created attachment 151066 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-07-06 05:46:30 PDT
Comment on attachment 151066 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=151066&action=review

> Source/WebCore/inspector/front-end/TextEditorModel.js:120
> +        if (this.startLine > other.startLine)

A common approach to such comparators is along the lines of:

if (this.startLine === other.startLine)
    return this.startColumn - other.startColumn;
return this.startLine - other.startLine;

(oftentimes it is not normalized to sgn(result), since only the relation to 0 is important)

I understand that you are fighting for the verbosity in this case, though.
Comment 3 Vsevolod Vlasov 2012-07-06 05:58:58 PDT
Comment on attachment 151066 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=151066&action=review

> Source/WebCore/inspector/front-end/TextEditor.js:398
> +    lastSelection: function(textRange)

Please remove parameter and jsdoc.

> Source/WebCore/inspector/front-end/TextEditor.js:427
> +            return;

We might want to set (non empty) selection for other external actions (e.g. for Search across all files).
Consider moving the code responsible for turning selection into a cursor position to the blur event handler instead.
Comment 4 Pavel Feldman 2012-07-06 06:06:23 PDT
> Please remove parameter and jsdoc.

Removed from the code, jsdoc has it for a reason.

> 
> > Source/WebCore/inspector/front-end/TextEditor.js:427
> > +            return;
> 
> We might want to set (non empty) selection for other external actions (e.g. for Search across all files).
> Consider moving the code responsible for turning selection into a cursor position to the blur event handler instead.

I am not sure I follow.
Comment 5 Pavel Feldman 2012-07-06 06:08:58 PDT
Committed r121957: <http://trac.webkit.org/changeset/121957>