Community Wishlist Survey 2022/Wikisource/Fix search and replace in the Page namespace editor
Fix search and replace in the Page namespace editor
- Problem: Like every year, we're begging to fix this bug, that it's ridicously still present. The search and replace function in the default editor is broken, and it's a basic function of every editor.
- Proposed solution: Fix the underlying issues in the JS API leading to the search and replace function being broken. Alternatively, remove the search&replace button and replace function as a independent widget.
- Who would benefit: All Wikisource users
- More comments: Former submissions:
- Phabricator tickets: phab:T183950
- Proposer: Ruthven (msg) 16:32, 11 January 2022 (UTC)
Discussion
I strongly support this proposal. Fixing known bugs should be alwais prioritized. --Alex brollo (talk) 14:11, 18 January 2022 (UTC)
- Well, in fact fixing known bugs should be a routine, not a subject of annual pleading. --Jan Kameníček (talk) 00:33, 29 January 2022 (UTC)
- Totally agree... — ElioPrrl (talk) 11:06, 29 January 2022 (UTC)
According to T183950, the problem here is that PRP's Page: content model breaks assumptions other parts of Mediawiki make regarding the data of a wikipage. Specifically, Page: wikipages consist of three distinct sections: the header, main content area, and footer. Other parts of the stack fundamentally assume a wikipage is one complete part. To handle this PRP overrides (among other things) the text selection methods from the jquery.textSelection plugin, but so far it has only implemented the getSelection
method because that was needed to make VisualEditor work (I am unclear on what specifically this need was; VE has at least some specific knowledge of PRP for other reasons, so it's entirely possible the getSelecion
override isn't even necessary any more). What it's doing is concatenating the header, body, and footer so that it can provide VE a single text unit to operate on. But when the 2010 Wikieditor's search and replace function runs, it gets the same concatenated text, meaning that when it finds matching substrings within the text it finds a range that is offset relative to the first character of the header rather than the first character of the body. PRP does not yet override setSelection
, so when the 2010 Wikieditor selects the matched text it uses this offset and ends up selecting a range that is off by the number of characters in the header (which includes <noinclude> tags etc., so even an apparently empty header will throw it off). The same holds true for when it tries to replace the found text.
As a working assumption, the fix is simply to implement overrides for the other jquery.textSelection methods in PRP, in the vicinity of /mediawiki/extensions/ProofreadPage/modules/page/ext.proofreadpage.page.edit.js L385. The overrides should presumably just need to track the offset caused by the header and adjust the value when calling through to the original method. If we want search and replace to work in header and footer fields we'd need to be a little more fancy, keeping track of which ranges correspond to which text field and mapping to the correct offset depending which field we're in. To be hyper-hyper fancy we'd need to add UI to the 2010 Wikieditor to allow toggling on and of searching in the header/footer; but I don't think there is any real need for this. Just getting search and replace working in the body will be a massive improvement.
This isn't really a bug per se. Multiple parts of the tech stack have changed over the years, leading to the missing functionality (setSelection override and friends) that didn't used to be a problem now showing up as seeming bugs in other components. In other words, AIUI this should be firmly within the CommTech CW scope and ought to be a nicely manageably-sized task. tpt is also familiar with the existing code there (judging by T183950 and git blame
) and has historically been very generous with their limited time in answering questions about such things. I also believe SWilson and Matmarex have touched this code for various reasons and may be able to assess whether my understanding expressed above is at least approximately correct. --Xover (talk) 11:24, 5 February 2022 (UTC)
- On French Wikisource, there is another button (RegEx, in the Aide à la relecture ≈ Proofread tools tab) that performs search and replace without any bug. Maybe it suffices to implement it in every Wikisources. — ElioPrrl (talk) 19:21, 12 February 2022 (UTC)
Voting
- Support --Alex brollo (talk) 18:16, 28 January 2022 (UTC)
- Support --Jan Kameníček (talk) 00:33, 29 January 2022 (UTC)
- Support Balajijagadesh (talk) 04:34, 29 January 2022 (UTC)
- Support — ElioPrrl (talk) 11:06, 29 January 2022 (UTC)
- Support Thurs (talk) 13:03, 29 January 2022 (UTC)
- Support VIGNERON * discut. 16:34, 29 January 2022 (UTC)
- Support --Denis Gagne52 (talk) 17:06, 29 January 2022 (UTC)
- Support Viticulum (talk) 18:26, 29 January 2022 (UTC)
- Support Draco flavus (talk) 20:53, 29 January 2022 (UTC)
- Support Agus Damanik (talk) 01:39, 30 January 2022 (UTC)
- Support TheInternetGnome (talk) 08:37, 30 January 2022 (UTC)
- Support EijiroSaito (talk) 08:44, 30 January 2022 (UTC)
- Support: shocking that this has not been resolved already. Wishlist proposals are supposed to be "more than a bug" but the WMF does not care to fix bugs any more (if they ever did). — Bilorv (talk) 10:51, 30 January 2022 (UTC)
- Support --Civvì (talk) 14:15, 30 January 2022 (UTC)
- Support --g (talk) 14:24, 30 January 2022 (UTC)
- Support --LittleWhites (talk) 14:36, 30 January 2022 (UTC)
- Support--L736Etell me 14:55, 30 January 2022 (UTC)
- Support--Parma1983 (talk) 14:56, 30 January 2022 (UTC)
- Support--Mannivu · ✉ 15:20, 30 January 2022 (UTC)
- Support Uè Chelin (talk) 16:22, 30 January 2022 (UTC)
- Support without saying --.mau. ✉ 17:35, 30 January 2022 (UTC)
- Support--Pebbles (talk) 18:11, 30 January 2022 (UTC)
- Support Lectrician1 (talk) 18:55, 30 January 2022 (UTC)
- Support --Phyrexian ɸ 20:40, 30 January 2022 (UTC)
- Support --Ariel (talk) 21:21, 30 January 2022 (UTC)
- Support2--Bramfab (talk) 21:34, 30 January 2022 (UTC)
- Support --Nicolabel (talk) 23:35, 30 January 2022 (UTC)
- Support --НУРшЯGIO(beware of the moose) 23:54, 30 January 2022 (UTC)
- Support Libcub (talk) 00:54, 31 January 2022 (UTC)
- Support Bodhisattwa (talk) 05:19, 31 January 2022 (UTC)
- Support — Satirdan kahraman (talk) 06:04, 31 January 2022 (UTC)
- Support --Hsarrazin (talk) 06:53, 31 January 2022 (UTC)
- Support Satdeep Gill (talk) 08:26, 31 January 2022 (UTC)
- Support Absolutely. Naḥum (talk) 08:30, 31 January 2022 (UTC)
- Strong support Not yet ?? !!! --Info-farmer (talk) 08:57, 31 January 2022 (UTC)
- Support--Shubha (talk) 09:28, 31 January 2022 (UTC)
- Support --Jagseer S Sidhu (talk) 09:42, 31 January 2022 (UTC)
- Support Amrit Sufi (talk) 10:46, 31 January 2022 (UTC)
- Support Sohom Datta (talk) 11:33, 31 January 2022 (UTC)
- Support Candalua (talk) 11:45, 31 January 2022 (UTC)
- Support Hopefully this year, this will be fixed. Sannita - not just another it.wiki sysop 11:56, 31 January 2022 (UTC)
- Support Lagrande (no Semiramide) --Semiramide (talk) 12:19, 31 January 2022 (UTC)
- Support Hb2007 (talk) 15:19, 31 January 2022 (UTC)
- Support It's a real shame that such a basic feature is missing from our project for so many years, and yet no one seems to care Ignacio Rodríguez (talk) 19:16, 31 January 2022 (UTC)
- Support JAn Dudík (talk) 21:37, 31 January 2022 (UTC)
- Support Another sign that the Foundation needs to invest more strongly in basic core development. This, that and the other (talk) 05:34, 1 February 2022 (UTC)
- Support --Shev123 (talk) 08:38, 1 February 2022 (UTC)
- Support Havang(nl) (talk) 10:08, 1 February 2022 (UTC)
- Support --Paperoastro (talk) 10:14, 1 February 2022 (UTC)
- Support Susanna Giaccai (talk) 10:30, 1 February 2022 (UTC)
- Support Akme (talk) 17:53, 1 February 2022 (UTC)
- Support Wargo (talk) 22:19, 1 February 2022 (UTC)
- Support --Patafisik (talk) 11:01, 2 February 2022 (UTC)
- Support Dugal harpreet (talk) 13:32, 2 February 2022 (UTC)
- Support Mulkh Singh (talk) 14:41, 2 February 2022 (UTC)
- Support Gaurav Jhammat (talk) 17:51, 2 February 2022 (UTC)
- Support Silver hr (talk) 13:58, 3 February 2022 (UTC)
- Support Ed [talk] [en] 21:48, 3 February 2022 (UTC)
- Support Omino di carta (talk) 21:51, 3 February 2022 (UTC)
- Strong support εΔω 07:37, 4 February 2022 (UTC)
- Support - Darwin Ahoy! 19:24, 4 February 2022 (UTC)
- Support Thingofme (talk) 02:39, 5 February 2022 (UTC)
- Support Αντιγόνη (talk) 11:21, 5 February 2022 (UTC)
- Support Em-mustapha talk 16:45, 5 February 2022 (UTC)
- Support Waldyrious (talk) 23:24, 5 February 2022 (UTC)
- Support--Vulp❯❯❯here! 09:28, 6 February 2022 (UTC)
- Support Nitesh Gill (talk) 09:31, 6 February 2022 (UTC)
- Support —— Eric Liu(Talk) 10:51, 6 February 2022 (UTC)
- Support Daniel Case (talk) 18:27, 6 February 2022 (UTC)
- Support Ayumu Ozaki (talk) 04:14, 7 February 2022 (UTC)
- Support —TheDJ (talk • contribs) 15:58, 7 February 2022 (UTC)
- Support EconAmbiente (talk) 09:43, 9 February 2022 (UTC)
- Support Much needed function which should be done at the earliest. -- Pavithra.A (talk) 16:14, 9 February 2022 (UTC)
- Support would make the editors life easy! J.shobia (talk) 16:23, 9 February 2022 (UTC)
- Support ~Cybularny Speak? 23:55, 9 February 2022 (UTC)
- Support--TVA ARUN (talk) 06:13, 10 February 2022 (UTC)
- Support Yasosri (talk) 06:22, 10 February 2022 (UTC)
- Support--Neyakkoo (talk) 06:34, 10 February 2022 (UTC)
- Support --justinianus | talk 07:36, 10 February 2022 (UTC)
- Support ··· 🌸 Rachmat04 · ☕ 09:42, 10 February 2022 (UTC)
- Support சத்திரத்தான் (talk) 14:06, 10 February 2022 (UTC)
- Support Dovi (talk) 14:27, 10 February 2022 (UTC)
- Support Sije (talk) 17:58, 10 February 2022 (UTC)
- Support --Roxette5 (talk) 18:56, 10 February 2022 (UTC)
- Support Charan Gill (talk) 12:32, 11 February 2022 (UTC)
- Support Kaur.gurmel (talk) 12:35, 11 February 2022 (UTC)
- Support Harshaan Ghuman (talk) 12:36, 11 February 2022 (UTC)
- Support Armaan kakrala (talk) 12:37, 11 February 2022 (UTC)
- Support Mahir256 (talk) 12:45, 11 February 2022 (UTC)
- Support Mrcesare (talk) 13:17, 11 February 2022 (UTC)
- Support Gill jassu (talk) 14:58, 11 February 2022 (UTC)
- Support Gurdeepdali (talk) 17:50, 11 February 2022 (UTC)