Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 466
Jerry Epas Avatar asked Oct 31 '22 16:10

Jerry Epas


1 Answers

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:

  • waddstr and waddchstr use char* and chtype* parameters, respectively
  • waddwstr and wadd_chstr use wchar_t* and cchar_t* parameters.

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.

like image 200
Thomas Dickey Avatar answered Nov 08 '22 07:11

Thomas Dickey