Пример #1
0
/*
 * ip_clrtoeol --
 *	Clear from the current cursor to the end of the line.
 *
 * PUBLIC: int ip_clrtoeol __P((SCR *));
 */
int
ip_clrtoeol(SCR *sp)
{
	IP_BUF ipb;
 	IP_PRIVATE *ipp = IPP(sp);
 
 	/* Temporary hack until we can pass screen pointers
 	 * or name screens
 	 */
 	if (IS_VSPLIT(sp)) {
 		size_t x, y, spcnt;
 		IP_PRIVATE *ipp;
 		int error;
 
 		ipp = IPP(sp);
 		y = ipp->row;
 		x = ipp->col;
 		error = 0;
 		for (spcnt = sp->cols - x; 
 		     spcnt > 0 && ! error; --spcnt)
 			error = ip_addstr(sp, " ", 1);
 		if (sp->coff == 0)
 			error |= ip_addstr(sp, "|", 1);
 		error |= ip_move(sp, y, x);
 		return error;
 	}

	ipb.code = SI_CLRTOEOL;

	return (vi_send(ipp->o_fd, NULL, &ipb));
}
Пример #2
0
/*
 * cl_clrtoeol --
 *	Clear from the current cursor to the end of the line.
 *
 * PUBLIC: int cl_clrtoeol __P((SCR *));
 */
int
cl_clrtoeol(SCR *sp)
{
	WINDOW *win;
	size_t spcnt, y, x;

	win = CLSP(sp) ? CLSP(sp) : stdscr;

#if 0
	if (IS_VSPLIT(sp)) {
		/* The cursor must be returned to its original position. */
		getyx(win, y, x);
		for (spcnt = (sp->coff + sp->cols) - x; spcnt > 0; --spcnt)
			(void)waddch(win, ' ');
		(void)wmove(win, y, x);
		return (0);
	} else
#endif
		return (wclrtoeol(win) == ERR);
}