dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

Julia interface for Notcurses #2714

Closed kdheepak closed 1 year ago

kdheepak commented 1 year ago

I've started putting together a Julia interface for Notcurses: https://github.com/kdheepak/Notcurses.jl

As you may already know, Julia https://julialang.org/ is a interactive, high performance, dynamic programming language. It has a pretty powerful ffi functionality and can use that to invoke functions exposed as in the C ABI of a shared library.

I was able to use Clang.jl to autogenerate a number of bindings based on the header files provided in this repository.

However, when I call notcurses_init I get a dump to stdin that appears to be the status of the terminal (terminal name, background color, foreground color etc).

Here's the code:

using Notcurses

nc = Notcurses.LibNotcurses.notcurses_init(C_NULL, C_NULL)
Notcurses.LibNotcurses.notcurses_stop(nc)

image

Is this expected? Just calling notcurses_init doesn't appear to switch to the alternate screen as well.

I just wanted to check if this means anything to you? I'm using MacOS with ITerm2.

I wasn't able to test with Python (had installation issues) but my plan is to test with Rust or Nim to see if I get the same behavior and report back here.

dankamongmen commented 1 year ago

However, when I call notcurses_init I get a dump to stdin that appears to be the status of the terminal (terminal name, background color, foreground color etc).

what i see in your output is a bunch of ansi codes, related to setting default colors and the palette. you definitely ought not be seeing these; it's either a configuration bug on your side, or a bug on mine.

kdheepak commented 1 year ago

I have TERM set to xterm-256color.

What can I do to debug this? Any suggestions?

kdheepak commented 1 year ago

Thanks to @KristofferC, I believe this is resolved for me. It seems like I have to set the environment variable for TERMINFO otherwise I get this issue. In @KristofferC's version, Ncurses's is used since apparently it bundles the terminfo databases.

I guess that raises the question of whether Notcurses should bundle terminfo databases as well? But I'm happy to close this issue now.