2024-03-09 18:45:32 +01:00
|
|
|
syntax = "proto2";
|
|
|
|
|
|
|
|
package cursor;
|
|
|
|
import "common.proto";
|
|
|
|
import "files.proto";
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// Handles cursor events and broadcasts them to all users.
|
2024-03-09 18:45:32 +01:00
|
|
|
service Cursor {
|
2024-09-05 00:08:07 +02:00
|
|
|
// Subscribe to a workspace's cursor events.
|
2024-03-09 18:45:32 +01:00
|
|
|
rpc Attach (stream cursor.CursorPosition) returns (stream cursor.CursorEvent);
|
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// A message representing a position in a buffer.
|
2024-03-09 18:45:32 +01:00
|
|
|
message RowCol {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The row.
|
2024-03-09 18:45:32 +01:00
|
|
|
required int32 row = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The column.
|
2024-03-09 18:45:32 +01:00
|
|
|
required int32 col = 2;
|
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// A message representing cursor position.
|
2024-03-09 18:45:32 +01:00
|
|
|
message CursorPosition {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The buffer where the cursor is located.
|
2024-03-09 18:45:32 +01:00
|
|
|
required files.BufferNode buffer = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The cursor's start position.
|
2024-03-09 18:45:32 +01:00
|
|
|
required RowCol start = 2;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The cursor's end position.
|
2024-03-09 18:45:32 +01:00
|
|
|
required RowCol end = 3;
|
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// A message representing a cursor event.
|
2024-03-09 18:45:32 +01:00
|
|
|
message CursorEvent {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The user moving the cursor.
|
2024-03-09 18:45:32 +01:00
|
|
|
required common.Identity user = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The new cursor position.
|
2024-03-09 18:45:32 +01:00
|
|
|
required CursorPosition position = 2;
|
|
|
|
}
|