mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 23:02:35 +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) {
|
public func insertText(_ object: Any, replacementRange: NSRange) {
|
||||||
stdoutLogger.debug("\(object) with \(replacementRange)")
|
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 {
|
switch object {
|
||||||
|
|
||||||
case let string as String:
|
case let string as String:
|
||||||
@ -149,9 +159,7 @@ extension NvimView {
|
|||||||
stdoutLogger.debug("object: \(object), selectedRange: \(selectedRange), " +
|
stdoutLogger.debug("object: \(object), selectedRange: \(selectedRange), " +
|
||||||
"replacementRange: \(replacementRange)")
|
"replacementRange: \(replacementRange)")
|
||||||
|
|
||||||
if self.markedText == nil {
|
|
||||||
self.markedPosition = self.ugrid.cursorPosition
|
self.markedPosition = self.ugrid.cursorPosition
|
||||||
}
|
|
||||||
|
|
||||||
Single
|
Single
|
||||||
.just(replacementRange.length)
|
.just(replacementRange.length)
|
||||||
@ -178,7 +186,7 @@ extension NvimView {
|
|||||||
return Disposables.create()
|
return Disposables.create()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.flatMapCompletable(self.bridge.vimInputMarkedText)
|
.flatMapCompletable(self.bridge.vimInput)
|
||||||
.trigger()
|
.trigger()
|
||||||
|
|
||||||
self.keyDownDone = true
|
self.keyDownDone = true
|
||||||
|
@ -327,14 +327,11 @@ public class NvimView: NSView,
|
|||||||
let typesetter = Typesetter()
|
let typesetter = Typesetter()
|
||||||
var baselineOffset = CGFloat(0)
|
var baselineOffset = CGFloat(0)
|
||||||
|
|
||||||
var markedText: String?
|
|
||||||
|
|
||||||
/// We store the last marked text because Cocoa's text input system does the following:
|
/// We store the last marked text because Cocoa's text input system does the following:
|
||||||
/// 하 -> hanja popup -> insertText(하) -> attributedSubstring...() -> setMarkedText(下) -> ...
|
/// 하 -> hanja popup -> insertText(하) -> attributedSubstring...() -> setMarkedText(下) -> ...
|
||||||
/// We want to return "하" in attributedSubstring...()
|
/// We want to return "하" in attributedSubstring...()
|
||||||
var lastMarkedText: String?
|
var lastMarkedText: String?
|
||||||
|
|
||||||
var markedPosition = Position.null
|
|
||||||
var keyDownDone = true
|
var keyDownDone = true
|
||||||
|
|
||||||
var lastClickedCellPosition = Position.null
|
var lastClickedCellPosition = Position.null
|
||||||
@ -363,6 +360,10 @@ public class NvimView: NSView,
|
|||||||
let eventsSubject = PublishSubject<Event>()
|
let eventsSubject = PublishSubject<Event>()
|
||||||
let disposeBag = DisposeBag()
|
let disposeBag = DisposeBag()
|
||||||
|
|
||||||
|
var markedText: String?
|
||||||
|
var markedPosition = Position.null
|
||||||
|
var markedRangeOnScreen: NSRange?
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
private var _linespacing = NvimView.defaultLinespacing
|
private var _linespacing = NvimView.defaultLinespacing
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,8 @@ class UiBridge {
|
|||||||
process.currentDirectoryPath = self.cwd.path
|
process.currentDirectoryPath = self.cwd.path
|
||||||
process.launchPath = self.nvimServerExecutablePath()
|
process.launchPath = self.nvimServerExecutablePath()
|
||||||
// GH-666: FIXME
|
// 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()
|
process.launch()
|
||||||
|
|
||||||
self.nvimServerProc = process
|
self.nvimServerProc = process
|
||||||
|
Loading…
Reference in New Issue
Block a user