Expand description
Pure conversions between byte offsets and 2D positions on a Buffer.
These helpers consolidate the byte_to_2d / pos_2d_to_byte functions
that previously existed as duplicates in app/clipboard.rs and
input/actions.rs. They are free functions, not methods, to avoid
growing TextBuffer’s API surface — both callers already have a
&Buffer in hand.
Functions§
- byte_
to_ 2d - Convert a byte offset into a (line, column) position.
- pos_
2d_ to_ byte - Convert a 2D position into a byte offset, clamping the column to the line’s byte length (excluding the trailing newline, if any).