+ /*
+ * We should always check the screensize, just in case.
+ */
+ _nc_set_screen(sp);
+ sp->_term = cur_term;
+#ifdef USE_TERM_DRIVER
+ TCBOf(sp)->csp = sp;
+ _nc_get_screensize(sp, sp->_term, &slines, &scolumns);
+#else
+ _nc_get_screensize(sp, &slines, &scolumns);
+#endif
+ SET_LINES(slines);
+ SET_COLS(scolumns);
+
+ T((T_CREATE("screen %s %dx%d"),
+ NCURSES_SP_NAME(termname) (NCURSES_SP_ARG), slines, scolumns));
+
+ sp->_filtered = filtered;
+
+ /* implement filter mode */
+ if (filtered) {
+ slines = 1;
+ SET_LINES(slines);
+#ifdef USE_TERM_DRIVER
+ CallDriver(sp, td_setfilter);
+#else
+ /* *INDENT-EQLS* */
+ clear_screen = ABSENT_STRING;
+ cursor_address = ABSENT_STRING;
+ cursor_down = ABSENT_STRING;
+ cursor_up = ABSENT_STRING;
+ parm_down_cursor = ABSENT_STRING;
+ parm_up_cursor = ABSENT_STRING;
+ row_address = ABSENT_STRING;
+ cursor_home = carriage_return;
+
+ if (back_color_erase)
+ clr_eos = ABSENT_STRING;
+
+#endif
+ T(("filter screensize %dx%d", slines, scolumns));
+ }
+#ifdef __DJGPP__
+ T(("setting output mode to binary"));
+ fflush(output);
+ setmode(output, O_BINARY);
+#endif
+ NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_ARGx output, TRUE);
+ sp->_lines = (NCURSES_SIZE_T) slines;
+ sp->_lines_avail = (NCURSES_SIZE_T) slines;
+ sp->_columns = (NCURSES_SIZE_T) scolumns;
+
+ fflush(output);
+ sp->_ofd = output ? fileno(output) : -1;
+ sp->_ofp = output;
+ sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns));
+ if ((sp->out_buffer = malloc(sp->out_limit)) == 0)
+ sp->out_limit = 0;
+ sp->out_inuse = 0;
+
+ SP_PRE_INIT(sp);
+ SetNoPadding(sp);
+