ze
Loading...
Searching...
No Matches
Files | Functions
Collaboration diagram for Editing:

Files

file  edit.c
 Editing primitives implementation.
 

Functions

void editorInsertChar (int c)
 Insert a character at the current cursor position.
 
void editorInsertTimestamp (void)
 Insert a formatted local timestamp string at the cursor.
 
void editorInsertNewline (void)
 Insert a newline at the cursor position, splitting the line if needed.
 
void editorDelChar (void)
 Delete the character left of the cursor or join with previous row.
 

Detailed Description

Function Documentation

◆ editorDelChar()

void editorDelChar ( void  )

Delete the character left of the cursor or join with previous row.

If at the beginning of a line (column 0) and not at the top of the file, joins the current line into the end of the previous line. Otherwise deletes the character before the cursor. Cursor and dirty state are updated.

Postcondition
Buffer and cursor position are modified.
See also
editorRowDelChar(), editorRowAppendString(), editorDelRow()

◆ editorInsertChar()

void editorInsertChar ( int  c)

Insert a character at the current cursor position.

If the cursor is positioned at the end of the buffer (on the phantom line equal to E.numrows), a new empty line is created first. The character is inserted into the current row at column E.cx and the cursor advances by 1. Dirty state and render cache are updated via row helpers.

Parameters
[in]cCharacter code to insert. Only the low 8 bits are used.
Postcondition
On return, E.cx may increase, E.numrows may increase on first insert, and the buffer contents are modified.
See also
editorRowInsertChar(), editorInsertNewline(), editorDelChar()

◆ editorInsertNewline()

void editorInsertNewline ( void  )

Insert a newline at the cursor position, splitting the line if needed.

If E.cx is 0, inserts an empty line above the current line. Otherwise, splits the current row at E.cx, moving the tail to the next line. Advances the cursor to the beginning of the new line.

Postcondition
E.cy increments, E.cx becomes 0. Buffer rows are re-rendered.
See also
editorInsertChar(), editorDelChar(), editorInsertRow()

◆ editorInsertTimestamp()

void editorInsertTimestamp ( void  )

Insert a formatted local timestamp string at the cursor.

Inserts the current local time formatted as "%Y-%m-%d %H:%M:%S" by calling editorInsertChar() for each character.

Postcondition
Buffer is modified; cursor advances by the length of the timestamp.
See also
editorInsertChar()