seanohalpin / ffi-ncurses

Interface to ncurses using Ruby FFI (Foreign Function Interface)
MIT License
82 stars 21 forks source link

Some (ACS_...) characters not showing as expected #14

Open fwolfst opened 8 years ago

fwolfst commented 8 years ago

Hi,

While playing with https://github.com/mare-imbrium/canis I noticed "wrong" characters being displayed. The output of the ffi-ncurses asc_chars.rb example shows (first two lines)

Upper left corner           6
Lower left corner           ^@

If I compile a ncurses-binary directly:

#include <ncurses.h>
int main(void)
    {
    initscr();
    attron(A_UNDERLINE);
    mvprintw(0,7,"NCURSES EXTENDED CHARACTERS\n");
    attroff(A_UNDERLINE);
    printw("Upper left corner         "); addch(ACS_ULCORNER); printw("  ACS_ULCORNER\n");
    printw("Lower left corner         "); addch(ACS_LLCORNER); printw("  ACS_LLCORNER\n");
    // ....

The output looks more correct to me:

NCURSES EXTENDED CHARACTERS
Upper left corner         ┌  ACS_ULCORNER
Lower left corner         └  ACS_LLCORNER

This happens in the same shell, reproducible independent of execution order. How can we further debug this?

fwolfst commented 8 years ago

If I access the constant ACS_HLINE via a screen it produces the correct output, btw (but not ACS_ULCORNER).

def main
  begin
    scr = initscr
    scr.mvhline(1,1, ACS_HLINE, 4);
    scr.mvhline(2,1, ACS_ULCORNER, 4);
    refresh
    getch
# ...

Will print

 ────
 6666
fwolfst commented 8 years ago

Btw, I use (L)Ubuntu 14.04 64Bit, LXTerminal 0.1.11 (but it happens in XTerm etc, too)

$ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
$ rvm --version
rvm 1.26.11 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

And examples/getsetsyx.rb works fine (shows box with corners).

fwolfst commented 8 years ago

Packages installed (dpkg -l | grep ncurses)

ii  libncurses5:amd64                           5.9+20140118-1ubuntu1                    amd64        shared libraries for terminal handling
ii  libncurses5:i386                            5.9+20140118-1ubuntu1                    i386         shared libraries for terminal handling
ii  libncurses5-dev:amd64                       5.9+20140118-1ubuntu1                    amd64        developer's libraries for ncurses
ii  libncursesw5:amd64                          5.9+20140118-1ubuntu1                    amd64        shared libraries for terminal handling (wide character support)
ii  libncursesw5-dev:amd64                      5.9+20140118-1ubuntu1                    amd64        developer's libraries for ncursesw
ii  mtr-tiny                                    0.85-2                                   amd64        Full screen ncurses traceroute tool
ii  ncurses-base                                5.9+20140118-1ubuntu1                    all          basic terminal type definitions
ii  ncurses-bin                                 5.9+20140118-1ubuntu1                    amd64        terminal-related programs and man pages
ii  ncurses-term                                5.9+20140118-1ubuntu1                    all          additional terminal type definitions
seanohalpin commented 8 years ago

Hi Felix,

Thanks for this bug report. You might have noticed that I have not been updating ffi-ncurses for a while. I have recently had a change of circumstance which leaves me some free time for the first time in years. I am looking forward to fixing the problems you have so thoroughly documented (for which thank you). I'll also be addressing all other issues with ffi-ncurses and updating the gem within the next couple of weeks.

Best regards, Sean

On Fri, Jan 15, 2016 at 10:06 AM, Felix Wolfsteller < notifications@github.com> wrote:

Packages installed (dpkg -l | grep ncurses)

ii libncurses5:amd64 5.9+20140118-1ubuntu1 amd64 shared libraries for terminal handling ii libncurses5:i386 5.9+20140118-1ubuntu1 i386 shared libraries for terminal handling ii libncurses5-dev:amd64 5.9+20140118-1ubuntu1 amd64 developer's libraries for ncurses ii libncursesw5:amd64 5.9+20140118-1ubuntu1 amd64 shared libraries for terminal handling (wide character support) ii libncursesw5-dev:amd64 5.9+20140118-1ubuntu1 amd64 developer's libraries for ncursesw ii mtr-tiny 0.85-2 amd64 Full screen ncurses traceroute tool ii ncurses-base 5.9+20140118-1ubuntu1 all basic terminal type definitions ii ncurses-bin 5.9+20140118-1ubuntu1 amd64 terminal-related programs and man pages ii ncurses-term 5.9+20140118-1ubuntu1 all additional terminal type definitions

— Reply to this email directly or view it on GitHub https://github.com/seanohalpin/ffi-ncurses/issues/14#issuecomment-171907158 .

fwolfst commented 8 years ago

Great to hear that, thanks. Tell me if you need more information.

fwolfst commented 8 years ago

Output of locale:

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
zatherz commented 7 years ago

Bump.