Method: Curses.addstr

Defined in:
ext/curses/curses.c

.addstr(str) ⇒ Object

add a string of characters str, to the window and advance cursor



823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
# File 'ext/curses/curses.c', line 823

static VALUE
curses_addstr(VALUE obj, VALUE str)
{
    StringValue(str);
#if defined(HAVE_ADDNWSTR) && defined(_WIN32)
    str = rb_str_export_to_enc(str, get_wide_encoding());
    curses_stdscr();
    if (!NIL_P(str)) {
  addnwstr((wchar_t *)RSTRING_PTR(str), RSTRING_LEN(str) / sizeof(wchar_t));
    }
#else
    str = rb_str_export_to_enc(str, terminal_encoding);
    curses_stdscr();
    if (!NIL_P(str)) {
  addstr(StringValueCStr(str));
    }
#endif
    return Qnil;
}