]> jxnshi.xyz Git - mesange.git/commitdiff
Update
authorjxnshi <jxnshi@cock.li>
Wed, 1 Jan 2025 19:54:43 +0000 (20:54 +0100)
committerjxnshi <jxnshi@cock.li>
Wed, 1 Jan 2025 19:54:43 +0000 (20:54 +0100)
1  2 
client-cli/main.odin

index 2b6a6298fe1210d9e57b8edd05f76f749ce6230d,3acd4e54fcf50f98ea1e456541f9b31248af23b8..6627da019f6a56d24aa1bf68a91d57825e2700ad
@@@ -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)
  
      }
  
      app := App{
++<<<<<<< HEAD
 +        running = true,
 +
++=======
++>>>>>>> refs/remotes/origin/master
          screen = screen,
          storage_path = storage_path,
  
          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) {
          (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)
      }
  
      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)
  
  
  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..<width {
 +        nc.waddch(app.info_bar, ' ')
 +    }
 +
 +    nc.wattroff(app.info_bar, color)
++=======
+       color := nc.COLOR_PAIR(1)
+     nc.wclear(app.info_bar)
+     
+       nc.wattron(app.info_bar, color)
+       for _ in 0..<width {
+           nc.waddch(app.info_bar, ' ')
+       }
+       
+       nc.wattroff(app.info_bar, color)
++>>>>>>> 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)))
  }