scoop:scoop.terminal:0.1.0
src/event/event.scoop
Selected production source · src/event/event.scoop
1
package scoop.terminal.event3
/**4
* A user-facing keyboard, mouse, focus, bracketed-paste, or terminal-resize event.5
*/6
public enum Event {7
/**8
* A decoded key event with modifiers, event kind, and additional state.9
*/10
Key(val event: KeyEvent),11
/**12
* A decoded mouse event with position and modifiers.13
*/14
Mouse(val event: MouseEvent),15
/**16
* The terminal reported gaining focus.17
*/18
FocusGained,19
/**20
* The terminal reported losing focus.21
*/22
FocusLost,23
/**24
* Text received between bracketed-paste boundaries.25
*/26
Paste(val text: String),27
/**28
* New terminal dimensions in character columns and rows.29
*/30
Resize(val columns: Long, val rows: Long)31
}33
/**34
* The mouse button associated with a button or drag event.35
*/36
public enum MouseButton {37
/**38
* The left mouse button.39
*/40
Left,41
/**42
* The right mouse button.43
*/44
Right,45
/**46
* The middle mouse button.47
*/48
Middle }50
/**51
* Button transitions, drag/motion, and wheel directions reported by the terminal mouse protocol.52
*/53
public enum MouseEventKind {54
/**55
* A button was pressed.56
*/57
Down(val button: MouseButton),58
/**59
* A button was released.60
*/61
Up(val button: MouseButton),62
/**63
* The pointer moved while the specified button was held.64
*/65
Drag(val button: MouseButton),66
/**67
* The pointer moved with no reported drag.68
*/69
Moved,70
/**71
* The wheel scrolled upward.72
*/73
ScrollUp,74
/**75
* The wheel scrolled downward.76
*/77
ScrollDown,78
/**79
* The wheel scrolled left.80
*/81
ScrollLeft,82
/**83
* The wheel scrolled right.84
*/85
ScrollRight86
}88
/**89
* A mouse event with zero-based cell coordinates and active key modifiers.90
*/91
public struct MouseEvent(92
val kind: MouseEventKind, val column: Long, val row: Long,93
val modifiers: KeyModifiers = KeyModifiers()94
)96
/**97
* Reports malformed terminal input that cannot be delivered as an ordinary event.98
*/99
public class TerminalInputException public constructor(100
/**101
* The malformed-input explanation.102
*/103
public val detail: String) : Exception(Some(detail))