jquery.textSelection: Select sample text, if possible, when splitlines is true
authorScimonster <tehalmightyscimonster@gmail.com>
Sat, 6 Dec 2014 16:46:49 +0000 (16:46 +0000)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sat, 6 Dec 2014 17:20:26 +0000 (17:20 +0000)
Bug: T72764
Change-Id: Ic39b56f78d8e0bfeaa5ad5ff3d0e9e6e6a0e56fc

resources/src/jquery/jquery.textSelection.js

index 632769b..bd6518d 100644 (file)
                                                                selText = selText.replace( /\r?\n/g, '\r\n' );
                                                                post = post.replace( /\r?\n/g, '\r\n' );
                                                        }
-                                                       if ( isSample && options.selectPeri && !options.splitlines ) {
+                                                       if ( isSample && options.selectPeri && ( !options.splitlines || ( options.splitlines && selText.indexOf( '\n' ) === -1 ) ) ) {
                                                                this.selectionStart = startPos + pre.length;
                                                                this.selectionEnd = startPos + pre.length + selText.length;
                                                        } else {