mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-24 22:33:52 +03:00
GH-339 Do not forward search when reverse searching
This commit is contained in:
parent
1a68087cb3
commit
cfe3ad3bc4
@ -126,6 +126,8 @@ class MarkdownRenderer: NSObject, Flow, PreviewRenderer {
|
||||
|
||||
fileprivate let webview: WKWebView
|
||||
|
||||
fileprivate var ignoreNextForwardSearch = false;
|
||||
|
||||
fileprivate var currentUrl: URL?
|
||||
fileprivate var currentPreviewPosition = Position(row: 0, column: 0)
|
||||
weak fileprivate var neoVimInfoProvider: NeoVimInfoProvider?
|
||||
@ -227,20 +229,6 @@ class MarkdownRenderer: NSObject, Flow, PreviewRenderer {
|
||||
return extensions.contains(fileExtension)
|
||||
}
|
||||
|
||||
fileprivate func scrollSubscription(source: Observable<Any>) -> Disposable {
|
||||
return source
|
||||
.observeOn(self.scheduler)
|
||||
.throttle(0.5, latest: true, scheduler: self.scheduler)
|
||||
.filter { $0 is MainWindowComponent.ScrollAction }
|
||||
.subscribe(onNext: { [unowned self] action in
|
||||
guard self.isForwardSearchAutomatically else {
|
||||
return
|
||||
}
|
||||
|
||||
self.forwardSearchAction(nil)
|
||||
})
|
||||
}
|
||||
|
||||
fileprivate func subscription(source: Observable<Any>) -> Disposable {
|
||||
return source
|
||||
.observeOn(self.scheduler)
|
||||
@ -303,9 +291,23 @@ class MarkdownRenderer: NSObject, Flow, PreviewRenderer {
|
||||
refresh.autoPinEdge(.right, to: .left, of: reverse)
|
||||
}
|
||||
|
||||
fileprivate func scrollSubscription(source: Observable<Any>) -> Disposable {
|
||||
return source
|
||||
.throttle(0.5, latest: true, scheduler: MainScheduler.instance)
|
||||
.filter { $0 is MainWindowComponent.ScrollAction }
|
||||
.subscribe(onNext: { [unowned self] action in
|
||||
guard self.isForwardSearchAutomatically && self.ignoreNextForwardSearch == false else {
|
||||
self.ignoreNextForwardSearch = false
|
||||
return
|
||||
}
|
||||
|
||||
self.forwardSearchAction(nil)
|
||||
})
|
||||
}
|
||||
|
||||
fileprivate func addReactions() {
|
||||
self.webviewMessageHandler.flow.sink
|
||||
.throttle(0.5, latest: true, scheduler: self.scheduler)
|
||||
.throttle(0.5, latest: true, scheduler: MainScheduler.instance)
|
||||
.filter { $0 is WebviewMessageHandler.Action }
|
||||
.map { $0 as! WebviewMessageHandler.Action }
|
||||
.subscribe(onNext: { [weak self] action in
|
||||
@ -317,6 +319,10 @@ class MarkdownRenderer: NSObject, Flow, PreviewRenderer {
|
||||
return
|
||||
}
|
||||
|
||||
if self?.isForwardSearchAutomatically == true {
|
||||
self?.ignoreNextForwardSearch = true
|
||||
}
|
||||
|
||||
self?.flow.publish(
|
||||
event: PreviewRendererAction.reverseSearch(to: Position(row: lineBegin, column: columnBegin))
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user