From ba4c1f84b89b845f78f61dbe923ef2d2983e9d7f Mon Sep 17 00:00:00 2001 From: Dajo Frey Date: Fri, 1 Dec 2023 22:46:15 +0100 Subject: [PATCH] Fix some tiling issues. Remove sidebar. Increments-patch-version-of: ttyr-tty --- build/data/misc/ttyr-tty.conf | 1 - src/lib/ttyr-tty/Common/Config.c | 25 ++-- src/lib/ttyr-tty/Common/Config.h | 12 -- .../ttyr-tty/Common/Data/ttyr-tty.conf.inc | 48 ++++---- src/lib/ttyr-tty/TTY/ContextMenu.c | 113 ++++++++++-------- src/lib/ttyr-tty/TTY/Draw.c | 25 +--- src/lib/ttyr-tty/TTY/Draw.h | 2 +- src/lib/ttyr-tty/TTY/Macro.c | 1 - src/lib/ttyr-tty/TTY/Micro.c | 2 +- src/lib/ttyr-tty/TTY/Tiling.c | 15 ++- src/lib/ttyr-tty/TTY/View.c | 11 -- 11 files changed, 115 insertions(+), 140 deletions(-) diff --git a/build/data/misc/ttyr-tty.conf b/build/data/misc/ttyr-tty.conf index fcf45f8..28ada36 100644 --- a/build/data/misc/ttyr-tty.conf +++ b/build/data/misc/ttyr-tty.conf @@ -1,4 +1,3 @@ -ttyr.tty.sidebar.state:0; ttyr.tty.shell.maxScroll:10000; ttyr.tty.windows:9; ttyr.tty.tabs:3; diff --git a/src/lib/ttyr-tty/Common/Config.c b/src/lib/ttyr-tty/Common/Config.c index 0738be3..0f7ceb0 100644 --- a/src/lib/ttyr-tty/Common/Config.c +++ b/src/lib/ttyr-tty/Common/Config.c @@ -24,7 +24,6 @@ // NAMES =========================================================================================== const NH_BYTE *TTYR_TTY_SETTING_NAMES_PP[] = { - "ttyr.tty.sidebar.state", "ttyr.tty.shell.maxScroll", "ttyr.tty.windows", "ttyr.tty.tabs", @@ -63,50 +62,46 @@ TTYR_TTY_BEGIN() switch (*index_p) { case 0 : - if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} - Config_p->Sidebar.state = atoi(Values_p->pp[0]); - break; - case 1 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Shell.maxScroll = atoi(Values_p->pp[0]); break; - case 2 : + case 1 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->windows = atoi(Values_p->pp[0]); break; - case 3 : + case 2 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->tabs = atoi(Values_p->pp[0]); break; - case 4 : + case 3 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.program = atoi(Values_p->pp[0]); break; - case 5 : + case 4 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.split = atoi(Values_p->pp[0]); break; - case 6 : + case 5 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.append = atoi(Values_p->pp[0]); break; - case 7 : + case 6 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.window = atoi(Values_p->pp[0]); break; - case 8 : + case 7 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.tab = atoi(Values_p->pp[0]); break; - case 9 : + case 8 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.close = atoi(Values_p->pp[0]); break; - case 10 : + case 9 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Menu.debug = atoi(Values_p->pp[0]); break; - case 11 : + case 10 : if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)} Config_p->Titlebar.on = atoi(Values_p->pp[0]); break; diff --git a/src/lib/ttyr-tty/Common/Config.h b/src/lib/ttyr-tty/Common/Config.h index 5f75f2e..3740e07 100644 --- a/src/lib/ttyr-tty/Common/Config.h +++ b/src/lib/ttyr-tty/Common/Config.h @@ -19,14 +19,7 @@ * @{ */ - typedef enum TTYR_TTY_SIDEBAR_STATE_E { - TTYR_TTY_SIDEBAR_STATE_OFF, - TTYR_TTY_SIDEBAR_STATE_LEFT, - TTYR_TTY_SIDEBAR_STATE_RIGHT, - } TTYR_TTY_SIDEBAR_STATE_E; - typedef enum TTYR_TTY_SETTING_E { - TTYR_TTY_SETTING_SIDEBAR_TYPE, TTYR_TTY_SETTING_SHELL_MAX_SCROLL, TTYR_TTY_SETTING_WINDOWS, TTYR_TTY_SETTING_TABS, @@ -56,10 +49,6 @@ NH_BOOL debug; } ttyr_tty_MenuConfig; - typedef struct ttyr_tty_SidebarConfig { - TTYR_TTY_SIDEBAR_STATE_E state; - } ttyr_tty_SidebarConfig; - typedef struct ttyr_tty_TitlebarConfig { NH_BOOL on; } ttyr_tty_TitlebarConfig; @@ -70,7 +59,6 @@ typedef struct ttyr_tty_Config { NH_BYTE *name_p; - ttyr_tty_SidebarConfig Sidebar; ttyr_tty_TitlebarConfig Titlebar; ttyr_tty_ShellConfig Shell; ttyr_tty_MenuConfig Menu; diff --git a/src/lib/ttyr-tty/Common/Data/ttyr-tty.conf.inc b/src/lib/ttyr-tty/Common/Data/ttyr-tty.conf.inc index d4c0362..8a74599 100644 --- a/src/lib/ttyr-tty/Common/Data/ttyr-tty.conf.inc +++ b/src/lib/ttyr-tty/Common/Data/ttyr-tty.conf.inc @@ -1,27 +1,25 @@ unsigned char ttyr_tty_conf_inc[] = { - 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x73, 0x69, 0x64, - 0x65, 0x62, 0x61, 0x72, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x30, - 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x73, - 0x68, 0x65, 0x6c, 0x6c, 0x2e, 0x6d, 0x61, 0x78, 0x53, 0x63, 0x72, 0x6f, - 0x6c, 0x6c, 0x3a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x74, 0x74, - 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, - 0x77, 0x73, 0x3a, 0x39, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, - 0x74, 0x79, 0x2e, 0x74, 0x61, 0x62, 0x73, 0x3a, 0x33, 0x3b, 0x0a, 0x74, - 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, - 0x2e, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x3a, 0x31, 0x3b, 0x0a, - 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, - 0x75, 0x2e, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x3a, 0x31, 0x3b, 0x0a, 0x74, - 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, - 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x3a, 0x31, 0x3b, 0x0a, 0x74, - 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, - 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x3a, 0x30, 0x3b, 0x0a, 0x74, - 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, - 0x2e, 0x74, 0x61, 0x62, 0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, - 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, - 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x64, 0x65, 0x62, - 0x75, 0x67, 0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, - 0x74, 0x79, 0x2e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x62, 0x61, 0x72, 0x2e, - 0x6f, 0x6e, 0x3a, 0x30, 0x3b, 0x0a + 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x73, 0x68, 0x65, + 0x6c, 0x6c, 0x2e, 0x6d, 0x61, 0x78, 0x53, 0x63, 0x72, 0x6f, 0x6c, 0x6c, + 0x3a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, + 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, + 0x3a, 0x39, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, + 0x2e, 0x74, 0x61, 0x62, 0x73, 0x3a, 0x33, 0x3b, 0x0a, 0x74, 0x74, 0x79, + 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x70, + 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, + 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, + 0x73, 0x70, 0x6c, 0x69, 0x74, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, 0x79, + 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x61, + 0x70, 0x70, 0x65, 0x6e, 0x64, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, 0x79, + 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x77, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, + 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x74, + 0x61, 0x62, 0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, + 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x63, 0x6c, 0x6f, 0x73, + 0x65, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, + 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, + 0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, + 0x2e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x62, 0x61, 0x72, 0x2e, 0x6f, 0x6e, + 0x3a, 0x30, 0x3b, 0x0a }; -unsigned int ttyr_tty_conf_inc_len = 282; +unsigned int ttyr_tty_conf_inc_len = 256; diff --git a/src/lib/ttyr-tty/TTY/ContextMenu.c b/src/lib/ttyr-tty/TTY/ContextMenu.c index 315b651..7ccaa51 100644 --- a/src/lib/ttyr-tty/TTY/ContextMenu.c +++ b/src/lib/ttyr-tty/TTY/ContextMenu.c @@ -371,8 +371,7 @@ ttyr_tty_ContextMenu *ttyr_tty_isContextMenuHit( { TTYR_TTY_BEGIN() - ttyr_tty_Config Config = ttyr_tty_getConfig(); - int x2 = Config.Sidebar.state == TTYR_TTY_SIDEBAR_STATE_LEFT ? x + 2 : x; + int x2 = x; int y2 = Menu_p->Position.y; int width = 0; @@ -480,7 +479,9 @@ TTYR_TTY_BEGIN() ttyr_tty_TTY *TTY_p = nh_core_getWorkloadArg(); ttyr_tty_Config Config = ttyr_tty_getConfig(); - if (Config.Menu.program && TTY_p->Prototypes.size > 0) { + bool border = false; + + if (Config.Menu.program && TTY_p->Prototypes.size > 1) { ttyr_tty_Program *Program_p = ttyr_tty_getCurrentProgram(&TTYR_TTY_MACRO_TAB(TTY_p->Window_p->Tile_p)->MicroWindow); NH_ENCODING_UTF32 apps_p[] = {PROGRAM_NAME '{'}; nh_encoding_appendUTF32(&Menu, apps_p, sizeof(apps_p)/sizeof(apps_p[0])); @@ -502,72 +503,89 @@ TTYR_TTY_BEGIN() } nh_encoding_appendUTF32Codepoint(&Menu, '}'); nh_encoding_appendUTF32Codepoint(&Menu, ','); + border = true; } if (Config.Menu.split) { + if (border) { + nh_encoding_appendUTF32Codepoint(&Menu, ','); + } NH_ENCODING_UTF32 tiling_p[] = { - ',', 'S', 'p', 'l', 'i', 't', '{', + 'S', 'p', 'l', 'i', 't', '{', 'W', 'i', 'n', 'd', 'o', 'w', ',', 'T', 'a', 'b', '}', ',', }; nh_encoding_appendUTF32(&Menu, tiling_p, sizeof(tiling_p)/sizeof(tiling_p[0])); + border = true; } if (Config.Menu.append) { + if (border && !Config.Menu.split) { + nh_encoding_appendUTF32Codepoint(&Menu, ','); + } NH_ENCODING_UTF32 tiling_p[] = { - ',', 'A', 'p', 'p', 'e', 'n', 'd', '{', + 'A', 'p', 'p', 'e', 'n', 'd', '{', 'W', 'i', 'n', 'd', 'o', 'w', ',', 'T', 'a', 'b', '}', ',', }; - nh_encoding_appendUTF32(&Menu, Config.Menu.split ? tiling_p+1 : tiling_p, Config.Menu.split ? sizeof(tiling_p)/sizeof(tiling_p[0])-1 : sizeof(tiling_p)/sizeof(tiling_p[0])); - } - - if (Config.Menu.window) { - NH_ENCODING_UTF32 tmp1_p[] = {',', 'W', 'i', 'n', 'd', 'o', 'w', '{'}; - nh_encoding_appendUTF32(&Menu, tmp1_p, 7); - for (int i = 0; i < Config.windows; ++i) { - NH_ENCODING_UTF32 tmp2_p[] = {i + '1', 1, ' '}; - if (nh_core_getListIndex(&TTY_p->Windows, TTY_p->Window_p) == i) { - tmp2_p[2] = 0x2022; - } - nh_encoding_appendUTF32(&Menu, tmp2_p, 3); - if (i < (Config.windows-1)) { - nh_encoding_appendUTF32Codepoint(&Menu, ','); - } else { - nh_encoding_appendUTF32Codepoint(&Menu, '}'); - nh_encoding_appendUTF32Codepoint(&Menu, ','); - } - } - } - - if (Config.Menu.tab) { - NH_ENCODING_UTF32 tmp3_p[] = {',', 'T', 'a', 'b', '{'}; - nh_encoding_appendUTF32(&Menu, Config.Menu.window ? tmp3_p+1 : tmp3_p , Config.Menu.window ? 3 : 4); - for (int i = 0; i < Config.tabs; ++i) { - NH_ENCODING_UTF32 tmp2_p[] = {i + '1', 1, ' '}; - if (((ttyr_tty_MacroTile*)TTY_p->Window_p->Tile_p->p)->current == i) { - tmp2_p[2] = 0x2022; - } - nh_encoding_appendUTF32(&Menu, tmp2_p, 3); - if (i < (Config.tabs-1)) { - nh_encoding_appendUTF32Codepoint(&Menu, ','); - } else { - nh_encoding_appendUTF32Codepoint(&Menu, '}'); - nh_encoding_appendUTF32Codepoint(&Menu, ','); - } - } - } + nh_encoding_appendUTF32(&Menu, tiling_p, sizeof(tiling_p)/sizeof(tiling_p[0])); + border = true; + } + +// if (Config.Menu.window) { +// NH_ENCODING_UTF32 tmp1_p[] = {',', 'W', 'i', 'n', 'd', 'o', 'w', '{'}; +// nh_encoding_appendUTF32(&Menu, tmp1_p, 7); +// for (int i = 0; i < Config.windows; ++i) { +// NH_ENCODING_UTF32 tmp2_p[] = {i + '1', 1, ' '}; +// if (nh_core_getListIndex(&TTY_p->Windows, TTY_p->Window_p) == i) { +// tmp2_p[2] = 0x2022; +// } +// nh_encoding_appendUTF32(&Menu, tmp2_p, 3); +// if (i < (Config.windows-1)) { +// nh_encoding_appendUTF32Codepoint(&Menu, ','); +// } else { +// nh_encoding_appendUTF32Codepoint(&Menu, '}'); +// nh_encoding_appendUTF32Codepoint(&Menu, ','); +// } +// } +// } +// +// if (Config.Menu.tab) { +// NH_ENCODING_UTF32 tmp3_p[] = {',', 'T', 'a', 'b', '{'}; +// nh_encoding_appendUTF32(&Menu, Config.Menu.window ? tmp3_p+1 : tmp3_p , Config.Menu.window ? 3 : 4); +// for (int i = 0; i < Config.tabs; ++i) { +// NH_ENCODING_UTF32 tmp2_p[] = {i + '1', 1, ' '}; +// if (((ttyr_tty_MacroTile*)TTY_p->Window_p->Tile_p->p)->current == i) { +// tmp2_p[2] = 0x2022; +// } +// nh_encoding_appendUTF32(&Menu, tmp2_p, 3); +// if (i < (Config.tabs-1)) { +// nh_encoding_appendUTF32Codepoint(&Menu, ','); +// } else { +// nh_encoding_appendUTF32Codepoint(&Menu, '}'); +// nh_encoding_appendUTF32Codepoint(&Menu, ','); +// } +// } +// } if (Config.Menu.close) { - NH_ENCODING_UTF32 close_p[] = {',', 'C', 'l', 'o', 's', 'e', ',', 0}; - nh_encoding_appendUTF32(&Menu, close_p, 7); + if (border) { + nh_encoding_appendUTF32Codepoint(&Menu, ','); + } + NH_ENCODING_UTF32 close_p[] = {'C', 'l', 'o', 's', 'e', ','}; + nh_encoding_appendUTF32(&Menu, close_p, sizeof(close_p)/sizeof(close_p[0])); + border = true; } if (Config.Menu.debug) { - NH_ENCODING_UTF32 debug_p[] = {',', 'D', 'e', 'b', 'u', 'g', '{', 0}; - nh_encoding_appendUTF32(&Menu, debug_p, 7); + if (border) { + nh_encoding_appendUTF32Codepoint(&Menu, ','); + } + + NH_ENCODING_UTF32 debug_p[] = {'D', 'e', 'b', 'u', 'g', '{', 0}; + nh_encoding_appendUTF32(&Menu, debug_p, sizeof(debug_p)/sizeof(debug_p[0])); NH_ENCODING_UTF32 x_p[16]; NH_ENCODING_UTF32 y_p[16]; @@ -603,7 +621,6 @@ TTYR_TTY_BEGIN() nh_encoding_appendUTF8ToUTF32(&Menu, Glyph.Attributes.wide ? "Attr.wide:1}" : "Attr.wide:0}", 12); nh_encoding_appendUTF32Codepoint(&Menu, '}'); - nh_encoding_appendUTF32Codepoint(&Menu, ','); } NH_ENCODING_UTF32 *p = Menu.p; diff --git a/src/lib/ttyr-tty/TTY/Draw.c b/src/lib/ttyr-tty/TTY/Draw.c index 65729bd..429d4f1 100644 --- a/src/lib/ttyr-tty/TTY/Draw.c +++ b/src/lib/ttyr-tty/TTY/Draw.c @@ -65,9 +65,6 @@ TTYR_TTY_BEGIN() *y_p += MacroTile_p->rowPosition; } - ttyr_tty_Config Config = ttyr_tty_getConfig(); - *x_p += Config.Sidebar.state != TTYR_TTY_SIDEBAR_STATE_OFF && !standardIO ? 2 : 0; - TTYR_TTY_DIAGNOSTIC_END(TTYR_TTY_SUCCESS) } @@ -226,14 +223,12 @@ TTYR_TTY_END(TTYR_TTY_SUCCESS) } TTYR_TTY_RESULT ttyr_tty_refreshGrid1Row( - nh_List *Tiles_p, ttyr_tty_View *View_p, int row, NH_BOOL sidebar) + nh_List *Tiles_p, ttyr_tty_View *View_p, int row) { TTYR_TTY_BEGIN() - sidebar = sidebar && !View_p->standardIO; - memset(View_p->Row.Glyphs_p, 0, sizeof(ttyr_tty_Glyph)*View_p->cols); - int offset = sidebar ? 2 : 0; + int offset = 0; for (int col = offset; col < View_p->cols;) { for (int tile = 0; tile < Tiles_p->size; ++tile) { @@ -265,12 +260,6 @@ TTYR_TTY_BEGIN() } } - if (sidebar) { - TTYR_TTY_CHECK(ttyr_tty_drawSideBarRow(View_p->Grid1_p[row].Glyphs_p, row, View_p->rows)) - View_p->Grid1_p[row].update_p[0] = NH_TRUE; - View_p->Grid1_p[row].update_p[1] = NH_TRUE; - } - TTYR_TTY_CHECK(ttyr_tty_postProcessRow(View_p, row)) TTYR_TTY_END(TTYR_TTY_SUCCESS) @@ -283,13 +272,13 @@ TTYR_TTY_BEGIN() ttyr_tty_View *View_p = TTY_p->Views.pp[0]; ttyr_tty_Config Config = ttyr_tty_getConfig(); - int offset = Config.Sidebar.state != TTYR_TTY_SIDEBAR_STATE_OFF && !View_p->standardIO ? 2 : 0; + int offset = 0; ttyr_tty_updateTiling(TTY_p->Window_p->RootTile_p, View_p->rows, View_p->cols-offset); nh_List Tiles = ttyr_tty_getTiles(TTY_p->Window_p->RootTile_p); for (int row = 0; row < View_p->rows; ++row) { - TTYR_TTY_CHECK(ttyr_tty_refreshGrid1Row(&Tiles, View_p, row, Config.Sidebar.state != TTYR_TTY_SIDEBAR_STATE_OFF)) + TTYR_TTY_CHECK(ttyr_tty_refreshGrid1Row(&Tiles, View_p, row)) } nh_core_freeList(&Tiles, NH_FALSE); @@ -311,12 +300,6 @@ TTYR_TTY_BEGIN() } TTYR_TTY_CHECK(ttyr_tty_drawContextMenuRecursively(TTY_p->Window_p->MouseMenu_p, View_p->Grid2_p)) - - ttyr_tty_Config Config = ttyr_tty_getConfig(); - if (Config.Sidebar.state && View_p->cols > 0) { - View_p->Grid2_p[nh_core_getListIndex(&TTY_p->Windows, TTY_p->Window_p)].Glyphs_p[0].Attributes.reverse = 1; - } - TTYR_TTY_CHECK(ttyr_tty_forwardGrid2(View_p)) TTYR_TTY_END(TTYR_TTY_SUCCESS) diff --git a/src/lib/ttyr-tty/TTY/Draw.h b/src/lib/ttyr-tty/TTY/Draw.h index 425131f..8e150c3 100644 --- a/src/lib/ttyr-tty/TTY/Draw.h +++ b/src/lib/ttyr-tty/TTY/Draw.h @@ -31,7 +31,7 @@ ); TTYR_TTY_RESULT ttyr_tty_refreshGrid1Row( - nh_List *Tiles_p, ttyr_tty_View *View_p, int row, NH_BOOL sidebar + nh_List *Tiles_p, ttyr_tty_View *View_p, int row ); TTYR_TTY_RESULT ttyr_tty_getCursorPosition( diff --git a/src/lib/ttyr-tty/TTY/Macro.c b/src/lib/ttyr-tty/TTY/Macro.c index 428c78c..d99c8a8 100644 --- a/src/lib/ttyr-tty/TTY/Macro.c +++ b/src/lib/ttyr-tty/TTY/Macro.c @@ -414,7 +414,6 @@ TTYR_TTY_BEGIN() nh_List MacroTiles = ttyr_tty_getTiles(Window_p->RootTile_p); ttyr_tty_Config Config = ttyr_tty_getConfig(); - if (Config.Sidebar.state != TTYR_TTY_SIDEBAR_STATE_OFF) {col -= 2;} int cCol = col; int cCol2 = col; diff --git a/src/lib/ttyr-tty/TTY/Micro.c b/src/lib/ttyr-tty/TTY/Micro.c index 5db8e6e..f46c59b 100644 --- a/src/lib/ttyr-tty/TTY/Micro.c +++ b/src/lib/ttyr-tty/TTY/Micro.c @@ -182,7 +182,7 @@ TTYR_TTY_BEGIN() nh_List Tiles = ttyr_tty_getTiles(RootTile_p); TTYR_TTY_CHECK(ttyr_tty_updateView(Window_p->View_p, NULL, NH_FALSE)) - TTYR_TTY_CHECK(ttyr_tty_refreshGrid1Row(&Tiles, Window_p->View_p, row, NH_FALSE)) + TTYR_TTY_CHECK(ttyr_tty_refreshGrid1Row(&Tiles, Window_p->View_p, row)) memcpy(Glyphs_p, Window_p->View_p->Grid1_p[row].Glyphs_p, sizeof(ttyr_tty_Glyph)*cols); nh_core_freeList(&Tiles, NH_FALSE); diff --git a/src/lib/ttyr-tty/TTY/Tiling.c b/src/lib/ttyr-tty/TTY/Tiling.c index b5582cf..0f5e6a6 100644 --- a/src/lib/ttyr-tty/TTY/Tiling.c +++ b/src/lib/ttyr-tty/TTY/Tiling.c @@ -661,8 +661,11 @@ TTYR_TTY_BEGIN() case TTYR_TTY_INSERT_TILE_LEFT_KEY : case TTYR_TTY_INSERT_TILE_RIGHT_KEY : - ttyr_tty_moveInsertTile(TTY_p->InsertTile_p, c); - break; + if (TTY_p->InsertTile_p) { + ttyr_tty_moveInsertTile(TTY_p->InsertTile_p, c); + break; + } + // Fall through. default : TTYR_TTY_CHECK(ttyr_tty_resetTiling(Window_p)) @@ -726,7 +729,9 @@ TTYR_TTY_BEGIN() if (Window_p->Tile_p->Parent_p == NULL) { TTYR_TTY_CHECK(ttyr_tty_splitTile(Window_p->Tile_p, c)) } else { - TTYR_TTY_CHECK(ttyr_tty_addTile(Window_p->Tile_p, c)) + if (ttyr_tty_addTile(Window_p->Tile_p, c)) { + TTYR_TTY_END(ttyr_tty_resetTiling(Window_p)) + } } Window_p->Tiling.stage = TTYR_TTY_TILING_STAGE_INSERT; TTYR_TTY_CHECK(ttyr_tty_updateTilingMessages(Window_p)) @@ -781,7 +786,9 @@ TTYR_TTY_BEGIN() if (TTYR_TTY_MICRO_TAB(TTYR_TTY_MACRO_TAB(Window_p->Tile_p))->Tile_p->Parent_p == NULL) { TTYR_TTY_CHECK(ttyr_tty_splitTile(TTYR_TTY_MICRO_TAB(TTYR_TTY_MACRO_TAB(Window_p->Tile_p))->Tile_p, c)) } else { - TTYR_TTY_CHECK(ttyr_tty_addTile(TTYR_TTY_MICRO_TAB(TTYR_TTY_MACRO_TAB(Window_p->Tile_p))->Tile_p, c)) + if (ttyr_tty_addTile(TTYR_TTY_MICRO_TAB(TTYR_TTY_MACRO_TAB(Window_p->Tile_p))->Tile_p, c)) { + TTYR_TTY_END(ttyr_tty_resetTiling(Window_p)) + } } Window_p->Tiling.stage = TTYR_TTY_TILING_STAGE_INSERT; TTYR_TTY_CHECK(ttyr_tty_updateTilingMessages(Window_p)) diff --git a/src/lib/ttyr-tty/TTY/View.c b/src/lib/ttyr-tty/TTY/View.c index 97ee0ef..81e3d36 100644 --- a/src/lib/ttyr-tty/TTY/View.c +++ b/src/lib/ttyr-tty/TTY/View.c @@ -372,17 +372,6 @@ TTYR_TTY_BEGIN() } nh_core_freeList(&MacroTiles, NH_FALSE); - // Forward boxes: Sidebar. - for (int i = 0; Config.Sidebar.state && i < Config.windows; ++i) { - ttyr_terminal_Box *Box_p = nh_core_incrementArray(Boxes_p); - memset(Box_p, 0, sizeof(ttyr_terminal_Box)); - Box_p->accent = NH_TRUE; - Box_p->UpperLeft.x = -1; - Box_p->UpperLeft.y = i; - Box_p->LowerRight.x = -1; - Box_p->LowerRight.y = i; - } - TTYR_TTY_END(TTYR_TTY_SUCCESS) }