//sets up the initial configuration of curses. Keeps code in main cleaner. func configCurses(stdscr *gc.Window) { if !gc.HasColors() { log.Fatal("Example requires a colour capable terminal") } if err := gc.StartColor(); err != nil { log.Fatal("Starting Colors failed:", err) } gc.Echo(false) if err := gc.InitPair(1, gc.C_RED, gc.C_BLACK); err != nil { log.Fatal("InitPair failed: ", err) } gc.InitPair(2, gc.C_BLUE, gc.C_BLACK) gc.InitPair(3, gc.C_GREEN, gc.C_BLACK) gc.InitPair(4, gc.C_YELLOW, gc.C_BLACK) gc.InitPair(5, gc.C_CYAN, gc.C_BLACK) gc.InitPair(6, gc.C_MAGENTA, gc.C_WHITE) gc.InitPair(7, gc.C_MAGENTA, gc.C_BLACK) //set background color to black stdscr.SetBackground(gc.Char(' ') | gc.ColorPair(0)) stdscr.Keypad(true) gc.Cursor(1) gc.CBreak(true) stdscr.Clear() }
// Function to call to update the information in the information Window. func displayInfo(win *gc.Window, active, activeA int, userItems []*gc.MenuItem, userArticles map[string][]articleType) { win.Clear() win.MovePrint(1, 0, "Auteur : ", userItems[active].Name()) win.MovePrint(2, 0, "Date : ", userArticles[userItems[active].Name()][activeA].date) win.MovePrint(4, 0, userArticles[userItems[active].Name()][activeA].url) win.Refresh() }