From a30802d1a370a5ca2b28f13a34833965345d2bdf Mon Sep 17 00:00:00 2001
From: Able <abl3theabove@gmail.com>
Date: Mon, 17 Feb 2025 17:08:59 -0600
Subject: [PATCH] adit docs + cleanup

---
 sysdata/programs/adit/src/editor.hb | 12 +++++++++++-
 sysdata/programs/adit/src/main.hb   | 13 ++++++-------
 sysdata/programs/adit/src/rope.hb   |  7 +++++++
 3 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/sysdata/programs/adit/src/editor.hb b/sysdata/programs/adit/src/editor.hb
index 24ffa22..663cbeb 100644
--- a/sysdata/programs/adit/src/editor.hb
+++ b/sysdata/programs/adit/src/editor.hb
@@ -2,6 +2,8 @@ theme := @use("theme.hb")
 render := @use("lib:render")
 sunset := @use("lib:sunset_proto")
 assets := @use("assets.hb")
+stn := @use("stn")
+
 
 Editor := struct {
 	msg: ?^u8,
@@ -22,7 +24,7 @@ Editor := struct {
 		window_height := 400
 		window := sunset.client.new(.(.(60, 40), .(window_width, window_height), "Adit"))
 		if window == null {
-			// log.error("got no window")
+			stn.log.error("got no window")
 			die 
 		}
 		return Self.(null, assets.Assets.new() true, .(.(0x88, 0xF4, 0xFC, 0x0), render.YELLOW, render.BLACK, 10), window)
@@ -52,8 +54,16 @@ Editor := struct {
 		}
 	}
 
+	frame_render := fn(self: Self): void {
+		// TODO: Render text here with a loop to iterate through Ropes.
 
 
+		if self.line_lines self.theme_render()
+	}
+
+	handle_input := fn(self: Self): void {
+		// input := memory.inb(96)
+	}
 
 	map_keys := fn(scancode: u8): u8 {
 		// if is_shift_pressed {
diff --git a/sysdata/programs/adit/src/main.hb b/sysdata/programs/adit/src/main.hb
index 941bdeb..00f0d10 100644
--- a/sysdata/programs/adit/src/main.hb
+++ b/sysdata/programs/adit/src/main.hb
@@ -56,16 +56,15 @@ main := fn(): void {
 
 	loop {
 		// +++ Clear +++
-		editor.clear()
+		// editor.clear()
+
 		// +++ Input +++
-		input := memory.inb(96)
+		editor.handle_input()
+
 
 		// +++ RENDER +++
-
-		if editor.line_lines editor.theme_render()
-		// window.surface.clear(bg_color)
-
-
+		editor.frame_render()
+		// if editor.line_lines editor.theme_render()
 		editor.frame_sync()
 	}
 }
\ No newline at end of file
diff --git a/sysdata/programs/adit/src/rope.hb b/sysdata/programs/adit/src/rope.hb
index f4e561c..3b38b49 100644
--- a/sysdata/programs/adit/src/rope.hb
+++ b/sysdata/programs/adit/src/rope.hb
@@ -1,3 +1,10 @@
+/*! A Rope is a very special data structure
+ 			that can quickly append split and represent a single editors line worth of text.
+
+	Inspo:
+	-	https://github.com/kavirajk/rope
+*/
+
 Node := struct {
 	weight: uint,
 	left: ?^Leaf,