jeaye/ncurses-rs

ncurses behaves strangely on printw("x%s")

skylaner opened this issue · 2 comments

This is what gets printed:

xx%s

It should have printed:

x%s
jeaye commented

This is indeed strange! Have you learned any more about the issue?

Related to #164 : in printw, the % sign is interpreted as in a format-string; printw expects an extra argument to replace %s with. This argument is not given (because rust doesn't have variadic functions), so this is essentially unsafe as ncurses will just use whichever memory it wants. Apparently printw finds the "x%s" literal you just defined and uses that, but it could just as well segfault or eat your laundry.
The printw method should really at least be marked as unsafe, and probably removed entirely since there's no way to use it properly. You're much better off using addstr instead.