Bug 90677 - Web Inspector: start searching from the cursor position in the Sources panel.
Summary: Web Inspector: start searching from the cursor position in the Sources panel.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Pavel Feldman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-06 05:39 PDT by Pavel Feldman
Modified: 2012-07-06 06:08 PDT (History)
10 users (show)

See Also:


Attachments
Patch (5.15 KB, patch)
2012-07-06 05:41 PDT, Pavel Feldman
vsevik: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>