Index: trunk/extensions/Narayam/js/ext.narayam.core.js |
— | — | @@ -53,13 +53,19 @@ |
54 | 54 | var rules = currentScheme.extended_keyboard && useExtended ? |
55 | 55 | currentScheme.rules_x : currentScheme.rules; |
56 | 56 | for ( var i = 0; i < rules.length; i++ ) { |
57 | | - var keyBufferMatch = true; |
58 | | - if ( rules[i][1].length > 0 && rules[i][1].length <= keyBuffer.length ) { |
59 | | - // Try to match rules[i][1] at the end of the key buffer |
60 | | - keyBufferMatch = new RegExp( rules[i][1] + '$' ).test( keyBuffer ); |
61 | | - } |
62 | 57 | var regex = new RegExp( rules[i][0] + '$' ); |
63 | | - if ( keyBufferMatch && regex.test( str ) ) { |
| 58 | + if ( regex.test( str ) // Input string match |
| 59 | + && |
| 60 | + ( |
| 61 | + rules[i][1].length == 0 // Keybuffer match not required |
| 62 | + || |
| 63 | + ( // Keybuffer match specified, so it should be met |
| 64 | + rules[i][1].length > 0 |
| 65 | + && rules[i][1].length <= keyBuffer.length |
| 66 | + && new RegExp( rules[i][1] + '$' ).test( keyBuffer ) |
| 67 | + ) |
| 68 | + ) |
| 69 | + ) { |
64 | 70 | return str.replace( regex, rules[i][2] ); |
65 | 71 | } |
66 | 72 | } |