~kaction/dvtm

626406e201f812cd6af53c91131a8ffcc8b80701 — Dmitry Bogatov 7 months ago 311a8c0
Add support for "smam" and "rmam" capabilities

These capabilities enable (default) and disable long line wrapping
on next line. Wrapping may mess alignment and make reading harder,
disabling wrapping makes part of line beyond buffer width inaccessible.

The original impetus for this functionality is that fzy(1) fuzzy matcher
uses no-wrap feature, or its menu get messed on long lines.
2 files changed, 10 insertions(+), 0 deletions(-)

M dvtm.info
M vt.c
M dvtm.info => dvtm.info +2 -0
@@ 106,6 106,7 @@ dvtm|dynamic virtual terminal manager,
	ri=\EM,
	ritm=\E[23m,
	rmacs=^O,
	rmam=\E[?7l,
	rmcup=\E[2J\E[?47l\E8,
	rmir=\E[4l,
	rmso=\E[27m,


@@ 121,6 122,7 @@ dvtm|dynamic virtual terminal manager,
	sgr0=\E[m\017,
	sitm=\E[3m,
	smacs=^N,
	smam=\E[?7h,
	smcup=\E7\E[?47h,
	smir=\E[4h,
	smso=\E[7m,

M vt.c => vt.c +8 -0
@@ 184,6 184,7 @@ struct Vt {
	unsigned mousetrack:1;
	unsigned graphmode:1;
	unsigned savgraphmode:1;
	unsigned truncate:1;
	bool charsets[2];
	/* buffers and parsing state */
	char rbuf[BUFSIZ];


@@ 962,6 963,9 @@ static void interpret_csi_priv_mode(Vt *t, int param[], int pcount, bool set)
		case 6: /* set origin to relative/absolute (DECOM) */
			t->relposmode = set;
			break;
		case 7:
			t->truncate = !set;
			break;
		case 25: /* make cursor visible/invisible (DECCM) */
			t->curshid = !set;
			break;


@@ 1379,6 1383,10 @@ static void put_wc(Vt *t, wchar_t wc)
		}

		if (b->curs_col >= b->cols) {
			if (t->truncate && wc != '\n') {
				b->curs_col++;
				return;
			}
			b->curs_col = 0;
			cursor_line_down(t);
		}