Search code examples
cmacosdialogncurses

Incorrect aspect of TUI dialogs in OSX


I am testing the dialog.h library with this simple C program on OSX 10.15.7 (Catalina):

#include <stdio.h>
#include <dialog.h>


int main() {
  int status;
  
  init_dialog (stdin, stdout);
  status = dialog_yesno (
    "Hello",
    "Hello World!",
    0, 
    0
  );
  end_dialog();

  return status;
}

This is my Makefile

PRG    = test_dialog
BREW   = /usr/local/Cellar
DIALOG = ${BREW}/dialog/1.3-20220728

CC     = gcc -Wall -Wextra -Werror -Wpedantic -std=c11 \
    -D_XOPEN_SOURCE_EXTENDED \
    -I${DIALOG}/include \
    -I/opt/local/include \
    -L${DIALOG}/lib \
    -L/opt/local/lib/ \
    -ldialog -lncursesw -lm

prg:
    ${CC} -o ${PRG} ${PRG}.c
    
clean:
    rm -f .DS_Store *.o ${PRG}%  

The program runs but it renders the dialogs poorly, missing some borders:

Screen capture

I have read How to use dialog.h in a c program and, consecuently, tested with ncurses and ncursesw libraries, but the problem persists.

Any idea about this?


Solution

  • That's terminal-specific (color palette). dialog is coloring the upper/left borders in "bold-white" (e.g., color 15) and the box background in "white" (color 7), but Terminal.app's default palette makes them the same. (Other palettes, other terminals will differ).