diff options
Diffstat (limited to 'atom/packages/vim-mode/lib/utils.coffee')
| -rw-r--r-- | atom/packages/vim-mode/lib/utils.coffee | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/atom/packages/vim-mode/lib/utils.coffee b/atom/packages/vim-mode/lib/utils.coffee new file mode 100644 index 0000000..362b65d --- /dev/null +++ b/atom/packages/vim-mode/lib/utils.coffee @@ -0,0 +1,14 @@ +module.exports = + # Public: Determines if a string should be considered linewise or character + # + # text - The string to consider + # + # Returns 'linewise' if the string ends with a line return and 'character' + # otherwise. + copyType: (text) -> + if text.lastIndexOf("\n") is text.length - 1 + 'linewise' + else if text.lastIndexOf("\r") is text.length - 1 + 'linewise' + else + 'character' |