Skip to main content

Module buffer_position

Module buffer_position 

Source
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).