mistral gagnant
This commit is contained in:
+172
-161
@@ -1,161 +1,172 @@
|
||||
#ifndef DATA_H_
|
||||
#define DATA_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
/**
|
||||
* \struct erow
|
||||
* \brief Store one editor row
|
||||
* \param
|
||||
* */
|
||||
|
||||
typedef struct frow {
|
||||
int size; /**< Size of the line */
|
||||
int rsize; /**< Size of the render line */
|
||||
char *chars; /**< Characters of the line */
|
||||
char *render; /**< The actual line we will print */
|
||||
} frow;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Split modes for screen layout
|
||||
*/
|
||||
typedef enum {
|
||||
SPLIT_NONE = 0, // Single buffer fullscreen
|
||||
SPLIT_VERTICAL, // Left-right split
|
||||
SPLIT_HORIZONTAL // Top-bottom split
|
||||
} SplitMode;
|
||||
|
||||
/**
|
||||
* @brief Represents an editor viewport/pane
|
||||
*/
|
||||
typedef struct {
|
||||
int buffer_id; // Which buffer this pane displays
|
||||
int start_row; // Starting row on screen
|
||||
int start_col; // Starting column on screen
|
||||
int height; // Height of this pane
|
||||
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 row_offset; // Scroll offset for rows
|
||||
int col_offset; // Scroll offset for columns
|
||||
int is_active; // Is this pane currently active
|
||||
} EditorPane;
|
||||
|
||||
/**
|
||||
* @brief Screen layout manager
|
||||
*/
|
||||
typedef struct {
|
||||
SplitMode mode;
|
||||
EditorPane *panes;
|
||||
int num_panes;
|
||||
int active_pane; // Index of active pane
|
||||
} ScreenLayout;
|
||||
|
||||
|
||||
typedef struct theme {
|
||||
char *BACKGROUND_COLOR;
|
||||
char *COLOR_KEYWORD;
|
||||
char *COLOR_TYPE;
|
||||
char *COLOR_STRING;
|
||||
char *COLOR_COMMENT;
|
||||
char *COLOR_NUMBER;
|
||||
char *COLOR_DEFAULT;
|
||||
|
||||
} theme_t;
|
||||
|
||||
enum bufferStatus_e {
|
||||
IDLE,
|
||||
READ_ONLY,
|
||||
READ_AND_WRITE,
|
||||
};
|
||||
|
||||
struct const_t {
|
||||
int TAB_LENGTH;
|
||||
int QUIT_TIMES;
|
||||
char *THEME;
|
||||
};
|
||||
|
||||
struct prefix_t {
|
||||
char prefix_name[64];
|
||||
int prefix_id;
|
||||
};
|
||||
|
||||
struct keyBind_t {
|
||||
char *key_sequence;
|
||||
int prefix_id;
|
||||
Lisp command;
|
||||
};
|
||||
|
||||
enum buffer_type { FILE_BUFF, TERMINAL_BUFF };
|
||||
|
||||
struct buffer_t {
|
||||
enum buffer_type type;
|
||||
int buffer_id;
|
||||
int width, height;
|
||||
int x, y; /**< Position in the buffer (cursor) */
|
||||
frow *row;
|
||||
int numrows;
|
||||
char *filename;
|
||||
enum bufferStatus_e state;
|
||||
int dirty; /**< Has this buffer been modified since last save */
|
||||
int row_offset; /**< Scroll offset for rows in this buffer */
|
||||
int col_offset; /**< Scroll offset for columns in this buffer */
|
||||
};
|
||||
|
||||
/**
|
||||
* \struct editorConfig
|
||||
* \brief Containing our editor state.
|
||||
*/
|
||||
struct editorConfig {
|
||||
int screenrows; /**< Terminal height*/
|
||||
int screencols; /**< Terminal width*/
|
||||
|
||||
ScreenLayout layout;
|
||||
|
||||
int dirty;
|
||||
int prefix_state;
|
||||
char status_msg[80];
|
||||
time_t status_msg_time;
|
||||
struct termios orig_termios; /**< Terminal communication interface */
|
||||
|
||||
struct const_t constantes;
|
||||
int quit_times_buffer;
|
||||
|
||||
char *init_file_path;
|
||||
FILE *fd_init_file;
|
||||
Lisp env;
|
||||
LispContext ctx; /** Lisp context */
|
||||
Lisp ctx_data; /** Lisp data context */
|
||||
LispError ctx_error; /** Lisp ctx error */
|
||||
|
||||
struct keyBind_t *key_binds;
|
||||
int number_of_keybinds;
|
||||
|
||||
struct prefix_t *prefix;
|
||||
int number_of_prefix;
|
||||
|
||||
struct buffer_t buffers[64];
|
||||
int number_of_buffer;
|
||||
|
||||
theme_t theme;
|
||||
};
|
||||
|
||||
/**
|
||||
* \struct abuf
|
||||
* \brief Contains text to add before writing to screen.
|
||||
* */
|
||||
|
||||
struct abuf {
|
||||
char *b; /**< Text that will be printed */
|
||||
int len; /**< Length of the text */
|
||||
};
|
||||
|
||||
extern struct editorConfig E;
|
||||
|
||||
#endif
|
||||
#ifndef DATA_H_
|
||||
#define DATA_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "termiWin.h"
|
||||
#else
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#include "lisp.h"
|
||||
|
||||
/**
|
||||
* \struct erow
|
||||
* \brief Store one editor row
|
||||
* \param
|
||||
* */
|
||||
|
||||
typedef struct frow {
|
||||
int size; /**< Size of the line */
|
||||
int rsize; /**< Size of the render line */
|
||||
char *chars; /**< Characters of the line */
|
||||
char *render; /**< The actual line we will print */
|
||||
} frow;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Split modes for screen layout
|
||||
*/
|
||||
typedef enum {
|
||||
SPLIT_NONE = 0, // Single buffer fullscreen
|
||||
SPLIT_VERTICAL, // Left-right split
|
||||
SPLIT_HORIZONTAL // Top-bottom split
|
||||
} SplitMode;
|
||||
|
||||
/**
|
||||
* @brief Represents an editor viewport/pane
|
||||
*/
|
||||
typedef struct {
|
||||
int buffer_id; // Which buffer this pane displays
|
||||
int start_row; // Starting row on screen
|
||||
int start_col; // Starting column on screen
|
||||
int height; // Height of this pane
|
||||
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 row_offset; // Scroll offset for rows
|
||||
int col_offset; // Scroll offset for columns
|
||||
int is_active; // Is this pane currently active
|
||||
} EditorPane;
|
||||
|
||||
/**
|
||||
* @brief Screen layout manager
|
||||
*/
|
||||
typedef struct {
|
||||
SplitMode mode;
|
||||
EditorPane *panes;
|
||||
int num_panes;
|
||||
int active_pane; // Index of active pane
|
||||
} ScreenLayout;
|
||||
|
||||
|
||||
typedef struct theme {
|
||||
char *BACKGROUND_COLOR;
|
||||
char *COLOR_KEYWORD;
|
||||
char *COLOR_TYPE;
|
||||
char *COLOR_STRING;
|
||||
char *COLOR_COMMENT;
|
||||
char *COLOR_NUMBER;
|
||||
char *COLOR_DEFAULT;
|
||||
|
||||
} theme_t;
|
||||
|
||||
enum bufferStatus_e {
|
||||
IDLE,
|
||||
READ_ONLY,
|
||||
READ_AND_WRITE,
|
||||
};
|
||||
|
||||
struct const_t {
|
||||
int TAB_LENGTH;
|
||||
int QUIT_TIMES;
|
||||
char *THEME;
|
||||
};
|
||||
|
||||
struct prefix_t {
|
||||
char prefix_name[64];
|
||||
int prefix_id;
|
||||
};
|
||||
|
||||
struct keyBind_t {
|
||||
char *key_sequence;
|
||||
int prefix_id;
|
||||
Lisp command;
|
||||
};
|
||||
|
||||
enum buffer_type { FILE_BUFF, TERMINAL_BUFF };
|
||||
|
||||
struct buffer_t {
|
||||
enum buffer_type type;
|
||||
int buffer_id;
|
||||
int width, height;
|
||||
int x, y; /**< Position in the buffer (cursor) */
|
||||
frow *row;
|
||||
int numrows;
|
||||
char *filename;
|
||||
enum bufferStatus_e state;
|
||||
int dirty; /**< Has this buffer been modified since last save */
|
||||
int row_offset; /**< Scroll offset for rows in this buffer */
|
||||
int col_offset; /**< Scroll offset for columns in this buffer */
|
||||
|
||||
// Terminal-specific data
|
||||
char *terminal_command; /**< Current command being executed */
|
||||
int terminal_pid; /**< Process ID of running terminal command */
|
||||
char *terminal_output; /**< Captured terminal output */
|
||||
int terminal_output_size; /**< Size of terminal output */
|
||||
};
|
||||
|
||||
/**
|
||||
* \struct editorConfig
|
||||
* \brief Containing our editor state.
|
||||
*/
|
||||
struct editorConfig {
|
||||
int screenrows; /**< Terminal height*/
|
||||
int screencols; /**< Terminal width*/
|
||||
|
||||
ScreenLayout layout;
|
||||
|
||||
int dirty;
|
||||
int prefix_state;
|
||||
char status_msg[80];
|
||||
time_t status_msg_time;
|
||||
struct termios orig_termios; /**< Terminal communication interface */
|
||||
|
||||
struct const_t constantes;
|
||||
int quit_times_buffer;
|
||||
|
||||
char *init_file_path;
|
||||
FILE *fd_init_file;
|
||||
Lisp env;
|
||||
LispContext ctx; /** Lisp context */
|
||||
Lisp ctx_data; /** Lisp data context */
|
||||
LispError ctx_error; /** Lisp ctx error */
|
||||
|
||||
struct keyBind_t *key_binds;
|
||||
int number_of_keybinds;
|
||||
|
||||
struct prefix_t *prefix;
|
||||
int number_of_prefix;
|
||||
|
||||
struct buffer_t buffers[64];
|
||||
int number_of_buffer;
|
||||
|
||||
theme_t theme;
|
||||
};
|
||||
|
||||
/**
|
||||
* \struct abuf
|
||||
* \brief Contains text to add before writing to screen.
|
||||
* */
|
||||
|
||||
struct abuf {
|
||||
char *b; /**< Text that will be printed */
|
||||
int len; /**< Length of the text */
|
||||
};
|
||||
|
||||
extern struct editorConfig E;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user