Last modified: 2014-11-17 11:48:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56961, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54961 - Added "search and replace within selection" functionality
Added "search and replace within selection" functionality
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
WikiEditor (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 63665
  Show dependency treegraph
 
Reported: 2013-10-04 09:36 UTC by kim
Modified: 2014-11-17 11:48 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
screenshot of functionality (48.74 KB, image/png)
2013-10-04 09:36 UTC, kim
Details

Description kim 2013-10-04 09:36:46 UTC
Created attachment 13437 [details]
screenshot of functionality

https://gerrit.wikimedia.org/r/#/c/87322/

This enables users to first select some text in the textarea, and
click the checkbox labeled "Search/replace within text selection"
when searching / replacing text.
When this checkbox is checked, the text searched/replaced will a subset
of the original text determined by the user's text selection.
Comment 1 TMg 2013-10-07 17:36:08 UTC
Don't get me wrong: I like the feature. But I think the checkbox is odd.

What happens if nothing is selected? The checkbox must be hidden or at least disabled (grayed out). I guess nothing is selected 99% of the time and therefor the checkbox is useless 99% of the time.

What happens if I click "Find next" and then decide to enable the "within selection" checkbox? "Find next" changes the selection.

As I said I have a similar feature in my [[dewiki:User:TMg/autoFormatter]]: If something is selected it uses the selection. If nothing is selected it uses the full textarea. From what I heard from my users this works as expected.

A simple way to make this visible to the user is to change the title of the popup from "Search and replace" to "Search and replace in selection". Maybe change the button from "Replace all" to "Replace all in selection".

Related:
* Bug 40797 (duplicate, but I'm not sure which one to close)
* Bug 23942 (can't have "search and replace" and "insert internal link brackets without showing a popup" buttons the same time)
* Bug 23992 ("search and replace" broken in Opera 12)
Comment 2 kim 2013-10-08 06:01:12 UTC
(In reply to comment #1)
> Don't get me wrong: I like the feature. But I think the checkbox is odd.
> 
> What happens if nothing is selected? The checkbox must be hidden or at least
> disabled (grayed out). I guess nothing is selected 99% of the time and
> therefor
> the checkbox is useless 99% of the time.
> 
> What happens if I click "Find next" and then decide to enable the "within
> selection" checkbox? "Find next" changes the selection.

This works as expected as i only fetch the selection upon opening the dialog, changes to the selection when the dialog is open does not have any effect.

> 
> As I said I have a similar feature in my [[dewiki:User:TMg/autoFormatter]]:
> If
> something is selected it uses the selection. If nothing is selected it uses
> the
> full textarea. From what I heard from my users this works as expected.
> 
> A simple way to make this visible to the user is to change the title of the
> popup from "Search and replace" to "Search and replace in selection". Maybe
> change the button from "Replace all" to "Replace all in selection".
> 
> Related:
> * Bug 40797 (duplicate, but I'm not sure which one to close)
> * Bug 23942 (can't have "search and replace" and "insert internal link
> brackets
> without showing a popup" buttons the same time)
> * Bug 23992 ("search and replace" broken in Opera 12)

As your request, i removed the checkbox and added a new title to the dialog if
there is a selection of thext when clicking on the search and replace functionality.

Did however not change any button texts, as this seems to cause very long button names, where the dialog is quite small. And it strictly isn't necessary when this is shown in the title.
Comment 3 TMg 2013-10-08 15:32:19 UTC
(In reply to comment #2)
> i only fetch the selection upon opening the dialog

My question is: Isn't this confusing? I can see that the selection changes in the background. When I close the dialog the changed selection stays changed. My original selection is gone. This makes it look like the function behaves different when I close and reopen the dialog and when I keep it open. Same selection seen in the background but different behavior.

Please do the following test:

* Paste the text "12-12-12" in the textarea.
* Select the first "12-12-".
* Search for "12" and replace it with "3".
* Hit "Find next" and "Replace". Should become "3-12-12".
* Repeat. Should become "3-3-12".
* Repeat. Should stay (!) "3-3-12".

Same test with "Replace all".
Comment 4 kim 2013-10-11 05:47:08 UTC
Well, i did your test. and it works fine.

* I pasted 12-12-12 in the texarea
* I selected the first 12-12
* I searched for 12 and replaced with 3.
* I hit find next and replace, causing it to change to 3-12-12
* I hit find next and replace, causing it to change to 3-3-12
* I hit find next and replace, causing it to give me the messsage: "no more occurences found"
* I then reset the textbox and did the same with replace all, which gave the result 3-3-12

Feel free to test it out yourself
Comment 5 kim 2013-10-11 05:49:58 UTC
I dont reckon this as confusing, i mean if your doing a find operation, then you need to set a new selection for the found text occurrence. But i dont think this functionality was designed specifically for the find functionality. more for the replace functionality.
Comment 6 Gerrit Notification Bot 2014-11-17 11:48:04 UTC
Change 87322 had a related patch set uploaded by Paladox:
Added "search and replace within selection" functionality

https://gerrit.wikimedia.org/r/87322

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links