Ejemplo n.º 1
0
Archivo: layer.c Proyecto: amade/screen
void LCDisplayLineWrap(Layer *l, struct mline *ml, int y, int from, int to, int isblank)
{
	struct mchar nc;
	copy_mline2mchar(&nc, ml, 0);
	if (dw_left(ml, 0, l->l_encoding)) {
		nc.mbcs = ml->image[1];
		from++;
	}
	LWrapChar(l, &nc, y - 1, -1, -1, false);
	from++;
	if (from <= to)
		LCDisplayLine(l, ml, y, from, to, isblank);
}
Ejemplo n.º 2
0
Archivo: mark.c Proyecto: meh/screen
static void MarkRedisplayLine(int y, int xs, int xe, int isblank)
/* NOTE: y is in DISPLAY coords system! */
{
	int wy, x, i, rm;
	int sta, sto, cp;	/* NOTE: these 3 are in WINDOW coords system */
	uint32_t *wi;
	struct mline *ml;
	struct mchar mchar_marked;

	if (y < 0)		/* No special full page handling */
		return;

	markdata = (struct markdata *)flayer->l_data;
	fore = markdata->md_window;

	mchar_marked = mchar_so;

	wy = D2W(y);
	ml = WIN(wy);

	if (markdata->second == 0) {
		if (dw_right(ml, xs, fore->w_encoding) && xs > 0)
			xs--;
		if (dw_left(ml, xe, fore->w_encoding) && xe < fore->w_width - 1)
			xe++;
		if (xs == 0 && y > 0 && wy > 0 && WIN(wy - 1)->image[flayer->l_width] == 0)
			LCDisplayLineWrap(flayer, ml, y, xs, xe, isblank);
		else
			LCDisplayLine(flayer, ml, y, xs, xe, isblank);
		return;
	}

	sta = markdata->y1 * fore->w_width + markdata->x1;
	sto = markdata->cy * fore->w_width + markdata->cx;
	if (sta > sto) {
		i = sta;
		sta = sto;
		sto = i;
	}
	cp = wy * fore->w_width + xs;

	rm = markdata->right_mar;
	for (x = fore->w_width, wi = ml->image + fore->w_width; x >= 0; x--, wi--)
		if (*wi != ' ')
			break;
	if (x < rm)
		rm = x;

	for (x = xs; x <= xe; x++, cp++)
		if (cp >= sta && x >= markdata->left_mar)
			break;
	if (dw_right(ml, x, fore->w_encoding))
		x--;
	if (x > xs)
		LCDisplayLine(flayer, ml, y, xs, x - 1, isblank);
	for (; x <= xe; x++, cp++) {
		if (cp > sto || x > rm)
			break;
		if (pastefont) {
			mchar_marked.font = ml->font[x];
			mchar_marked.fontx = ml->fontx[x];
		}
		mchar_marked.image = ml->image[x];
		mchar_marked.mbcs = 0;
		if (dw_left(ml, x, fore->w_encoding)) {
			mchar_marked.mbcs = ml->image[x + 1];
			cp++;
		}
		LPutChar(flayer, &mchar_marked, x, y);
		if (dw_left(ml, x, fore->w_encoding))
			x++;
	}
	if (x <= xe)
		LCDisplayLine(flayer, ml, y, x, xe, isblank);
}