Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.channel-tui.selection

Pure helpers for app-side mouse text selection in the fullscreen TUI.

This is not native terminal selection. When mouse reporting is enabled the terminal sends drag/release events to Vis, so Vis tracks the visible cells, highlights the selected range, and copies that range on release.

Pure helpers for app-side mouse text selection in the fullscreen TUI.

This is not native terminal selection. When mouse reporting is enabled the
terminal sends drag/release events to Vis, so Vis tracks the visible cells,
highlights the selected range, and copies that range on release.
raw docstring

auto-scroll-directionclj

(auto-scroll-direction point opts)

Return :up, :down, or nil while a drag-selection point is at a viewport edge.

top is inclusive, bottom is exclusive, and edge-size is the number of rows at either edge that should trigger auto-scroll.

Return `:up`, `:down`, or nil while a drag-selection point is at a
viewport edge.

`top` is inclusive, `bottom` is exclusive, and `edge-size` is the number of
rows at either edge that should trigger auto-scroll.
sourceraw docstring

auto-scroll-stepclj

(auto-scroll-step {:keys [row]} {:keys [top bottom edge-size max-step]})

Return {:direction :up|:down :amount n} while a drag-selection point is in a viewport edge zone, otherwise nil.

The amount ramps up toward the outermost row so selecting at the very top or bottom of the messages viewport scrolls faster than hovering near the middle of the edge zone.

Return `{:direction :up|:down :amount n}` while a drag-selection point is in
a viewport edge zone, otherwise nil.

The amount ramps up toward the outermost row so selecting at the very top or
bottom of the messages viewport scrolls faster than hovering near the middle
of the edge zone.
sourceraw docstring

clean-copied-textclj

(clean-copied-text text)

Strip render-only markers and terminal control styling from copied text.

Used by mouse selection and whole-bubble copy. The output should be safe to paste back into Vis without ANSI SGR / OSC fragments reaching the prompt or the model.

Strip render-only markers and terminal control styling from copied text.

Used by mouse selection and whole-bubble copy. The output should be safe to
paste back into Vis without ANSI SGR / OSC fragments reaching the prompt or
the model.
sourceraw docstring

document->screen-selectionclj

(document->screen-selection {:keys [anchor focus]}
                            {:keys [viewport-top eff-scroll]})

Project a document-space selection into the current screen viewport.

Project a document-space selection into the current screen viewport.
sourceraw docstring

double-click?clj

(double-click? last-click now-ms source point threshold-ms)

True when point is a second click on the same source row in time.

last-click is a map with :source, :point, and :time-ms. Columns are intentionally ignored: line selection should tolerate small horizontal mouse movement between clicks, while requiring the same row prevents a rapid click on a neighbouring line from selecting the wrong text.

True when `point` is a second click on the same source row in time.

`last-click` is a map with `:source`, `:point`, and `:time-ms`. Columns are
intentionally ignored: line selection should tolerate small horizontal mouse
movement between clicks, while requiring the same row prevents a rapid click
on a neighbouring line from selecting the wrong text.
sourceraw docstring

line-selection-at-pointclj

(line-selection-at-point {:keys [col row]} selectable-ranges viewport)

Expand a click on a selectable screen row to that whole row.

Returns a document-space {:anchor ... :focus ...} selection, or nil when the point is only in padding/chrome. The end point is inclusive to match selected-ranges semantics.

Expand a click on a selectable screen row to that whole row.

Returns a document-space `{:anchor ... :focus ...}` selection, or nil when
the point is only in padding/chrome. The end point is inclusive to match
`selected-ranges` semantics.
sourceraw docstring

normalizeclj

(normalize {:keys [anchor focus]})

Return selection endpoints ordered top-left to bottom-right.

Input shape: {:anchor {:col c :row r} :focus {:col c :row r}}.

Return selection endpoints ordered top-left to bottom-right.

Input shape: `{:anchor {:col c :row r} :focus {:col c :row r}}`.
sourceraw docstring

pointclj

(point col row)

Construct a normalized screen point map.

Construct a normalized screen point map.
sourceraw docstring

point-in-ranges?clj

(point-in-ranges? point ranges)
(point-in-ranges? {:keys [col row]} ranges {:keys [row-padding]})

True when point lies inside at least one selectable row range.

Optional :row-padding expands the vertical hitbox without expanding the copied/highlighted cells. This gives mouse selection a forgiving start zone above and below bubbles while preserving bubble-only copy semantics.

True when `point` lies inside at least one selectable row range.

Optional `:row-padding` expands the vertical hitbox without expanding the
copied/highlighted cells. This gives mouse selection a forgiving start zone
above and below bubbles while preserving bubble-only copy semantics.
sourceraw docstring

screen->document-pointclj

(screen->document-point {:keys [col row]} {:keys [viewport-top eff-scroll]})

Convert a visible screen point into a transcript document point.

Document rows are relative to the top of the full message scrollback, not the terminal. Keeping drag anchors in this coordinate space makes selection stay attached to content while the viewport auto-scrolls underneath it.

Convert a visible screen point into a transcript document point.

Document rows are relative to the top of the full message scrollback, not
the terminal. Keeping drag anchors in this coordinate space makes selection
stay attached to content while the viewport auto-scrolls underneath it.
sourceraw docstring

selected-rangesclj

(selected-ranges selection cols rows)
(selected-ranges selection cols rows selectable-ranges)

Return inclusive row ranges for a normalized terminal-style selection.

Each range is {:row r :col c :width w} in screen cells. cols/rows clip stale mouse coordinates after resizes.

Optional selectable-ranges restricts the result to bubble cells, so a drag that crosses the header, input box, footer, or gutters highlights and copies only transcript bubble text.

Return inclusive row ranges for a normalized terminal-style selection.

Each range is `{:row r :col c :width w}` in screen cells. `cols`/`rows`
clip stale mouse coordinates after resizes.

Optional `selectable-ranges` restricts the result to bubble cells, so a
drag that crosses the header, input box, footer, or gutters highlights and
copies only transcript bubble text.
sourceraw docstring

selected-textclj

(selected-text screen-cells selection)
(selected-text screen-cells selection selectable-ranges)

Extract selected visible text from screen-cells.

screen-cells is a vector of rows; each row may be a string or a vector of per-cell strings. Trailing screen padding spaces are stripped per copied line, while leading indentation inside the selected span is preserved.

Optional selectable-ranges restricts extraction to bubble cells only.

Extract selected visible text from `screen-cells`.

`screen-cells` is a vector of rows; each row may be a string or a vector of
per-cell strings. Trailing screen padding spaces are stripped per copied
line, while leading indentation inside the selected span is preserved.

Optional `selectable-ranges` restricts extraction to bubble cells only.
sourceraw docstring

source-at-pointclj

(source-at-point point transcript-ranges input-ranges)
(source-at-point point transcript-ranges input-ranges opts)

Return the selectable text source under point, or nil.

Input rows are checked first so the input editor wins if a vertical comfort zone ever overlaps transcript chrome. Both sources use the same point-in-ranges? predicate, which keeps hit-testing behaviour identical for transcript bubbles and the input editor.

Return the selectable text source under `point`, or nil.

Input rows are checked first so the input editor wins if a vertical comfort
zone ever overlaps transcript chrome. Both sources use the same
`point-in-ranges?` predicate, which keeps hit-testing behaviour identical for
transcript bubbles and the input editor.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close