Note: There are a few cases of duplicates in user autocompletion which are being worked on.

about:config enhancement - filtering/searching preferences

VERIFIED FIXED

Status

SeaMonkey
Preferences
--
enhancement
VERIFIED FIXED
14 years ago
11 years ago

People

(Reporter: Tim, Assigned: neil@parkwaycc.co.uk)

Tracking

({fixed1.4.1})

Trunk
fixed1.4.1
Dependency tree / graph
Bug Flags:
blocking1.4.1 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 4 obsolete attachments)

(Reporter)

Description

14 years ago
Here's my current work at allowing some form of "searching" preferences.  The
patch implements searching on the name as a regular expression.  The patch is
also cluttered with various bits of refactoring. Hopefully, I commented
reasonably after myself.

I have not thoroughly tested this patch, though it works for the first couple of
things I tried.

The patch is not ready for prime-time for a couple of reasons: it still needs to
allow Enter to handle either changing the search text or modify the selected
pref, and the one literal I added to config.xul needs to be extracted into
another file. There are probably also places that could use some performance
analysis (honestly, I think there are few enough preferences and the page is
used infrequently enough that speed/readability tradeoffs should side towards
readability).

Patch + readme coming up.
(Reporter)

Comment 1

14 years ago
Created attachment 124664 [details] [diff] [review]
about:config filtering patch v1

This applies to both mozilla and firebird, source or unpacked chrome.

Apply in:
  source: mozilla/xpfe/global/resources/content/
  chrome: toolkit.jar, content/global/

Patch command:
  patch -p1 < toolkit.patch
(Reporter)

Comment 2

14 years ago
Created attachment 124665 [details]
Screenshot of patched firebird

A screenshot for those who want to see what it does without bothering with the
patch.
(Reporter)

Comment 3

14 years ago
Oh yeah, and I have to fix my brace/parenthesis style, I suppose. (reminder to
myself or whoever else wants to take up the cause).
(Reporter)

Updated

14 years ago
Status: NEW → ASSIGNED

Comment 4

14 years ago
This should be a dupe of bug 103911, but since you've already attached a patch
to this one ... But they're still different : Ctrl-F versus a textbox (what do
you call that ?). Can you manage to implement a find-dialog too ? Or do we leave
it like it is now, and dupe 103911 against this one ?

Updated

14 years ago
Blocks: 103911
(Reporter)

Comment 5

14 years ago
I consider this to be fairly different from find-in-page, primarily because this
doesn't even begin to make find-in-page work.  I figure we can leave that bug
open because it would seemingly be nice even with this type of feature.

I mainly wrote this the way I did because I wanted to be able to focus on a
subset of prefs without rewriting about:config to accept find-in-page.
(Reporter)

Comment 6

14 years ago
I should note that right now, the patch only searches the pref name--not any
other fields.  It would be trivial to make it search other fields, but name is
sufficient for me, and people would probably want the ability to only search
certain fields (I leave that functionality for someone else to write).  The
matching function is View.objMatchFunc and it is set in the View.searchRE setter
function.

Also, in the firebird spirit, it should at least search the most sane set of
fields by default.
(Assignee)

Comment 7

14 years ago
Created attachment 124715 [details] [diff] [review]
Alternative patch
(Assignee)

Comment 8

14 years ago
Comment on attachment 124715 [details] [diff] [review]
Alternative patch

>+  <textbox id="textbox" flex="1" type="timed" timeout="500" oncommand="FilterPrefs();"/>
Doh! I forgot that textboxes still have that silly callback attribute instead
of something sensible - please change oncommand to callback for testing.
(Reporter)

Comment 9

14 years ago
Comment on attachment 124715 [details] [diff] [review]
Alternative patch

