utf8 processing without struct
This commit is contained in:
+8
-29
@@ -8,23 +8,17 @@
|
||||
#include "lisp.h"
|
||||
|
||||
|
||||
typedef struct{
|
||||
unsigned char c[4];
|
||||
char len;
|
||||
} utf_8_char_t;
|
||||
|
||||
/**
|
||||
* \struct erow
|
||||
* \struct row_t
|
||||
* \brief Store one editor row
|
||||
* \param
|
||||
* */
|
||||
|
||||
typedef struct erow {
|
||||
typedef struct row {
|
||||
int size; /**< Size of the line */
|
||||
int rsize; /**< Size of the render line */
|
||||
utf_8_char_t *chars; /**< Characters of the line */
|
||||
utf_8_char_t *render; /**< The actual line we will print */
|
||||
} erow;
|
||||
int cap; /**< Size of the render line */
|
||||
char *chars; /**< Characters of the line */
|
||||
} row_t;
|
||||
|
||||
enum editorStatus_e {
|
||||
IDLE,
|
||||
@@ -57,24 +51,9 @@ typedef enum {
|
||||
MOD_CTRL = 4
|
||||
} KeyModifier;
|
||||
|
||||
// Key information structure
|
||||
typedef struct {
|
||||
KeyType type;
|
||||
int modifiers; // Bitmask of KeyModifier
|
||||
union {
|
||||
unsigned int codepoint; // For KEY_CHAR
|
||||
char ctrl_char; // For KEY_CTRL (A-Z)
|
||||
char alt_char; // For KEY_ALT
|
||||
char arrow; // For KEY_ARROW (U/D/L/R)
|
||||
int function_num; // For KEY_FUNCTION (1-12)
|
||||
char special; // For KEY_SPECIAL and KEY_NAVIGATION
|
||||
} data;
|
||||
utf_8_char_t c; // Raw bytes
|
||||
} KeyInfo;
|
||||
|
||||
|
||||
struct keyBind_t {
|
||||
KeyInfo *key_sequence;
|
||||
char *key_sequence;
|
||||
Lisp command;
|
||||
};
|
||||
|
||||
@@ -90,7 +69,7 @@ struct editorConfig {
|
||||
int screenrows; /**< Terminal height*/
|
||||
int screencols; /**< Terminal width*/
|
||||
int numrows; /**< Number of rows contained */
|
||||
erow *row; /**< Store all the rows printed */
|
||||
row_t *rows; /**< Store all the rows printed */
|
||||
int dirty;
|
||||
char *filename;
|
||||
enum editorStatus_e state;
|
||||
@@ -118,7 +97,7 @@ struct editorConfig {
|
||||
* */
|
||||
|
||||
struct abuf {
|
||||
unsigned char *b; /**< Text that will be printed */
|
||||
char *b; /**< Text that will be printed */
|
||||
int len; /**< Length of the text */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user