yterm

commit 90511f25ca1a12be400cd34f6b907f6e60cac37e

Author: mesyeti <mesyeti@mesyeti.uk>

add terminal title

 source/app.c | 5 +++++
 source/interpreter/vt100.c | 4 ++--
 source/terminal.c | 2 ++
 source/terminal.h | 1 +


diff --git a/source/app.c b/source/app.c
index 21a29ceafee71ab75e5c8994b23387de72d62152..54249c6eccf8a8b2ea410997f13bc5ae454c84db 100644
--- a/source/app.c
+++ b/source/app.c
@@ -93,6 +93,11 @@
 		Buffer_Print(&screen.buffer, screen.buffer.width - strlen(time), 0, bar.attr, time);
 	}
 
+	char* title  = app.paneSel->v.terminal.title;
+	int   titleX = (screen.buffer.width / 2) - (strlen(title) / 2);
+
+	Buffer_Print(&screen.buffer, titleX, 0, bar.attr, title);
+
 	Rect within = {0, 1, screen.buffer.width, screen.buffer.height - 1};
 	Pane_Render(&app.tabs[app.tabSel], within);
 




diff --git a/source/interpreter/vt100.c b/source/interpreter/vt100.c
index be950a61ccf834a65283ff06e74a6bc07fa5c3a2..992142da03ce765f547d0d0ab0d71200b4c14e55 100644
--- a/source/interpreter/vt100.c
+++ b/source/interpreter/vt100.c
@@ -478,8 +478,8 @@
 	switch (func) {
 		case 0:
 		case 2: {
-			// TODO: implement
-			Log("Terminal title = %s", parts[1]);
+			free(terminal->title);
+			terminal->title = NewString(parts[1]);
 			break;
 		}
 		default: {




diff --git a/source/terminal.c b/source/terminal.c
index 7596b8265349bcee63b26ec6ed1417dd42d56959..72b8a652fd76b598895f6700656a4cdd3bfc934e 100644
--- a/source/terminal.c
+++ b/source/terminal.c
@@ -1,4 +1,5 @@
 #include "mem.h"
+#include "util.h"
 #include "terminal.h"
 #include "interpreter.h"
 #include "interpreter/vt100.h"
@@ -10,6 +11,7 @@ 	ret.scroll = ret.cursor.y;
 	ret.height = h;
 	ret.attr   = BufAttr_Default();
 	ret.buffer = Buffer_New(w, 1000);
+	ret.title  = NewString("yterm");
 
 	bool success2;
 	ret.term = SysTerm_New(&success2, w, h);




diff --git a/source/terminal.h b/source/terminal.h
index 7027ff71bb1f15d8932c179aa0772733aa8c0652..1251d0301539a7252cd6ee5cf4e29424826cf398 100644
--- a/source/terminal.h
+++ b/source/terminal.h
@@ -14,6 +14,7 @@ 	SysTerm term;
 	void*   interpreter; // Interpreter*
 	int     height;
 	int     scroll;
+	char*   title;
 
 	// terminal options
 	bool blinkCursor;