diff --git a/MacNeovim/Info.plist b/MacNeovim/Info.plist index 3e46934d..7de8046f 100644 --- a/MacNeovim/Info.plist +++ b/MacNeovim/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleVersion - 217 + 218 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/SwiftNeoVim/Info.plist b/SwiftNeoVim/Info.plist index 28ad0ffd..e3bdb8af 100644 --- a/SwiftNeoVim/Info.plist +++ b/SwiftNeoVim/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleSignature ???? CFBundleVersion - 217 + 218 NSHumanReadableCopyright Copyright © 2016 Tae Won Ha. All rights reserved. NSPrincipalClass diff --git a/SwiftNeoVim/KeyUtils.swift b/SwiftNeoVim/KeyUtils.swift index bb2c324d..09dcee11 100644 --- a/SwiftNeoVim/KeyUtils.swift +++ b/SwiftNeoVim/KeyUtils.swift @@ -7,6 +7,18 @@ import Cocoa class KeyUtils { + static func isControlCode(key: String) -> Bool { + guard key.characters.count == 1 else { + return false + } + + guard let firstChar = key.utf16.first else { + return false + } + + return firstChar < 32 && firstChar > 0 + } + static func isSpecial(key: String) -> Bool { guard key.characters.count == 1 else { return false diff --git a/SwiftNeoVim/NeoVimView+Key.swift b/SwiftNeoVim/NeoVimView+Key.swift index bd060231..522e1194 100644 --- a/SwiftNeoVim/NeoVimView+Key.swift +++ b/SwiftNeoVim/NeoVimView+Key.swift @@ -27,22 +27,18 @@ extension NeoVimView { ? event.charactersIgnoringModifiers!.lowercased() : event.charactersIgnoringModifiers! - if KeyUtils.isSpecial(key: charsIgnoringModifiers) { - if let vimModifiers = self.vimModifierFlags(modifierFlags) { - self.agent.vimInput( - self.wrapNamedKeys(vimModifiers + KeyUtils.namedKeyFrom(key: charsIgnoringModifiers)) - ) - } else { - self.agent.vimInput(self.wrapNamedKeys(KeyUtils.namedKeyFrom(key: charsIgnoringModifiers))) - } - } else { - if let vimModifiers = self.vimModifierFlags(modifierFlags) { - self.agent.vimInput(self.wrapNamedKeys(vimModifiers + charsIgnoringModifiers)) - } else { - self.agent.vimInput(self.vimPlainString(chars)) - } - } + let flags = self.vimModifierFlags(modifierFlags) ?? "" + let isNamedKey = KeyUtils.isSpecial(key: charsIgnoringModifiers) + let isControlCode = KeyUtils.isControlCode(key: chars) && !isNamedKey + let isPlain = flags.isEmpty && !isNamedKey + let isWrapNeeded = !isControlCode && !isPlain + let namedChars = KeyUtils.namedKeyFrom(key: charsIgnoringModifiers) + let finalInput = isWrapNeeded + ? self.wrapNamedKeys(flags + namedChars) + : self.vimPlainString(chars) + + self.agent.vimInput(finalInput) self.keyDownDone = true } @@ -82,19 +78,44 @@ extension NeoVimView { } override public func performKeyEquivalent(with event: NSEvent) -> Bool { - let type = event.type - let flags = event.modifierFlags + if .keyDown != event.type { return false } + let flags = event.modifierFlags.intersection(.deviceIndependentFlagsMask) /* & do not trigger keyDown events. Catch the key event here and pass it to keyDown. (By rogual in NeoVim dot app https://github.com/rogual/neovim-dot-app/pull/248/files ) */ - if .keyDown == type && flags.contains(.control) && 48 == event.keyCode { + if flags.contains(.control) && 48 == event.keyCode { self.keyDown(with: event) return true } + guard let chars = event.characters else { + return false; + } + + // Control code \0 causes rpc parsing problems. + // So we escape as early as possible + if chars == "\0" { + self.agent.vimInput(self.wrapNamedKeys("Nul")) + return true + } + + // For the following two conditions: + // See special cases in vim/os_win32.c from vim sources + // Also mentioned in MacVim's KeyBindings.plist + if .control == flags && chars == "6" { + self.agent.vimInput("\u{1e}") // AKA ^^ + return true + } + if .control == flags && chars == "2" { + // should generate \0, escaping as above + self.agent.vimInput(self.wrapNamedKeys("Nul")) + return true + } + // NsEvent already sets \u{1f} for && + return false } diff --git a/SwiftNeoVimTests/Info.plist b/SwiftNeoVimTests/Info.plist index 352ac73c..75284d63 100644 --- a/SwiftNeoVimTests/Info.plist +++ b/SwiftNeoVimTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleSignature ???? CFBundleVersion - 217 + 218 diff --git a/VimR-Workspace-Demo/Info.plist b/VimR-Workspace-Demo/Info.plist index 17192bf4..1c35c871 100644 --- a/VimR-Workspace-Demo/Info.plist +++ b/VimR-Workspace-Demo/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleSignature ???? CFBundleVersion - 217 + 218 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright diff --git a/VimR.xcodeproj/project.pbxproj b/VimR.xcodeproj/project.pbxproj index e5598d41..01a62d34 100644 --- a/VimR.xcodeproj/project.pbxproj +++ b/VimR.xcodeproj/project.pbxproj @@ -1803,7 +1803,7 @@ COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 217; + DYLIB_CURRENT_VERSION = 218; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1828,7 +1828,7 @@ COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 217; + DYLIB_CURRENT_VERSION = 218; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2065,7 +2065,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 217; + CURRENT_PROJECT_VERSION = 218; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -2115,7 +2115,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 217; + CURRENT_PROJECT_VERSION = 218; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; diff --git a/VimR/Info.plist b/VimR/Info.plist index 1f1eab72..fd282149 100644 --- a/VimR/Info.plist +++ b/VimR/Info.plist @@ -32,7 +32,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleSignature ???? CFBundleURLTypes @@ -49,7 +49,7 @@ CFBundleVersion - 217 + 218 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/VimRTests/Info.plist b/VimRTests/Info.plist index 352ac73c..75284d63 100644 --- a/VimRTests/Info.plist +++ b/VimRTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.18.0 + SNAPSHOT-218 CFBundleSignature ???? CFBundleVersion - 217 + 218 diff --git a/appcast_snapshot.xml b/appcast_snapshot.xml index c51e7f58..e0949aab 100644 --- a/appcast_snapshot.xml +++ b/appcast_snapshot.xml @@ -7,26 +7,22 @@ Most recent changes with links to updates for VimR. en - v0.18.0-217 + SNAPSHOT-218 -
  • GH-481: Bugfix: Quiting with :qa! warns about buffers that are already gone. (thanks @nhtzr for the PR)
  • -
  • GH-458: Drag & Drop of files onto the main window works. (thanks @nhtzr for the PR)
  • -
  • GH-487: Hide the mouse cursor when typing. (thanks @nhtzr for the PR)
  • -
  • GH-315: Enable mapping of <C-Tab> and <C-S-Tab>. (thanks @nhtzr for the PR)
  • -
  • GH-368: Send FocusGained and FocusLost event to neovim backend. (thanks @nhtzr for the PR)
  • +
  • GH-492: Improve Control key handling: e.g. Ctrl-6 works now. (thanks @nhtzr for the PR)
  • ]]>
    - https://github.com/qvacua/vimr/releases/tag/v0.18.0-217 + https://github.com/qvacua/vimr/releases/tag/snapshot/218 - 2017-08-13T07:46:01.861985 + 2017-08-16T17:50:59.561679 10.10.0 -
    diff --git a/bin/build.sh b/bin/build.sh index 0e920d5a..df300940 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -93,4 +93,13 @@ if [ "${UPDATE_APPCAST}" = true ] ; then ./bin/commit_and_push_appcast.sh "${BRANCH}" "${COMPOUND_VERSION}" ${IS_SNAPSHOT} ${UPDATE_SNAPSHOT_APPCAST_FOR_RELEASE} fi +if [ "${IS_SNAPSHOT}" = false ] ; then + echo "### Merging ${BRANCH} back to develop" + git reset --hard @ + git fetch origin + git checkout -b for_master_to_develop origin/develop + git merge --ff-only for_build + git push origin HEAD:develop +fi + echo "### Built VimR" diff --git a/bin/commit_and_push_appcast.sh b/bin/commit_and_push_appcast.sh index acf9ad47..8eab34aa 100755 --- a/bin/commit_and_push_appcast.sh +++ b/bin/commit_and_push_appcast.sh @@ -13,18 +13,13 @@ else cp ./build/Release/appcast.xml . fi -echo "### Commiting and pushing appcast to ${BRANCH}" +if [ "${IS_SNAPSHOT}" = false ] && [ "${UPDATE_SNAPSHOT_APPCAST_FOR_RELEASE}" = true ] ; then + cp appcast.xml appcast_snapshot.xml +fi -git commit -S -am "Bump appcast to ${COMPOUND_VERSION}" +echo "### Commiting and pushing appcast(s) to ${BRANCH}" + +git add appcast* +git commit -S -m "Bump appcast(s) to ${COMPOUND_VERSION}" git push origin HEAD:"${BRANCH}" -if [ "${IS_SNAPSHOT}" = false ] && [ "${UPDATE_SNAPSHOT_APPCAST_FOR_RELEASE}" = true ] ; then - echo "### Committing and pushing release appcast to develop" - git reset --hard @ - git fetch origin - git checkout -b for_appcast origin/develop - git merge --ff-only for_build - cp appcast.xml appcast_snapshot.xml - git commit appcast_snapshot.xml -m "Update appcast_snapshot with version ${COMPOUND_VERSION}" - git push origin HEAD:develop -fi diff --git a/resources/release-notes.md b/resources/release-notes.md index c796333f..e3b7350e 100644 --- a/resources/release-notes.md +++ b/resources/release-notes.md @@ -1,5 +1,6 @@ # next +* GH-492: Improve `Control` key handling: e.g. `Ctrl-6` works now. (thanks @nhtzr for the PR) * ... # 0.18.0-217