• ncursesw narrows my screen. What am I missing?

    From Andrew T.@21:1/5 to All on Fri Oct 13 00:32:33 2023
    Hi all,

    I've been developing a curses gemini client in C. It works fine
    linked with ncurses (-lncurses at link time), but I'm now trying to
    switch to ncursesw for wide character/utf-8 support. I figured
    there'd be some bugs for be to track down, but the first one has me
    stumped.

    With no other changes other than the library linking, when I start the
    program, everything is cut off at the 20 column mark (on an 80
    character screen). I've tried this on the linux console, Eterm, and
    uxterm all with the same result. If I set the environment variable
    COLUMNS=320 (4*80), I get the full screen, except some functions (like
    box() ) now really think the window is 320 columns.

    Am I missing something here?

    I'm using ncurses 6.0 and gcc 6.3.0 from the Devuan Ascii distribution
    (old, I know, but Ascii's been working fine for me), along with the panel library for most (all) of my window areas. Could it be a bug is 6.0?

    Searching online, I've make sure to call setlocale(LC_ALL, "") and set
    my locale information correctly (and UTF-8 gemini pages do display
    correctly with COLUMNS=320).

    I'm using ncursesw5-config for CFLAGS and libraries in my Makefile.

    I've included the following in each .c file:

    #define _XOPEN_SOURCE 800 /* Also tried 600 and leaving out */ #define _XOPEN_SOURCE_EXTENDED 1

    and many other attempted tweaks.

    The basic flow of the program, curses-wise, is:
    int main() {
    setlocale(LC_ALL, ""); /* first call in main() */
    initScreen();
    /* Run */
    }

    void initScreen() {
    initscr();
    mainwin = stdscr; /* Redundant, I know */
    getmaxyx(mainwin, my, mx);
    /* Create panels/windows for page, statbar and input bar */
    initHelp(); /* Init help window (hidden for now) */
    initStatbar();
    }


    I'm at a loss as to what I'm missing. Any ideas where to look or what
    I may be missing?

    Thanks in advance,
    --Andrew


    --
    Andrew Turnquist, Short Tract, New York, USA (USDA Zone 5)
    ... wandering the streets of Usenet ...
    (Remove numbers and .invalid for email address)
    "Do what you can with what you have where you are." -T Roosevelt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Edwards@21:1/5 to Andrew T. on Fri Oct 13 01:15:21 2023
    On 2023-10-13, Andrew T. <and4y2@turnquist.name.invalid> wrote:

    I've been developing a curses gemini client in C. It works fine
    linked with ncurses (-lncurses at link time), but I'm now trying to
    switch to ncursesw for wide character/utf-8 support. I figured
    there'd be some bugs for be to track down, but the first one has me
    stumped.

    Have you tried asking on the ncurses mailing lists?

    https://lists.gnu.org/archive/html/bug-ncurses/
    https://lists.gnu.org/archive/html/help-ncurses/

    The latter seems to be rather dead, but the bug list is active.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew T.@21:1/5 to Andrew T. on Mon Oct 16 00:35:55 2023
    On 2023-10-13, Andrew T. <and4y2@turnquist.name.invalid> wrote:

    With no other changes other than the library linking, when I start the program, everything is cut off at the 20 column mark (on an 80
    character screen). I've tried this on the linux console, Eterm, and
    uxterm all with the same result. If I set the environment variable COLUMNS=320 (4*80), I get the full screen, except some functions (like
    box() ) now really think the window is 320 columns.

    Am I missing something here?

    Yes, I was missing something. It took just the right incantation on StartDuckDuckGooglePage (something like ncursesw panel). I'd call it
    a documentation bug/shortcoming.

    I am also using the panel library, and it turns out there are
    wide-character versions of the auxiliary curses libraries as well.
    They are not mentioned in the man pages (as far as I can see).

    So the simple solution: When using libncursesw, you must also use the
    'w' versions of the auxiliary libraries (panel, menu, form). My old
    LIBS variable in my Makefile was (roughly):

    LIBS = -lpanel -lncursesw # Wrong (mixing versions)

    It needs to be:

    LIBS = -lpanelw -lncursesw # Right (all are 'w' versions)

    and then everything just started working. I should probably report it
    as a documentation bug...

    --Andrew


    --
    Andrew Turnquist, Short Tract, New York, USA (USDA Zone 5)
    ... wandering the streets of Usenet ...
    (Remove numbers and .invalid for email address)
    "Do what you can with what you have where you are." -T Roosevelt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)