From: jxnshi Date: Wed, 1 Jan 2025 19:54:43 +0000 (+0100) Subject: Update X-Git-Url: https://jxnshi.xyz/repos?a=commitdiff_plain;h=b73678379b9222fa1035ebed0efbd52215bbe953;p=mesange.git Update --- b73678379b9222fa1035ebed0efbd52215bbe953 diff --cc client-cli/main.odin index 2b6a629,3acd4e5..6627da0 --- a/client-cli/main.odin +++ b/client-cli/main.odin @@@ -13,13 -11,14 +13,17 @@@ import "core:thread import fpath "core:path/filepath" -import nc "ncurses" +import nc "../ncurses" -import "../common" +COLOR_FIRST :: 16 +COLOR_SECOND :: 17 +COLOR_THIRD :: 18 +COLOR_FOURTH :: 19 + COLOR_FIRST :: 16 + COLOR_SECOND :: 17 + COLOR_THIRD :: 18 + Config :: struct { selected_profile: Maybe(string), } @@@ -93,11 -88,9 +97,17 @@@ app_init :: proc() -> App nc.init_color(COLOR_FIRST, 800, 800, 800) nc.init_color(COLOR_SECOND, 500, 500, 500) ++<<<<<<< HEAD + nc.init_color(COLOR_THIRD, 200, 200, 200) + nc.init_color(COLOR_FOURTH, 000, 000, 000) + + nc.init_pair(1, COLOR_FIRST, COLOR_THIRD) + nc.init_pair(2, COLOR_FIRST, COLOR_FOURTH) ++======= + nc.init_color(COLOR_THIRD, 100, 100, 100) + + nc.init_pair(1, nc.COLOR_WHITE, COLOR_THIRD) ++>>>>>>> refs/remotes/origin/master screen_height, screen_width := nc.getmaxyx(screen) @@@ -119,8 -112,6 +129,11 @@@ } app := App{ ++<<<<<<< HEAD + running = true, + ++======= ++>>>>>>> refs/remotes/origin/master screen = screen, storage_path = storage_path, @@@ -128,7 -119,7 +141,11 @@@ input_window = input_window, } ++<<<<<<< HEAD + app_clear_info_bar(app) ++======= + app_set_state(&app, .Load_Config) ++>>>>>>> refs/remotes/origin/master return app } @@@ -150,23 -141,20 +167,35 @@@ app_set_state :: proc(app: ^App, state nc.clear() nc.refresh() ++<<<<<<< HEAD ++======= + app_clear_box_message(app) ++>>>>>>> refs/remotes/origin/master app_clear_info_bar(app^) app.state = state } app_set_info_bar :: proc(app: ^App, content: string) { ++<<<<<<< HEAD + app_clear_info_bar(app^) + + c_content := strings.clone_to_cstring(content, context.temp_allocator) + + nc.wattron(app.info_bar, nc.COLOR_PAIR(1)) + nc.wprintw(app.info_bar, c_content) + nc.wattroff(app.info_bar, nc.COLOR_PAIR(1)) + + nc.wrefresh(app.info_bar) ++======= + c_content := strings.clone_to_cstring(content, context.temp_allocator) + + color := nc.COLOR_PAIR(1) + + nc.wattron(app.info_bar, color) + nc.wprintw(app.info_bar, c_content) + nc.wattroff(app.info_bar, color) ++>>>>>>> refs/remotes/origin/master } app_set_box_message :: proc(app: ^App, lines: []string) { @@@ -191,9 -179,9 +220,15 @@@ (screen_width - width) / 2, ) ++<<<<<<< HEAD + color := nc.COLOR_PAIR(2) + + nc.wattron(box_message, color) ++======= + nc.refresh() + + nc.wattron(box_message, COLOR_FIRST) ++>>>>>>> refs/remotes/origin/master for line, i in lines { c_line := strings.clone_to_cstring(line, context.temp_allocator) @@@ -201,7 -189,7 +236,11 @@@ } nc.box(box_message, 0, 0) ++<<<<<<< HEAD + nc.wattroff(box_message, color) ++======= + nc.wattroff(box_message, COLOR_FIRST) ++>>>>>>> refs/remotes/origin/master nc.wrefresh(box_message) @@@ -212,16 -198,18 +251,31 @@@ app_clear_info_bar :: proc(app: App) { height, width := nc.getmaxyx(app.info_bar) ++<<<<<<< HEAD + color := nc.COLOR_PAIR(1) + + nc.wclear(app.info_bar) + nc.wattron(app.info_bar, color) + + for _ in 0..>>>>>> refs/remotes/origin/master nc.wrefresh(app.info_bar) } @@@ -246,9 -231,11 +300,15 @@@ app_get_input :: proc(app: App, allocat screen_height, screen_width := nc.getmaxyx(app.screen) nc.curs_set(1) ++<<<<<<< HEAD + nc.wgetnstr(app.input_window, raw_data(buffer[:]), len(buffer)) ++======= + nc.mvwgetnstr(app.input_window, 0, 0, raw_data(buffer[:]), len(buffer)) ++>>>>>>> refs/remotes/origin/master nc.curs_set(0) + nc.wclear(app.input_window) + return strings.clone_from_cstring(cstring(raw_data(&buffer))) }