Merge branch 'refs/heads/char_encode'
# Conflicts: # include/builtins.h # include/data.h # include/editor_op.h # include/file_io.h # include/input.h # include/row_op.h # install.sh # main.c # meson.build # src/builtins.c # src/editor_op.c # src/file_io.c # src/init.c # src/input.c # src/output.c # src/row_op.c
This commit is contained in:
+13
-8
@@ -8,18 +8,16 @@
|
||||
#include "lisp.h"
|
||||
|
||||
/**
|
||||
* \struct erow
|
||||
* \struct row_t
|
||||
* \brief Store one editor row
|
||||
* \param
|
||||
* */
|
||||
|
||||
typedef struct frow {
|
||||
typedef struct row {
|
||||
int size; /**< Size of the line */
|
||||
int rsize; /**< Size of the render line */
|
||||
int cap; /**< Size of the render line */
|
||||
char *chars; /**< Characters of the line */
|
||||
char *render; /**< The actual line we will print */
|
||||
} frow;
|
||||
|
||||
} row_t;
|
||||
|
||||
/**
|
||||
* @brief Split modes for screen layout
|
||||
@@ -41,7 +39,7 @@ typedef struct {
|
||||
int width; // Width of this pane
|
||||
int cursor_x; // Local cursor x in this pane
|
||||
int cursor_y; // Local cursor y in this pane
|
||||
int rx, ry;
|
||||
int rx, ry;
|
||||
int row_offset; // Scroll offset for rows
|
||||
int col_offset; // Scroll offset for columns
|
||||
int is_active; // Is this pane currently active
|
||||
@@ -113,11 +111,17 @@ struct buffer_t {
|
||||
* \brief Containing our editor state.
|
||||
*/
|
||||
struct editorConfig {
|
||||
int cursor_x, cursor_y; /**< Cursor position */
|
||||
int rx; /**< Position in the render*/
|
||||
int row_offset; /**< Position scroll of lines */
|
||||
int col_offset; /**< Position scroll of colomns*/
|
||||
int screenrows; /**< Terminal height*/
|
||||
int screencols; /**< Terminal width*/
|
||||
|
||||
ScreenLayout layout;
|
||||
|
||||
|
||||
int numrows; /**< Number of rows contained */
|
||||
row_t *rows; /**< Store all the rows printed */
|
||||
int dirty;
|
||||
int prefix_state;
|
||||
char status_msg[80];
|
||||
@@ -158,4 +162,5 @@ struct abuf {
|
||||
|
||||
extern struct editorConfig E;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+14
-12
@@ -8,19 +8,21 @@
|
||||
#define HIDE_CURSOR "\x1b[?25l"
|
||||
#define SHOW_CURSOR "\x1b[?25h"
|
||||
#define ERASE_END_LINE "\x1b[K"
|
||||
#define TAB "\x09"
|
||||
#define SPACE "\x20"
|
||||
|
||||
enum editorKey {
|
||||
BACKSPACE = 127,
|
||||
ARROW_LEFT = 1000,
|
||||
ARROW_RIGHT,
|
||||
ARROW_UP,
|
||||
ARROW_DOWN,
|
||||
DEL_KEY,
|
||||
BEG_LINE,
|
||||
END_LINE,
|
||||
PAGE_UP,
|
||||
PAGE_DOWN,
|
||||
};
|
||||
enum editorKey_e {
|
||||
BACKSPACE = 127,
|
||||
ARROW_LEFT = 1000,
|
||||
ARROW_RIGHT,
|
||||
ARROW_UP,
|
||||
ARROW_DOWN,
|
||||
DEL_KEY,
|
||||
BEG_LINE,
|
||||
END_LINE,
|
||||
PAGE_UP,
|
||||
PAGE_DOWN,
|
||||
};
|
||||
|
||||
#define ABUF_INIT {NULL, 0}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ void bufferInsertChar(int c);
|
||||
|
||||
void bufferInsertNewLine();
|
||||
|
||||
void bufferDelChar();
|
||||
|
||||
void editorSetStatusMessage(const char *fmt, ...);
|
||||
|
||||
#endif // EDITOR_OP_H_
|
||||
|
||||
+4
-7
@@ -8,18 +8,15 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int bufferRowCxToRx(frow *row, int cursor_x);
|
||||
|
||||
int bufferRowRxToCx(frow *row, int rx);
|
||||
|
||||
void bufferUpdatfrow(frow *row);
|
||||
|
||||
void bufferInsertRow(struct buffer_t *buffer, int at, char *s, size_t len);
|
||||
int editorRowCxToByte(const row_t *row, int cursor_x);
|
||||
|
||||
void bufferFrefrow(frow *row);
|
||||
int editorRowCharCount(row_t *row);
|
||||
|
||||
void bufferDelRow(struct buffer_t *buffer, int at);
|
||||
void editorRowInsertBytes(row_t *row, int at, const char *src, int len);
|
||||
|
||||
void editorRowDelByte(row_t *row, int at, int n);
|
||||
void bufferRowInsertChar(struct buffer_t *buffer, frow *row, int at, int c);
|
||||
|
||||
void bufferRowAppendString(struct buffer_t *buffer, frow *row, char *s, size_t len);
|
||||
|
||||
@@ -31,4 +31,6 @@ int getCursorPosition(int *rows, int *cols);
|
||||
|
||||
int getWindowSize(int *rows, int *cols);
|
||||
|
||||
char *key_to_string(int key);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Giorgio on 01/05/2026.
|
||||
//
|
||||
|
||||
#ifndef BELUGA_UTF8_H
|
||||
#define BELUGA_UTF8_H
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t readUtf8Char(void);
|
||||
int utf8Encode(uint32_t cp, char *buf);
|
||||
int utf8Seqlen(unsigned char c);
|
||||
int codepointWidth(uint32_t codepoint);
|
||||
uint32_t utf8Decode(const char** s);
|
||||
|
||||
|
||||
#endif //BELUGA_UTF8_H
|
||||
Reference in New Issue
Block a user