>Index: content/config.js
[snip]
>@@ -185,12 +221,16 @@
[snip]
>       if (gSortedColumn == "lockCol" || gSortedColumn == "valueCol")
>         gFastIndex = 1; // TODO: reinsert and invalidate range
>-    } else {
>+    } else if (index == gFastIndex) {
>       fetchPref(prefName, index);
>       if (index == gFastIndex) {
>         // Keep the array sorted by reinserting the pref object
else if -> else

Also, don't forget to change all /capability/ to /^capability/ (as discussed on
IRC).
(Reporter)

Updated

14 years ago
Attachment #124664 - Attachment is obsolete: true
(Assignee)

Comment 10

14 years ago
Created attachment 124800 [details] [diff] [review]
Revised patch
Attachment #124665 - Attachment is obsolete: true
Attachment #124715 - Attachment is obsolete: true
(Assignee)

Updated

14 years ago
Attachment #124800 - Flags: superreview?(sspitzer)
Attachment #124800 - Flags: review?(caillon)
(Reporter)

Comment 11

14 years ago
Neil is handling this.
Assignee: riceman+bmo → neil.parkwaycc.co.uk
Status: ASSIGNED → NEW
(Reporter)

Comment 12

14 years ago
Comment on attachment 124800 [details] [diff] [review]
Revised patch

Also, can we get this in the on branch?
Attachment #124800 - Flags: approval1.4?

Comment 13

14 years ago
Uselessly seconding the request for branch...

Comment 14

14 years ago
Comment on attachment 124800 [details] [diff] [review]
Revised patch

unsetting approval request since this doesn't yet have sufficient reviews.
Attachment #124800 - Flags: approval1.4?
(Assignee)

Comment 15

14 years ago
Comment on attachment 124800 [details] [diff] [review]
Revised patch

Sigh, bitrotted again; well unbitrotted really: you'll need to change
callback="..." back to oncomand="..." :-)
(Reporter)

Comment 16

14 years ago
Created attachment 125317 [details] [diff] [review]
Un-bitrotted revised patch

s/callback/oncommand/; Untested by me.
Attachment #124800 - Attachment is obsolete: true
Comment on attachment 125317 [details] [diff] [review]
Un-bitrotted revised patch

>Index: content/config.js

> var gPrefHash = {};
> var gPrefArray = [];
>+var gPrefView = gPrefArray;

Just make this |var gPrefView = [];|


>-    if (/capability/.test(prefName)) // avoid displaying "private" preferences
>+    if (/^capability/.test(prefName)) // avoid displaying "private" preferences
>       return;

Should this be checking simply "capability" ?  Or would it be better to check
"capability."?	Same below.



