Index: trunk/extensions/Narayam/ext.narayam.core.js |
— | — | @@ -155,13 +155,12 @@ |
156 | 156 | |
157 | 157 | var $this = $( this ); |
158 | 158 | var c = String.fromCharCode( e.which ); |
159 | | - // Get current caret position |
160 | | - // User may select text to overwrite |
161 | | - // Get start and end position of selection |
162 | | - // In case if user do no selection, both startPos and endPos will be same |
| 159 | + // Get the current caret position. The user may have selected text to overwrite, |
| 160 | + // so get both the start and end position of the selection. If there is no selection, |
| 161 | + // startPos and endPos will be equal. |
163 | 162 | var pos = $this.textSelection( 'getCaretPosition', { 'startAndEnd': true } ); |
164 | | - var startPos = pos[0]; |
165 | | - var endPos = pos[1]; |
| 163 | + var startPos = pos[0]; |
| 164 | + var endPos = pos[1]; |
166 | 165 | // Get the last few characters before the one the user just typed, |
167 | 166 | // to provide context for the transliteration regexes. |
168 | 167 | // We need to append c because it hasn't been added to $this.val() yet |