1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-29 16:56:40 +03:00

Merge branch 'develop' into 325-window

This commit is contained in:
Tae Won Ha 2017-08-16 17:52:32 +02:00
commit 2d56afd0da
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
11 changed files with 77 additions and 47 deletions

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -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

View File

@ -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)
/* <C-Tab> & <C-S-Tab> 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" {
// <C-2> should generate \0, escaping as above
self.agent.vimInput(self.wrapNamedKeys("Nul"))
return true
}
// NsEvent already sets \u{1f} for <C--> && <C-_>
return false
}

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
</dict>
</plist>

View File

@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>

View File

@ -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;

View File

@ -32,7 +32,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.18.0</string>
<string>SNAPSHOT-218</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>217</string>
<string>218</string>
</dict>
</plist>

View File

@ -7,26 +7,22 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>v0.18.0-217</title>
<title>SNAPSHOT-218</title>
<description><![CDATA[
<ul>
<li>GH-481: Bugfix: Quiting with <code>:qa!</code> warns about buffers that are already gone. (thanks @nhtzr for the PR)</li>
<li>GH-458: Drag &amp; Drop of files onto the main window works. (thanks @nhtzr for the PR)</li>
<li>GH-487: Hide the mouse cursor when typing. (thanks @nhtzr for the PR)</li>
<li>GH-315: Enable mapping of <code>&lt;C-Tab&gt;</code> and <code>&lt;C-S-Tab&gt;</code>. (thanks @nhtzr for the PR)</li>
<li>GH-368: Send <code>FocusGained</code> and <code>FocusLost</code> event to neovim backend. (thanks @nhtzr for the PR)</li>
<li>GH-492: Improve <code>Control</code> key handling: e.g. <code>Ctrl-6</code> works now. (thanks @nhtzr for the PR)</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/v0.18.0-217
https://github.com/qvacua/vimr/releases/tag/snapshot/218
</releaseNotesLink>
<pubDate>2017-08-13T07:46:01.861985</pubDate>
<pubDate>2017-08-16T17:50:59.561679</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.18.0-217/VimR-v0.18.0-217.tar.bz2"
sparkle:version="217"
sparkle:shortVersionString="0.18.0"
sparkle:dsaSignature="MC0CFQCxuuyXimvYXATNukOdPtHOE1TV/wIUL5MchH/pqdc/WnZaDekiaverBGA="
length="10703208"
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/218/VimR-SNAPSHOT-218.tar.bz2"
sparkle:version="218"
sparkle:shortVersionString="SNAPSHOT-218"
sparkle:dsaSignature="MC4CFQDe/hsRbcyet99lbrWnixj3UtYilwIVAIghLm6PmfF/jwnepWgzch3HwSPf"
length="10703484"
type="application/octet-stream"/>
</item>
</channel>

View File

@ -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