summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-29 22:33:31 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-29 22:33:31 -0500
commit55fd631d86769e719f81206901bc1c3fb598fb5e (patch)
treeeca599d625d8d55d03c2d793e5f85d51f712a2c2 /main.c
parent3cc173dd38e85c751bb1a9f9288ebe974e567ba4 (diff)
quitting, closing tabs
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.c b/main.c
index 7cb7f06..c7e12f7 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,8 @@
// @TODO:
// - when closing tabs/window, warn on unsaved changes
-// - try opening a file you don't have read permission for
+// - try opening a file you don't have read permission for -- check for memory leaks!
+
+// - show something informative when there's no nodes open (i.e. ted->active_node == NULL).
// - split
// - Windows installation
#include "base.h"
@@ -42,7 +44,7 @@ no_warn_end
#include "string32.c"
#include "arr.c"
#include "buffer.c"
-#include "ted-base.c"
+#include "ted.c"
#include "ui.c"
#include "node.c"
#include "command.c"
@@ -271,8 +273,7 @@ int main(int argc, char **argv) {
Uint32 time_at_last_frame = SDL_GetTicks();
- bool quit = false;
- while (!quit) {
+ while (!ted->quit) {
#if DEBUG
//printf("\033[H\033[2J");
#endif
@@ -312,7 +313,7 @@ int main(int argc, char **argv) {
| (u32)alt_down << KEY_MODIFIER_ALT_BIT;
switch (event.type) {
case SDL_QUIT:
- quit = true;
+ command_execute(ted, CMD_QUIT, 1);
break;
case SDL_MOUSEWHEEL: {
// scroll with mouse wheel
@@ -476,7 +477,7 @@ int main(int argc, char **argv) {
Font *font = ted->font;
{
- float x1 = 50, y1 = 50, x2 = window_width-50, y2 = window_height-50;
+ float x1 = 25, y1 = 25, x2 = window_width-25, y2 = window_height-25;
Node *node = ted->root;
node_frame(ted, node, rect4(x1, y1, x2, y2));
}