Major codebase cleanup and overhaul.

+ editor removes per-buffer fields.
+ switching from internal use of 'int' to 'size_t'.
+ deleting old code
+ double checking relevancy of comments. A lot has changed in
  5 years, even more so in the past week.
+ fixing a few vestigal memory errors from the overhaul.
+ fixing search behavior
This commit is contained in:
2025-11-28 11:31:40 -08:00
parent 7b20e9ee37
commit a9bcb0d36b
13 changed files with 937 additions and 1005 deletions

View File

@@ -1,5 +1,5 @@
#ifndef EDITOR_H
#define EDITOR_H
#ifndef KE_EDITOR_H
#define KE_EDITOR_H
#include <termios.h>
#include <time.h>
@@ -9,32 +9,19 @@
#include "buffer.h"
/* TODO(kyle): remove the "per-buffer" fields completely from the editor. */
struct editor {
int rows, cols;
int curx, cury; /* per-buffer */
int rx; /* per-buffer */
size_t rows, cols;
int mode;
int nrows; /* per-buffer */
int rowoffs, coloffs; /* per-buffer */
abuf *row; /* per-buffer */
abuf *killring;
int kill; /* KILL CHAIN (\m/) */
int no_kill; /* don't kill in delete_row */
char *filename; /* per-buffer */
int dirty; /* per-buffer */
int dirtyex;
char msg[80];
int mark_set; /* per-buffer */
int mark_curx, mark_cury; /* per-buffer */
int uarg, ucount; /* C-u support */
time_t msgtm;
/* Multi-buffer support */
struct buffer **buffers; /* array of buffers */
int bufcount; /* number of buffers */
int curbuf; /* current buffer index */
size_t bufcount; /* number of buffers */
size_t curbuf; /* current buffer index */
size_t bufcap; /* current buffer capacity */
};
@@ -45,4 +32,4 @@ void init_editor(void);
void reset_editor(void);
#endif /* EDITOR_H */
#endif /* KE_EDITOR_H */