commit 619c368f03ae26b664d436da96873852c0321813
parent 387b0392a0ff0b4aba9c730440913335074bb118
Author: rexim <reximkut@gmail.com>
Date: Tue, 10 Jan 2023 22:50:42 +0700
Cleanup
Diffstat:
3 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/editor.c b/src/editor.c
@@ -35,23 +35,22 @@ void editor_delete(Editor *e)
editor_recompute_lines(e);
}
-Errno editor_save_as(Editor *editor, const char *file_path)
+Errno editor_save_as(Editor *e, const char *file_path)
{
- Errno err = write_entire_file(file_path, editor->data.items, editor->data.count);
+ Errno err = write_entire_file(file_path, e->data.items, e->data.count);
if (err != 0) return err;
- editor->file_path.count = 0;
- sb_append_cstr(&editor->file_path, file_path);
- sb_append_null(&editor->file_path);
+ e->file_path.count = 0;
+ sb_append_cstr(&e->file_path, file_path);
+ sb_append_null(&e->file_path);
return 0;
}
-Errno editor_save(const Editor *editor)
+Errno editor_save(const Editor *e)
{
- assert(editor->file_path.count > 0);
- return write_entire_file(editor->file_path.items, editor->data.items, editor->data.count);
+ assert(e->file_path.count > 0);
+ return write_entire_file(e->file_path.items, e->data.items, e->data.count);
}
-
Errno editor_load_from_file(Editor *e, const char *file_path)
{
e->data.count = 0;
diff --git a/src/file_browser.c b/src/file_browser.c
@@ -1,7 +1,7 @@
#include <string.h>
#include "file_browser.h"
-int file_cmp(const void *ap, const void *bp)
+static int file_cmp(const void *ap, const void *bp)
{
const char *a = *(const char**)ap;
const char *b = *(const char**)bp;
diff --git a/src/main.c b/src/main.c
@@ -25,11 +25,6 @@
#define FPS 60
#define DELTA_TIME (1.0f / FPS)
-void usage(FILE *stream)
-{
- fprintf(stream, "Usage: te [FILE-PATH]\n");
-}
-
// TODO: Save file dialog
// Needed when ded is ran without any file so it does not know where to save.
// TODO: File Manager
@@ -62,7 +57,6 @@ static File_Browser fb = {0};
static Uint32 last_stroke = 0;
#define FREE_GLYPH_FONT_SIZE 64
-#define ZOOM_OUT_GLYPH_THRESHOLD 30
void render_file_browser(SDL_Window *window, Free_Glyph_Atlas *atlas, Simple_Renderer *sr, const File_Browser *fb)
{
@@ -277,7 +271,7 @@ int main(int argc, char **argv)
}
SDL_Window *window =
- SDL_CreateWindow("Text Editor",
+ SDL_CreateWindow("ded",
0, 0,
SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);