RESOLVED FIXED 138198
Web Inspector: TextEditor search doesn't work after editing contents
https://bugs.webkit.org/show_bug.cgi?id=138198
Summary Web Inspector: TextEditor search doesn't work after editing contents
Joseph Pecoraro
Reported 2014-10-29 16:57:59 PDT
* SUMMARY TextEditor search doesn't work after editing a file. Stops early. Wrong number of results. * STEPS TO REPRODUCE 1. Inspect <http://bogojoker.com/shell/> 2. Select Stylesheet Resource "print.css" 3. Search for "font" => 10 results 4. Add a blank link at line 29 5. Clear search, and search for "font" again => 8 results stopping the count at the edit, expected 10 results. * NOTES SourceCodeTextEditor is using its backend search instead of frontend (CodeMirror) search when the editor has edits.
Attachments
[PATCH] Proposed Fix (2.57 KB, patch)
2014-10-29 17:03 PDT, Joseph Pecoraro
timothy: review+
timothy: commit-queue-
[PATCH] Proposed Fix (2.22 KB, patch)
2014-11-03 14:43 PST, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2014-10-29 16:58:11 PDT
Joseph Pecoraro
Comment 2 2014-10-29 17:03:12 PDT
Created attachment 240638 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 3 2014-10-29 17:04:24 PDT
Heck if we want maybe we should always have CodeMirror perform searching inside of TextEditor. is there a reason we might not want that?
Timothy Hatcher
Comment 4 2014-11-03 11:29:51 PST
Comment on attachment 240638 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=240638&action=review > Source/WebInspectorUI/UserInterface/Views/TextEditor.js:232 > + get hasEdits() This is something I would make a function. The rule I follow: if it is a question or action, it is a function. Otherwise, a property. > Source/WebInspectorUI/UserInterface/Views/TextEditor.js:241 > + var undoableChanges = this._codeMirror.historySize().undo; > + if (!undoableChanges) > + return false; > + if (undoableChanges > 1) > + return true; > + > + // Don't claim that we have edits if we have only one change which was pretty-printing. > + return !this._formatted; I wonder if we should use this._codeMirror.isClean() here? Does it give the right result? Maybe we need some well placed markClean() calls to make that work though. (We do a markClean in TextEditor.set string().)
Joseph Pecoraro
Comment 5 2014-11-03 11:54:50 PST
Comment on attachment 240638 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=240638&action=review >> Source/WebInspectorUI/UserInterface/Views/TextEditor.js:232 >> + get hasEdits() > > This is something I would make a function. The rule I follow: if it is a question or action, it is a function. Otherwise, a property. Agreed, I'll make the change. >> Source/WebInspectorUI/UserInterface/Views/TextEditor.js:241 >> + return !this._formatted; > > I wonder if we should use this._codeMirror.isClean() here? Does it give the right result? Maybe we need some well placed markClean() calls to make that work though. (We do a markClean in TextEditor.set string().) Oh nice, I had forgotten about that. That would certainly be more convenient. I'll give that a try.
Joseph Pecoraro
Comment 6 2014-11-03 14:43:04 PST
Created attachment 240877 [details] [PATCH] Proposed Fix
Timothy Hatcher
Comment 7 2014-11-03 14:50:13 PST
Comment on attachment 240877 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=240877&action=review > Source/WebInspectorUI/UserInterface/Views/TextEditor.js:818 > + return !this._codeMirror.isClean(); The previous patch accounted for pretty-printing, does that still need to happen?
Joseph Pecoraro
Comment 8 2014-11-03 16:26:34 PST
Comment on attachment 240877 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=240877&action=review >> Source/WebInspectorUI/UserInterface/Views/TextEditor.js:818 >> + return !this._codeMirror.isClean(); > > The previous patch accounted for pretty-printing, does that still need to happen? Turns out we already don't use the customPerformSearch if the content is formatted. Right now, hasEdits() returns false if the editor has been pretty printed. I think that is fine unless we want to tweak that later.
WebKit Commit Bot
Comment 9 2014-11-03 17:03:37 PST
Comment on attachment 240877 [details] [PATCH] Proposed Fix Clearing flags on attachment: 240877 Committed r175497: <http://trac.webkit.org/changeset/175497>
WebKit Commit Bot
Comment 10 2014-11-03 17:03:42 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.