Search code examples
unicodencursescurses

Ncurses no-wrap mode when adding strings to window


I'm adding strings to a window, with waddwstr() function, one line after other, in consecutive rows. I don't want ncurses to automatically wrap lines for me – I'm overwriting them with consecutive calls to waddwstr() and sometimes tail of previous line is left displaying. Can ncurses just stop when right edge of window is reached?


Solution

  • The non-wrapping functions have "ch" in their name, e.g., wadd_wchstr.

    The same is true of the non-wide interfaces waddstr versus waddchstr.

    However, the wrapping/non-wrapping functions differ by more than that. They use different parameter types. The wrapping functions rely upon the video attributes set via wattr_set, etc., while the non-wrapping functions combine the video-attributes with the character data:

    Converting between the two forms can be a nuisance, because X/Open, etc., did not define functions for doing the conversion.

    The manual page for bkgd describes how these video attributes are combined with the background character to obtain the actual display.