package miaou-driver-matrix
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6
doc/miaou-driver-matrix.driver/Miaou_driver_matrix/Matrix_selection/index.html
Module Miaou_driver_matrix.Matrix_selectionSource
Terminal text selection for the Matrix driver.
Handles mouse-based text selection with visual highlighting and clipboard integration. Selection works globally across any rendered content - no widget-specific code required.
Usage:
let selection = Matrix_selection.create () in
(* On mouse press: *)
Matrix_selection.start_selection selection ~row ~col ~get_char ~cols ;
(* On mouse drag: *)
Matrix_selection.update_selection selection ~row ~col ;
(* On mouse release: *)
match Matrix_selection.finish_selection selection ~get_char ~cols with
| Some text -> Matrix_selection.copy_to_clipboard text
| None -> ()Selection is drawn using reverse video style as an overlay on the normal buffer content.
Selection state.
Whether the selection is a single point (single click, no drag). Used to distinguish clicks from text selection.
Whether this is a multi-click (double or triple click). Used to pass double-clicks to widgets.
Check if a cell at (row, col) is within the current selection.
val start_selection :
t ->
row:int ->
col:int ->
get_char:(row:int -> col:int -> string) ->
cols:int ->
unitStart a new selection at the given position (on mouse press). Detects double-click (select word) and triple-click (select line).
Update the selection endpoint (on mouse drag).
val finish_selection :
t ->
get_char:(row:int -> col:int -> string) ->
cols:int ->
string optionFinish selection and extract the selected text.
val apply_highlight :
t ->
set_style:(row:int -> col:int -> reverse:bool -> unit) ->
rows:int ->
cols:int ->
unitApply selection highlight overlay to buffer cells. Cells within selection have their reverse style set.
Copy text to system clipboard using the Clipboard capability. Does nothing if Clipboard capability is not registered.