|
ze
|

Files | |
| file | row.c |
| Row manipulation and conversion implementations. | |
Functions | |
| int | editorRowCxToRx (erow *row, int cx) |
| Convert an index in characters (cx) to a render index (rx). | |
| int | editorRowRxToCx (erow *row, int rx) |
| Convert a render index (rx) to a character index (cx). | |
| void | editorUpdateRow (erow *row) |
Recompute render, rsize, and syntax highlighting for a row. | |
| void | editorInsertRow (int at, char *s, size_t len) |
Insert a new row at position at initialized from a string. | |
| void | editorFreeRow (erow *row) |
| Free dynamic memory associated with a row. | |
| void | editorDelRow (int at) |
Delete row at index at. | |
| void | editorRowInsertChar (erow *row, int at, int c) |
Insert a character into a row at index at. | |
| void | editorRowAppendString (erow *row, char *s, size_t len) |
| Append a byte sequence to the end of a row. | |
| void | editorRowDelChar (erow *row, int at) |
Delete a character at index at in a row. | |
| void | editorDelRowAtChar (erow *row, int at) |
| Delete from a row starting at a character index to the end of the line. | |
| void editorDelRow | ( | int | at | ) |
Delete row at index at.
Frees the row, compacts the array, updates indices, and marks the buffer dirty.
| [in] | at | Index of the row to delete in [0, E.numrows). |
| void editorDelRowAtChar | ( | erow * | row, |
| int | at | ||
| ) |
Delete from a row starting at a character index to the end of the line.
Deletes characters from at (exclusive) to the end, effectively trimming the line at at. Updates render and marks dirty.
| [in,out] | row | Target row. |
| [in] | at | Index after which characters are removed. Must be in range. |
| void editorFreeRow | ( | erow * | row | ) |
Free dynamic memory associated with a row.
Releases render, chars, and hl arrays if allocated.
| [in,out] | row | Row whose buffers to free. |
| void editorInsertRow | ( | int | at, |
| char * | s, | ||
| size_t | len | ||
| ) |
Insert a new row at position at initialized from a string.
Shifts rows after at, initializes the new row's fields, and updates indexes and dirty state. Copies exactly len bytes from s and appends a NUL terminator.
Ownership: s is not owned and is not modified. The new row holds its own NUL-terminated copy.
| [in] | at | Destination index in [0, E.numrows]. Out-of-range is ignored. |
| [in] | s | Pointer to bytes (may contain non-printables; no NUL required). |
| [in] | len | Number of bytes from s to copy. |
| void editorRowAppendString | ( | erow * | row, |
| char * | s, | ||
| size_t | len | ||
| ) |
Append a byte sequence to the end of a row.
Extends row->chars by len bytes from s, appends a NUL terminator, updates render and dirty state.
| [in,out] | row | Target row. |
| [in] | s | Bytes to append; need not be NUL-terminated. |
| [in] | len | Number of bytes from s to append. |
| int editorRowCxToRx | ( | erow * | row, |
| int | cx | ||
| ) |
Convert an index in characters (cx) to a render index (rx).
Accounts for tabs expanding to ZE_TAB_STOP columns.
| [in] | row | Row whose data to measure. Must be non-NULL. |
| [in] | cx | Character index within row (0..size). |
cx. | void editorRowDelChar | ( | erow * | row, |
| int | at | ||
| ) |
Delete a character at index at in a row.
Removes the byte at at, shifts the tail left, updates render and marks dirty.
| [in,out] | row | Target row. |
| [in] | at | Index to delete in [0, size). |
| void editorRowInsertChar | ( | erow * | row, |
| int | at, | ||
| int | c | ||
| ) |
Insert a character into a row at index at.
Reallocates the row text, shifts tail, inserts c, updates render and marks dirty.
| [in,out] | row | Target row. Must be non-NULL. |
| [in] | at | Insertion index; values outside [0, size] clamp to end. |
| [in] | c | Character code to insert (low 8 bits used). |
| int editorRowRxToCx | ( | erow * | row, |
| int | rx | ||
| ) |
Convert a render index (rx) to a character index (cx).
Inverse of editorRowCxToRx(), handling tab expansion.
| [in] | row | Row whose data to measure. Must be non-NULL. |
| [in] | rx | Render column index (0..rsize). |
rx. | void editorUpdateRow | ( | erow * | row | ) |
Recompute render, rsize, and syntax highlighting for a row.
Allocates/updates row->render from row->chars expanding tabs, updates row->rsize, and recomputes syntax highlighting. Propagates multi-line comment state to the next row when it changes.
| [in,out] | row | Row to update. Its render buffer is reallocated. |