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

Fix forward search

- Removed the cursor event without thinking...
This commit is contained in:
Tae Won Ha 2019-12-25 13:46:07 +01:00
parent b14c1f7241
commit ed14c0d358
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 13 additions and 4 deletions

View File

@ -85,9 +85,11 @@ static void server_ui_cursor_goto(
Integer col
) {
pack_flush_data(RenderDataTypeGoto, ^(msgpack_packer *packer) {
msgpack_pack_array(packer, 2);
msgpack_pack_array(packer, 4);
msgpack_pack_int64(packer, row);
msgpack_pack_int64(packer, col);
msgpack_pack_int64(packer, curwin->w_cursor.lnum);
msgpack_pack_int64(packer, curwin->w_cursor.col + 1);
});
}

View File

@ -88,9 +88,14 @@ extension NvimView {
case .goto:
guard let row = innerArray[0].unsignedIntegerValue,
let col = innerArray[1].unsignedIntegerValue else { return }
let col = innerArray[1].unsignedIntegerValue,
let textPositionRow = innerArray[2].unsignedIntegerValue,
let textPositionCol = innerArray[3].unsignedIntegerValue else { return }
self.doGoto(position: Position(row: Int(row), column: Int(col)))
self.doGoto(
position: Position(row: Int(row), column: Int(col)),
textPosition: Position(row: Int(textPositionRow), column: Int(textPositionCol))
)
case .scroll:
let values = innerArray.compactMap { $0.intValue }
@ -321,7 +326,7 @@ extension NvimView {
return (newRowContainsWideChar, row)
}
private func doGoto(position: Position) {
private func doGoto(position: Position, textPosition: Position) {
self.bridgeLogger.debug(position)
// Re-render the old cursor position.
@ -333,6 +338,8 @@ extension NvimView {
self.markForRender(
region: self.cursorRegion(for: self.ugrid.cursorPosition)
)
self.eventsSubject.onNext(.cursor(textPosition))
}
private func doScroll(_ array: [Int]) -> Int {