(cm, vim)
| 1491 | } |
| 1492 | |
| 1493 | function exitVisualMode(cm, vim) { |
| 1494 | vim.visualMode = false; |
| 1495 | vim.visualLine = false; |
| 1496 | var selectionStart = cm.getCursor('anchor'); |
| 1497 | var selectionEnd = cm.getCursor('head'); |
| 1498 | if (!cursorEqual(selectionStart, selectionEnd)) { |
| 1499 | // Clear the selection and set the cursor only if the selection has not |
| 1500 | // already been cleared. Otherwise we risk moving the cursor somewhere |
| 1501 | // it's not supposed to be. |
| 1502 | cm.setCursor(clipCursorToContent(cm, selectionEnd)); |
| 1503 | } |
| 1504 | } |
| 1505 | |
| 1506 | // Remove any trailing newlines from the selection. For |
| 1507 | // example, with the caret at the start of the last word on the line, |
no test coverage detected