>@@ -307,6 +345,34 @@
>   document.getElementById("configTree").view = null;
> }
> 
>+function FilterPrefs()
>+{
>+  var substring = document.getElementById("textbox").value.toString();
>+  var prefCol = view.selection.currentIndex < 0 ? null : gPrefView[view.selection.currentIndex].prefCol;
>+  var array = gPrefView;
>+  gPrefView = gPrefArray;
>+  if (substring) {
>+    gPrefView = [];
>+    for (var i = 0; i < gPrefArray.length; i++)

A few lines up, you use ++i.  Do the same here.


>@@ -400,10 +466,15 @@
>   }
> }
> 
>-function gotoPref(prefCol) {
>-  var index = getIndexOfPref(gPrefHash[prefCol]);
>-  view.selection.select(index);
>-  view.treebox.ensureRowIsVisible(index);
>+function gotoPref(pref) {
>+  var index = pref in gPrefHash ? getViewIndexOfPref(gPrefHash[pref]) : -1;
>+  if (index >= 0) {
>+    view.selection.select(index);
>+    view.treebox.ensureRowIsVisible(index);
>+  } else {
>+    view.selection.clearSelection();
>+    view.selection.currentIndex = -1;
>+  }


Just personal taste perhaps, but I think I prefer:

  if (typeof gPrefHash[pref] == "number" && gPrefHash[pref] >= 0) {
    ...select(gPrefHash[pref]);
    ...ensureRowIsVisible(gPrefHash[pref]);
  } else {
    ...clearSelection();
    ...curentIndex = -1;
  }

Feel free to ignore the last one, though I think it makes things more readable.

r=caillon with the comments addressed.
Attachment #125317 - Flags: review+
Attachment #124800 - Flags: review?(caillon)
Comment on attachment 124800 [details] [diff] [review]
Revised patch

clearing sr request, since this patch is obsolete
Attachment #124800 - Flags: superreview?(sspitzer)
(Assignee)

Comment 19

14 years ago
Created attachment 125585 [details] [diff] [review]
Addressed caillon's comments
Attachment #125317 - Attachment is obsolete: true
(Assignee)

Comment 20

14 years ago
Comment on attachment 125585 [details] [diff] [review]
Addressed caillon's comments

Transferring caillon's review as per irc request
Attachment #125585 - Flags: superreview?(sspitzer)
Attachment #125585 - Flags: review+
Comment on attachment 125317 [details] [diff] [review]
Un-bitrotted revised patch

sorry for the delay.

sr=sspitzer for the trunk, as you have r=caillon.

I've seen some requests for the 1.4 branch, but this is not appropriate for the
branch.
Attachment #125317 - Attachment is obsolete: false
Attachment #125317 - Flags: superreview+
(Assignee)

Comment 22

14 years ago
Fix checked in.
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 23

14 years ago
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030615 Mozilla
Firebird/0.6

Doesn't filter when I type something.

Comment 24

14 years ago
If someone can confirm that this works in Mozilla, perhaps someone can file a
Phoenix bug?

Filtering not working on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.4b) Gecko/20030614 Mozilla Firebird/0.6
(Reporter)

Comment 25

14 years ago
Verified in Mozilla trunk nightly 2003061505. Please open another bug for
firebird support. You can probably focus your attention on the notification part
in config.xul (currently, oncommand is used; it's possible that firebird still
wants callback).
Status: RESOLVED → VERIFIED

Comment 26

14 years ago
FYI, Firebird support is bug 209503
Attachment #125585 - Flags: superreview?(sspitzer)

Comment 27

14 years ago
Could this be added to the 1.4 branch as well? Not going to request approval on
someone else's patch, but I think it would be nice to have...

Comment 28

14 years ago
Comment on attachment 125317 [details] [diff] [review]
Un-bitrotted revised patch

Well, since Neil emailed me saying that he was up for it, requesting approval
for 1.4.x

Since 1.4 is the next stable long-lived branch, adding a very useful
enhancement like this that's proven its worth on the trunk seems like a good
idea to me.
Attachment #125317 - Flags: approval1.4.x?

Comment 29

14 years ago
Comment on attachment 125317 [details] [diff] [review]
Un-bitrotted revised patch

a=mkaply

I like this one.

Please make sure it works properly on the branch before checkin.
Attachment #125317 - Flags: approval1.4.x? → approval1.4.x+

Comment 30

14 years ago
please add fixed1.4.1 keyword when this is checked in.
Flags: blocking1.4.x+
(Assignee)

Comment 31

14 years ago
OK, so who's got a branch tree?
(Reporter)

Comment 32

14 years ago
I just tested it, and it works on latest 1.4.x branch. I tested attachment 125585 [details] [diff] [review].

Updated

14 years ago
Keywords: fixed1.4.1

Comment 33

14 years ago
Sorry guys, but I need a different change on the branch for this.

Can we hardcode the English so we don't affect a DTD file?

We want 1.4 localization packs to be compatible for 1.4.1.
(Reporter)

Comment 34

14 years ago
mkaply: would you be amenable to switching Clear All and Filter: to the
following (respectively)?
xpfe/components/console/resources/locale/en-US/console.dtd:<!ENTITY clear.label
    "Clear">
xpfe/components/search/resources/locale/en-US/find.dtd:<!ENTITY
search.button.label         "Search">

These DTDs appear to be in the default installation.  Or would you prefer simply
switching to hard-coded English?
(Reporter)

Comment 35

14 years ago
Created attachment 129393 [details] [diff] [review]
Hard-coded english version

This patch reverses the DTD changes from attachment 125585 [details] [diff] [review] and hard-codes the
English in the XUL. I'm putting this up first because it requires the least
work =). I won't do the DTD-using patch unless mkaply decides that's a better
solution.

Updated

14 years ago
Blocks: 224532

Comment 36

14 years ago
*** Bug 103911 has been marked as a duplicate of this bug. ***
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.