Index: trunk/phase3/resources/jquery/jquery.textSelection.js |
— | — | @@ -128,12 +128,11 @@ |
129 | 129 | selText = selText.replace( /\r?\n/g, "\r\n" ); |
130 | 130 | post = post.replace( /\r?\n/g, "\r\n" ); |
131 | 131 | } |
132 | | - if ( isSample && options.selectPeri ) { |
| 132 | + if ( isSample && options.selectPeri && !options.splitlines ) { |
133 | 133 | this.selectionStart = startPos + pre.length; |
134 | 134 | this.selectionEnd = startPos + pre.length + selText.length; |
135 | 135 | } else { |
136 | | - this.selectionStart = startPos + pre.length + selText.length + |
137 | | - post.length; |
| 136 | + this.selectionStart = startPos + insertText.length; |
138 | 137 | this.selectionEnd = this.selectionStart; |
139 | 138 | } |
140 | 139 | } else if ( document.selection && document.selection.createRange ) { |
— | — | @@ -413,7 +412,7 @@ |
414 | 413 | 'post': '', // Text to insert after the cursor/selection |
415 | 414 | 'ownline': false, // Put the inserted text on a line of its own |
416 | 415 | '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) |
418 | 417 | 'splitlines': false // If multiple lines are selected, encapsulate each line individually |
419 | 418 | }, options ); |
420 | 419 | break; |