From 60e0819f68201109afbcd1a4ad5b0b36b7ece3b0 Mon Sep 17 00:00:00 2001 From: Sean Yeh Date: Thu, 18 Dec 2014 17:05:51 -0600 Subject: [PATCH] Allow Ctrl+c to copy and update readme --- README.md | 2 +- src/vibreoffice.vbs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 939c431..f6f9684 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ vibreoffice currently supports: - Movement keys: `hjkl`, `w`, `W`, `b`, `B`, `e`, `$`, `^`, `{}`, `()`, `C-d`, `C-u` - Search movement: `f`, `F`, `t`, `T` - Number modifiers: e.g. `5w`, `4fa` -- Deletion: `x`, `d`, `c`, `dd`, `cc` +- Deletion: `x`, `d`, `c`, `C`, `D`, `dd`, `cc` - Plus movement and number modifiers: e.g. `dw`, `c$`, `5dd`, `c3j` - More to come! diff --git a/src/vibreoffice.vbs b/src/vibreoffice.vbs index 11547ab..6fe5bde 100644 --- a/src/vibreoffice.vbs +++ b/src/vibreoffice.vbs @@ -276,7 +276,10 @@ function KeyHandler_KeyPressed(oEvent) as boolean ' Show terminal-like cursor oTextCursor = getTextCursor() - If MODE = "NORMAL" Then + If oEvent.Modifiers = 2 Or oEvent.Modifiers = 8 And oEvent.KeyChar = "c" Then + ' Allow Ctrl+c for Copy, so don't change cursor + ' Pass + ElseIf MODE = "NORMAL" Then cursorReset(oTextCursor) ElseIf MODE = "INSERT" Then oTextCursor.gotoRange(oTextCursor.getStart(), False) @@ -328,8 +331,10 @@ End Function Function ProcessModeKey(oEvent) + dim bIsModified + bIsModified = oEvent.Modifiers > 1 ' If Ctrl or Alt is held down. (Shift=1) ' Don't change modes in these circumstances - If MODE <> "NORMAL" Or getSpecial <> "" Or getMovementModifier() <> "" Then + If MODE <> "NORMAL" Or bIsModified Or getSpecial <> "" Or getMovementModifier() <> "" Then ProcessModeKey = False Exit Function End If @@ -388,10 +393,17 @@ Function ProcessNormalKey(oEvent) Exit Function End If + ' -------------------- ' 2. Check Delete Key ' -------------------- + ' There are no delete keys with modifier keys, so exit early + If oEvent.Modifiers > 1 Then + ProcessNormalKey = False + Exit Function + End If + ' Only 'x' or Special (dd, cc) can be done more than once If oEvent.KeyChar <> "x" and getSpecial() = "" Then iIterations = 1