codemp-proto/proto/cursor.proto
zaaarf 966e4c6211
docs: written docs
Co-authored-by: alemi <me@alemi.dev>
2024-09-05 00:08:07 +02:00

37 lines
910 B
Protocol Buffer

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