2023-12-18 23:36:15 +01:00
|
|
|
syntax = "proto2";
|
|
|
|
|
2023-12-29 01:06:28 +01:00
|
|
|
package cursor;
|
2024-02-05 23:31:06 +01:00
|
|
|
import "common.proto";
|
2024-02-07 01:09:28 +01:00
|
|
|
import "files.proto";
|
2024-02-05 23:31:06 +01:00
|
|
|
|
|
|
|
// handle cursor events and broadcast to all users
|
|
|
|
service Cursor {
|
|
|
|
// subscribe to a workspace's cursor events
|
2024-02-07 01:09:28 +01:00
|
|
|
rpc Attach (stream cursor.CursorPosition) returns (stream cursor.CursorEvent);
|
2024-02-05 23:31:06 +01:00
|
|
|
}
|
2023-12-18 23:36:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
// a tuple indicating row and column
|
|
|
|
message RowCol {
|
|
|
|
required int32 row = 1;
|
|
|
|
required int32 col = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cursor position object
|
|
|
|
message CursorPosition {
|
|
|
|
// path of current buffer this cursor is into
|
2024-02-07 01:09:28 +01:00
|
|
|
required files.BufferNode buffer = 1;
|
2023-12-18 23:36:15 +01:00
|
|
|
// cursor start position
|
|
|
|
required RowCol start = 2;
|
|
|
|
// cursor end position
|
|
|
|
required RowCol end = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cursor event, with user id and cursor position
|
|
|
|
message CursorEvent {
|
|
|
|
// user moving the cursor
|
2024-02-07 01:09:28 +01:00
|
|
|
required common.Identity user = 1;
|
2023-12-18 23:36:15 +01:00
|
|
|
// new cursor position
|
|
|
|
required CursorPosition position = 2;
|
2024-02-07 01:09:28 +01:00
|
|
|
}
|