mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-24 22:33:52 +03:00
GH-666 WIP
This commit is contained in:
parent
261d020385
commit
fc9333b8d2
@ -50,6 +50,16 @@ extension NvimView {
|
||||
public func insertText(_ object: Any, replacementRange: NSRange) {
|
||||
stdoutLogger.debug("\(object) with \(replacementRange)")
|
||||
|
||||
let deleteMarkedText: Completable
|
||||
if let marked = self.markedText {
|
||||
let delSeq = Array(repeating: "<BS>", count: marked.count).joined()
|
||||
deleteMarkedText = Single
|
||||
.just(delSeq)
|
||||
.flatMapCompletable { self.bridge.vimInput($0) }
|
||||
} else {
|
||||
deleteMarkedText = Completable.empty()
|
||||
}
|
||||
|
||||
switch object {
|
||||
|
||||
case let string as String:
|
||||
@ -149,9 +159,7 @@ extension NvimView {
|
||||
stdoutLogger.debug("object: \(object), selectedRange: \(selectedRange), " +
|
||||
"replacementRange: \(replacementRange)")
|
||||
|
||||
if self.markedText == nil {
|
||||
self.markedPosition = self.ugrid.cursorPosition
|
||||
}
|
||||
self.markedPosition = self.ugrid.cursorPosition
|
||||
|
||||
Single
|
||||
.just(replacementRange.length)
|
||||
@ -178,7 +186,7 @@ extension NvimView {
|
||||
return Disposables.create()
|
||||
}
|
||||
)
|
||||
.flatMapCompletable(self.bridge.vimInputMarkedText)
|
||||
.flatMapCompletable(self.bridge.vimInput)
|
||||
.trigger()
|
||||
|
||||
self.keyDownDone = true
|
||||
|
@ -327,14 +327,11 @@ public class NvimView: NSView,
|
||||
let typesetter = Typesetter()
|
||||
var baselineOffset = CGFloat(0)
|
||||
|
||||
var markedText: String?
|
||||
|
||||
/// We store the last marked text because Cocoa's text input system does the following:
|
||||
/// 하 -> hanja popup -> insertText(하) -> attributedSubstring...() -> setMarkedText(下) -> ...
|
||||
/// We want to return "하" in attributedSubstring...()
|
||||
var lastMarkedText: String?
|
||||
|
||||
var markedPosition = Position.null
|
||||
var keyDownDone = true
|
||||
|
||||
var lastClickedCellPosition = Position.null
|
||||
@ -363,6 +360,10 @@ public class NvimView: NSView,
|
||||
let eventsSubject = PublishSubject<Event>()
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
var markedText: String?
|
||||
var markedPosition = Position.null
|
||||
var markedRangeOnScreen: NSRange?
|
||||
|
||||
// MARK: - Private
|
||||
private var _linespacing = NvimView.defaultLinespacing
|
||||
}
|
||||
|
@ -297,7 +297,8 @@ class UiBridge {
|
||||
process.currentDirectoryPath = self.cwd.path
|
||||
process.launchPath = self.nvimServerExecutablePath()
|
||||
// GH-666: FIXME
|
||||
process.arguments = [self.localServerName, self.remoteServerName] + ["--headless", "/Users/hat/php.php"] + self.nvimArgs
|
||||
// process.arguments = [self.localServerName, self.remoteServerName] + ["--headless", "/Users/hat/php.php"] + self.nvimArgs
|
||||
process.arguments = [self.localServerName, self.remoteServerName] + ["--headless"] + self.nvimArgs
|
||||
process.launch()
|
||||
|
||||
self.nvimServerProc = process
|
||||
|
Loading…
Reference in New Issue
Block a user