r89403 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89402‎ | r89403 | r89404 >
Date:10:08, 3 June 2011
Author:catrope
Status:ok
Tags:
Comment:
(bug 29105) Splitlines completely messes up selection of inserted text. This is not a problem in practice (WikiEditor doesn't have multiline insertions with splitlines enabled since r89402), but just in case it ever becomes a problem I'm disabling selection of inserted text altogether when splitlines is enabled; instead, the cursor will be moved to the end of the inserted text.
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.textSelection.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.textSelection.js
@@ -128,12 +128,11 @@
129129 selText = selText.replace( /\r?\n/g, "\r\n" );
130130 post = post.replace( /\r?\n/g, "\r\n" );
131131 }
132 - if ( isSample && options.selectPeri ) {
 132+ if ( isSample && options.selectPeri && !options.splitlines ) {
133133 this.selectionStart = startPos + pre.length;
134134 this.selectionEnd = startPos + pre.length + selText.length;
135135 } else {
136 - this.selectionStart = startPos + pre.length + selText.length +
137 - post.length;
 136+ this.selectionStart = startPos + insertText.length;
138137 this.selectionEnd = this.selectionStart;
139138 }
140139 } else if ( document.selection && document.selection.createRange ) {
@@ -413,7 +412,7 @@
414413 'post': '', // Text to insert after the cursor/selection
415414 'ownline': false, // Put the inserted text on a line of its own
416415 'replace': false, // If there is a selection, replace it with peri instead of leaving it alone
417 - 'selectPeri': true, // Select the peri text if it was inserted (but not if there was a selection and replace==false)
 416+ 'selectPeri': true, // Select the peri text if it was inserted (but not if there was a selection and replace==false, or if splitlines==true)
418417 'splitlines': false // If multiple lines are selected, encapsulate each line individually
419418 }, options );
420419 break;

Follow-up revisions

RevisionCommit summaryAuthorDate
r92923Followup r86622: add initial QUnit test cases for jquery.textSelection module....brion00:44, 23 July 2011
r93372Followup r93366: fix Opera bugs in textSelection. All tests pass in Opera now...catrope06:40, 28 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89402(bug 29104) Fix r86622: make splitlines default to false, makes much more sensecatrope09:56, 3 June 2011

Status & tagging log