pub fn get_lines(_: ()) -> Vec<String>Expand description
Extract selected text lines from the current Buffer using the active Visual range.
The range endpoints are derived from the current cursor position (.) and the Visual
start mark ('v). This means the function is intended to be invoked while still in
Visual mode; if Visual mode has already been exited the mark 'v may refer to a
previous selection and yield stale or unexpected text.
Mode handling:
- Linewise (
V): returns every full line covered by the selection (columns ignored). - Characterwise (
v): returns a slice spanning from the start (inclusive) to the end (inclusive) by internally converting the end column to an exclusive bound. - Blockwise (CTRL-V): currently treated like a plain characterwise span; rectangular shape is not preserved.
On any Nvim API error (fetching marks, lines, or text) a notification is emitted and an
empty Vec is returned. The resulting lines are also passed through nvim_oxi::dbg!
(producing debug output) before being returned.
ยงCaveats
- Relies on the live Visual selection; does not fall back to
'</'>marks. - Blockwise selections lose their column rectangle shape.
- Returned columns for multi-byte UTF-8 characters depend on byte indices exposed by
getpos(); no grapheme-aware adjustment is performed.