Files
arthur 3d49a0e2eb
Build project / build (push) Has been cancelled
copy paste functions
2026-05-26 08:28:38 +02:00

53 lines
1.2 KiB
C

/**
* \file main.c
* \author Arthur Barraux
* \brief Base file of Beluga text editor. Contain fonctions for terminal
* interactions. \version 0.1 \date 21 septembre 2024
*/
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#define _GNU_SOURCE
#include "include/buffer.h"
#include "include/split_screen.h"
#include <string.h>
#include <unistd.h>
#include "include/data.h"
#include "include/init.h"
#include "include/input.h"
#include "include/editor_op.h"
#include "include/terminal.h"
struct editorConfig E;
int main(int argc, char *argv[]) {
char * splash_screen = (char *) calloc(256, sizeof(char));
enableRawMode();
initEditor();
if (argc >= 2) {
EditorPane *active = splitScreenGetActivePane();
active->buffer_id = bufferCreate(argv[1], READ_AND_WRITE);
} else {
strcat(splash_screen, getenv("HOME"));
strcat(splash_screen, "/.beluga/assets/beluga.txt");
appDebug("splash : %s\n", splash_screen);
EditorPane *active = splitScreenGetActivePane();
active->buffer_id = bufferCreate(splash_screen, READ_ONLY);
}
free(splash_screen);
editorSetStatusMessage("HELP: Ctrl-x Ctrl-s = save | Ctrl-x Ctrl-c = quit");
while (1) {
editorRefreshScreen();
editorProcessKeypress();
}
return 0;
}