1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-24 22:33:52 +03:00
This commit is contained in:
Tae Won Ha 2020-01-26 21:53:21 +01:00
parent d469d6d9e1
commit f4b515c30f
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
6 changed files with 169 additions and 169 deletions

View File

@ -9,7 +9,7 @@ import RxSwift
extension RxNeovimApi {
public func getDirtyStatus(
checkBlocked: Bool = true
errWhenBlocked: Bool = true
) -> Single<Bool> {
let params: [RxNeovimApi.Value] = [
@ -23,7 +23,7 @@ extension RxNeovimApi {
return result
}
if checkBlocked {
if errWhenBlocked {
return self
.checkBlocked(
self.rpc(method: "nvim_get_dirty_status", params: params, expectsReturnValue: true)
@ -38,7 +38,7 @@ extension RxNeovimApi {
public func bufGetInfo(
buffer: RxNeovimApi.Buffer,
checkBlocked: Bool = true
errWhenBlocked: Bool = true
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
let params: [RxNeovimApi.Value] = [
@ -53,7 +53,7 @@ extension RxNeovimApi {
return result
}
if checkBlocked {
if errWhenBlocked {
return self
.checkBlocked(
self.rpc(method: "nvim_buf_get_info", params: params)

View File

@ -41,7 +41,7 @@ extension NvimView {
let finalInput = isWrapNeeded ? self.wrapNamedKeys(flags + namedChars)
: self.vimPlainString(chars)
_ = self.api.input(keys: finalInput, checkBlocked: false).syncValue()
_ = self.api.input(keys: finalInput, errWhenBlocked: false).syncValue()
self.keyDownDone = true
}
@ -130,7 +130,7 @@ extension NvimView {
// So we escape as early as possible
if chars == "\0" {
self.api
.input(keys: self.wrapNamedKeys("Nul"), checkBlocked: false)
.input(keys: self.wrapNamedKeys("Nul"), errWhenBlocked: false)
.subscribe()
.disposed(by: self.disposeBag)
return true
@ -141,7 +141,7 @@ extension NvimView {
// Also mentioned in MacVim's KeyBindings.plist
if .control == flags && chars == "6" {
self.api
.input(keys: "\u{1e}", checkBlocked: false) // AKA ^^
.input(keys: "\u{1e}", errWhenBlocked: false) // AKA ^^
.subscribe()
.disposed(by: self.disposeBag)
return true
@ -150,7 +150,7 @@ extension NvimView {
if .control == flags && chars == "2" {
// <C-2> should generate \0, escaping as above
self.api
.input(keys: self.wrapNamedKeys("Nul"), checkBlocked: false)
.input(keys: self.wrapNamedKeys("Nul"), errWhenBlocked: false)
.subscribe()
.disposed(by: self.disposeBag)
return true

View File

@ -50,14 +50,14 @@ extension NvimView {
switch self.mode {
case .insert, .replace:
self.api
.input(keys: "<Esc>ui", checkBlocked: false)
.input(keys: "<Esc>ui", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not undo", cause: error))
})
.disposed(by: self.disposeBag)
case .normal, .visual:
self.api
.input(keys: "u", checkBlocked: false)
.input(keys: "u", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not undo", cause: error))
})
@ -71,14 +71,14 @@ extension NvimView {
switch self.mode {
case .insert, .replace:
self.api
.input(keys: "<Esc><C-r>i", checkBlocked: false)
.input(keys: "<Esc><C-r>i", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not redo", cause: error))
})
.disposed(by: self.disposeBag)
case .normal, .visual:
self.api
.input(keys: "<C-r>", checkBlocked: false)
.input(keys: "<C-r>", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not redo", cause: error))
})
@ -92,7 +92,7 @@ extension NvimView {
switch self.mode {
case .visual, .normal:
self.api
.input(keys: "\"+d", checkBlocked: false)
.input(keys: "\"+d", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not cut", cause: error))
})
@ -106,7 +106,7 @@ extension NvimView {
switch self.mode {
case .visual, .normal:
self.api
.input(keys: "\"+y", checkBlocked: false)
.input(keys: "\"+y", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not copy", cause: error))
})
@ -125,7 +125,7 @@ extension NvimView {
|| self.mode == .replace
|| self.mode == .termFocus {
self.api
.input(keys: self.vimPlainString(content), checkBlocked: false)
.input(keys: self.vimPlainString(content), errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not paste \(content)", cause: error))
})
@ -156,12 +156,12 @@ extension NvimView {
case .insert:
let cmd = element.column == 0 ? "<ESC>\"+Pa" : "<ESC>\"+pa"
return self.api
.input(keys: cmd, checkBlocked: false).asCompletable()
.input(keys: cmd, errWhenBlocked: false).asCompletable()
.andThen(Single.just(element.pasteModeSet))
case .normal, .visual:
return self.api
.input(keys: "\"+p", checkBlocked: false).asCompletable()
.input(keys: "\"+p", errWhenBlocked: false).asCompletable()
.andThen(Single.just(element.pasteModeSet))
default:
@ -186,7 +186,7 @@ extension NvimView {
switch self.mode {
case .normal, .visual:
self.api
.input(keys: "x", checkBlocked: false)
.input(keys: "x", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not delete", cause: error))
})
@ -200,14 +200,14 @@ extension NvimView {
switch self.mode {
case .insert, .visual:
self.api
.input(keys: "<Esc>ggVG", checkBlocked: false)
.input(keys: "<Esc>ggVG", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not select all", cause: error))
})
.disposed(by: self.disposeBag)
default:
self.api
.input(keys: "ggVG", checkBlocked: false)
.input(keys: "ggVG", errWhenBlocked: false)
.subscribe(onError: { error in
self.eventsSubject.onNext(.apiError(msg: "Could not select all", cause: error))
})

View File

@ -34,9 +34,9 @@ extension NvimView {
modifierFlags: event.modifierFlags,
cellPosition: cellPosition)
self.api
.input(keys: vimInputX, checkBlocked: false).asCompletable()
.input(keys: vimInputX, errWhenBlocked: false).asCompletable()
.andThen(
self.api.input(keys: vimInputY, checkBlocked: false).asCompletable()
self.api.input(keys: vimInputY, errWhenBlocked: false).asCompletable()
)
.subscribe()
.disposed(by: self.disposeBag)
@ -120,7 +120,7 @@ extension NvimView {
}
self.api
.input(keys: result, checkBlocked: false)
.input(keys: result, errWhenBlocked: false)
.subscribe()
.disposed(by: self.disposeBag)
}

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ get_mode_func_template = Template('''\
func_template = Template('''\
func ${func_name}(${args}
checkBlocked: Bool = true
errWhenBlocked: Bool = true
) -> Single<${result_type}> {
let params: [RxNeovimApi.Value] = [
@ -69,7 +69,7 @@ func_template = Template('''\
return result
}
if checkBlocked {
if errWhenBlocked {
return self
.checkBlocked(
self.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: true)