aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/jquery/jquery.suggestions.js
diff options
context:
space:
mode:
authortjones <tjones@wikimedia.org>2019-08-19 14:23:33 -0400
committerBartosz Dziewoński <matma.rex@gmail.com>2019-08-29 23:38:44 +0200
commit6281a389c2dd2c646fb8df6c36041d711925d363 (patch)
tree557b2536dbee00aabd99a13e0a973b62c0679f1b /resources/src/jquery/jquery.suggestions.js
parent3de88a71176d088de68c7c776d89d449fcad830c (diff)
downloadmediawikicore-6281a389c2dd2c646fb8df6c36041d711925d363.tar.gz
mediawikicore-6281a389c2dd2c646fb8df6c36041d711925d363.zip
Preserve grapheme clusters in upper corner completion suggester highlighting
Grapheme clusters in Indic scripts can be split by highlighting, resulting in really ugly text in the suggestions. For example, म + े should equal मे, but doesn't if highlighting markup comes between the two characters. Affected scripts include Devanagari, Tamil, Telegu, Thai, Myanmar, Khmer, and Javanese, and probably others. Latin and Cyrillic script also have the problem, but the presentation is not as bad (at least on some browser/OS combinations). - Define a comboMarks regex (equivalent to \p{Mark} in other programming languages) and use it in a new highlighting function, prefixPlusComboHighlight, to include trailing combining characters in highlighted text. - Change the calling function to use prefixPlusComboHighlight instead of prefixHighlight. Note: This only fixes problems with **grapheme clusters** in suggestions in the **search box in the upper corner** (upper right in LTR languages, upper left in RTL languages). The main search box on the Special:Search page uses different code. Ligatures, such as Arabic ي + ا becoming يا, are not covered by this simple regex-based solution. Bug: T35242 Change-Id: I915c50180bc2196e0302f27835241624b7837f16
Diffstat (limited to 'resources/src/jquery/jquery.suggestions.js')
-rw-r--r--resources/src/jquery/jquery.suggestions.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js
index f4aea727e99d..31afe3e9d1b7 100644
--- a/resources/src/jquery/jquery.suggestions.js
+++ b/resources/src/jquery/jquery.suggestions.js
@@ -445,7 +445,7 @@
}
if ( context.config.highlightInput ) {
- $result.highlightText( context.data.prevText, { method: 'prefixHighlight' } );
+ $result.highlightText( context.data.prevText, { method: 'prefixPlusComboHighlight' } );
}
// Widen results box if needed (new width is only calculated here, applied later).