|
180 | 180 | { keys: '@<character>', type: 'action', action: 'replayMacro' }, |
181 | 181 | { keys: 'q<character>', type: 'action', action: 'enterMacroRecordMode' }, |
182 | 182 | // Handle Replace-mode as a special case of insert mode. |
183 | | - { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }}, |
| 183 | + { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }, context: 'normal'}, |
| 184 | + { keys: 'R', type: 'operator', operator: 'change', operatorArgs: { linewise: true, fullLine: true }, context: 'visual', exitVisualBlock: true}, |
184 | 185 | { keys: 'u', type: 'action', action: 'undo', context: 'normal' }, |
185 | 186 | { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true }, |
186 | 187 | { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true }, |
|
1293 | 1294 | } |
1294 | 1295 | inputState.operator = command.operator; |
1295 | 1296 | inputState.operatorArgs = copyArgs(command.operatorArgs); |
| 1297 | + if (command.exitVisualBlock) { |
| 1298 | + vim.visualBlock = false; |
| 1299 | + updateCmSelection(cm); |
| 1300 | + } |
1296 | 1301 | if (vim.visualMode) { |
1297 | 1302 | // Operating on a selection in visual mode. We don't need a motion. |
1298 | 1303 | this.evalInput(cm, vim); |
|
2104 | 2109 | change: function(cm, args, ranges) { |
2105 | 2110 | var finalHead, text; |
2106 | 2111 | var vim = cm.state.vim; |
| 2112 | + var anchor = ranges[0].anchor, |
| 2113 | + head = ranges[0].head; |
2107 | 2114 | if (!vim.visualMode) { |
2108 | | - var anchor = ranges[0].anchor, |
2109 | | - head = ranges[0].head; |
2110 | 2115 | text = cm.getRange(anchor, head); |
2111 | 2116 | var lastState = vim.lastEditInputState || {}; |
2112 | 2117 | if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) { |
|
2134 | 2139 | anchor.ch = Number.MAX_VALUE; |
2135 | 2140 | } |
2136 | 2141 | finalHead = anchor; |
| 2142 | + } else if (args.fullLine) { |
| 2143 | + head.ch = Number.MAX_VALUE; |
| 2144 | + head.line--; |
| 2145 | + cm.setSelection(anchor, head) |
| 2146 | + text = cm.getSelection(); |
| 2147 | + cm.replaceSelection(""); |
| 2148 | + finalHead = anchor; |
2137 | 2149 | } else { |
2138 | 2150 | text = cm.getSelection(); |
2139 | 2151 | var replacement = fillArray('', ranges.length); |
|
0 commit comments