copy paste functions
Build project / build (push) Has been cancelled

This commit is contained in:
2026-05-26 08:28:38 +02:00
parent 777dc5cb74
commit 3d49a0e2eb
23 changed files with 369 additions and 288 deletions
+7 -1
View File
@@ -57,7 +57,13 @@ int bufferSaveAll(void);
void bufferFind(struct buffer_t *buf);
void bufferFindReverse(struct buffer_t* buf);
void bufferInsertNewLine();
void bufferInsertBytes(const char *src, int n);
void bufferDelBytes();
void bufferRowInsertBytes(struct buffer_t *buffer, row_t *row, int at, const char *src, int n);
void bufferRowDelByte(struct buffer_t *buffer, row_t *row, int at, int n);
void bufferInsertRow(struct buffer_t *buffer, int at, char *s, size_t len);
void bufferFreeRow(row_t *row);
#endif
+6 -2
View File
@@ -45,12 +45,16 @@ Lisp editorSwitchNextPane(Lisp args, LispError *e, LispContext ctx);
Lisp editorUnifiedPanes(Lisp args, LispError *e, LispContext ctx);
Lisp editorPaste(Lisp args, LispError *e, LispContext ctx);
Lisp editorCutEndLine(Lisp args, LispError *e, LispContext ctx);
Lisp editorMoveBegBuffer(Lisp args, LispError *e, LispContext ctx);
Lisp editorMoveEndBuffer(Lisp args, LispError *e, LispContext ctx);
// Other
void free_structs(void);
#endif
+9
View File
@@ -19,6 +19,13 @@ typedef struct row {
char *chars; /**< Characters of the line */
} row_t;
typedef struct context_buffer_t
{
int editor_x, editor_y;
int width, height;
row_t *rows;
} ContextBuffer;
/**
* @brief Split modes for screen layout
*/
@@ -113,6 +120,8 @@ struct editorConfig {
row_t *rows; /**< Store all the rows printed */
ContextBuffer* context_buffers;
int dirty;
char *status_msg;
+12 -2
View File
@@ -2,15 +2,17 @@
#define DEFINE_H_
#define CTRL_KEY(k) ((k) & 0x1f)
#define ALT(k) ((k) | 0x200) // set bit 9 to mark as Option combo
#define ESCAPE '\x1b'
#define CURSOR_TOP_LEFT "\x1b[H"
#define HIDE_CURSOR "\x1b[?25l"
#define SHOW_CURSOR "\x1b[?25h"
#define ERASE_END_LINE "\x1b[K"
#define TAB "\x9"
#define TAB "\t"
#define SPACE "\x20"
// #define APP_DEBUG
#define APP_DEBUG
enum editorKey_e {
BACKSPACE = 127,
@@ -29,4 +31,12 @@ enum editorKey_e {
#define BELUGA_VERSION "2.4"
#ifdef __APPLE__
#define CLIPBOARD_COPY_CMD "pbcopy"
#define CLIPBOARD_PASTE_CMD "pbpaste"
#else
#define CLIPBOARD_COPY_CMD "xclip -selection clipboard"
#define CLIPBOARD_PASTE_CMD "xclip -selection clipboard -o"
#endif
#endif // DEFINE_H_
+4 -3
View File
@@ -3,10 +3,11 @@
#include "data.h"
void bufferInsertNewLine();
void bufferInsertBytes(char *src, int n);
void editorSetStatusMessage(const char *fmt, ...);
void bufferDelBytes();
int editorRowCharCount(row_t *row, int x);
int editorRowCxToByte(const row_t *row, int cursor_x);
char *editorGetClipboard(void);
void editorSetClipboard(const char *text, int len);
#endif // EDITOR_OP_H_
-2
View File
@@ -2,8 +2,6 @@
#define FILE_IO_H_
#include "data.h"
#include "row_op.h"
#include "terminal.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
+1 -1
View File
@@ -22,7 +22,7 @@
char *editorPrompt(char *prompt, char * PlaceHolder, char bPathMode);
const char *file_completion(const char *path);
const char *fileCompletion(const char *path);
int editorMoveCursor(int key);
+3 -6
View File
@@ -8,11 +8,8 @@
#include <time.h>
#include <unistd.h>
void bufferInsertRow(struct buffer_t *buffer, int at, char *s, size_t len);
int editorRowCxToByte(const row_t *row, int cursor_x);
void bufferFreeRow(row_t *row);
int editorRowCharCount(row_t *row, int x);
void bufferRowInsertBytes(struct buffer_t *buffer, row_t *row, int at, char *src, int n);
void bufferRowDelByte(struct buffer_t *buffer, row_t *row, int at, int n);
#endif // ROW_OP_H_
-2
View File
@@ -1,7 +1,6 @@
#ifndef SYNTAX_HIGHLIGHTER_H_
#define SYNTAX_HIGHLIGHTER_H_
#include "color.h"
// Color codes that only affect foreground, preserving your background color
#define COLOR_RESET "\x1b[39m" // Reset all (4 bytes)
@@ -20,4 +19,3 @@ typedef enum {
char *highlight_line(const char * line, int *length);
#endif
+1 -3
View File
@@ -4,8 +4,6 @@
/* includes */
#include "data.h"
#include "define.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -31,7 +29,7 @@ int getCursorPosition(int *rows, int *cols);
int getWindowSize(int *rows, int *cols);
char *key_to_string(int key);
char *keyToString(int key);
void appDebug(const char *fmt, ...);