|
NoodleText
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/ioctl.h>#include <sys/types.h>#include <termios.h>#include <ctype.h>#include <errno.h>#include "args.h"Data Structures | |
| struct | erow |
| struct | editorConfig |
| struct | abuf |
| Append buffer: dynamic string type struct. More... | |
Macros | |
| #define | _DEFAULT_SOURCE |
| #define | _BSD_SOURCE |
| #define | _GNU_SOURCE |
| #define | CTRL_KEY(k) ((k)&0x1f) |
| Value that represents the CTRL key. More... | |
| #define | NOODLE_VERSION "0.0.1" |
Enumerations | |
| enum | editorKey { ARROW_LEFT = 1000 , ARROW_RIGHT , ARROW_UP , ARROW_DOWN , DEL_KEY , HOME_KEY , END_KEY , PAGE_UP , PAGE_DOWN } |
editorRow : a row of text | |
| #define | ABUF_INIT {NULL, 0} |
| typedef struct erow | erow |
| struct editorConfig | E |
| void | kill (const char *s) |
| =die. Error handling function using unistd.h More... | |
| void | disableRawMode () |
| Resets the terminal's attributes with orig_termios. More... | |
| void | enableRawMode () |
| Sets the terminal's attributes. More... | |
| int | editorReadKey () |
| int | getCursorPosition (int *rows, int *cols) |
| int | getWindowSize (int *rows, int *cols) |
| void | editorAppendRow (char *s, size_t len) |
| void | editorOpen (char *filename) |
| void | abAppend (struct abuf *ab, const char *s, int len) |
| void | abFree (struct abuf *ab) |
| Deallocates the dynamic memory used by the given. More... | |
| void | editorScroll () |
| Check if the cursor moved outside the editor window. More... | |
| void | editorDrawRows (struct abuf *ab) |
| Draws the rows on the side of the editor. More... | |
| void | editorRefreshScreen () |
| Clears the screen of the editor. More... | |
| void | editorMoveCursor (int key) |
| Receives the given WASD keys and moves the cursor accordingly. More... | |
| void | editorProcessKeypress () |
| void | initEditor () |
| Initialize all the fields in the E struct after enabling raw mode in the editor. More... | |
| int | main (int argc, char *argv[]) |
| #define _BSD_SOURCE |
| #define _DEFAULT_SOURCE |
| #define _GNU_SOURCE |
| #define ABUF_INIT {NULL, 0} |
Represents an empty buffer, used as a constructor for the abuf type struct
| #define CTRL_KEY | ( | k | ) | ((k)&0x1f) |
Value that represents the CTRL key.
| #define NOODLE_VERSION "0.0.1" |
| enum editorKey |
| void abAppend | ( | struct abuf * | ab, |
| const char * | s, | ||
| int | len | ||
| ) |
Appends a string
s | void abFree | ( | struct abuf * | ab | ) |
Deallocates the dynamic memory used by the given.
| void disableRawMode | ( | ) |
Resets the terminal's attributes with orig_termios.
| void editorAppendRow | ( | char * | s, |
| size_t | len | ||
| ) |
| void editorDrawRows | ( | struct abuf * | ab | ) |
Draws the rows on the side of the editor.
Number of rows to draw
| void editorMoveCursor | ( | int | key | ) |
Receives the given WASD keys and moves the cursor accordingly.
| key | Relates the key with WASD to move the cursor |
| void editorOpen | ( | char * | filename | ) |
| void editorProcessKeypress | ( | ) |
Processes the result/command of each key Calls the editorReadKey() function to receive the user's input
Input holder with stdin
| int editorReadKey | ( | ) |
Handles the reading of STDIN and stores a char at a time in input.
(char) input: key input from STDIN | void editorRefreshScreen | ( | ) |
Clears the screen of the editor.
| void editorScroll | ( | ) |
Check if the cursor moved outside the editor window.
| void enableRawMode | ( | ) |
Sets the terminal's attributes.
| int getCursorPosition | ( | int * | rows, |
| int * | cols | ||
| ) |
| int getWindowSize | ( | int * | rows, |
| int * | cols | ||
| ) |
Gives the size of the terminal
| void initEditor | ( | ) |
Initialize all the fields in the E struct after enabling raw mode in the editor.
| void kill | ( | const char * | s | ) |
=die. Error handling function using unistd.h
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
The Main function.
| struct editorConfig E |