dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 7b96e9b6f9d3cf8e3059d923f28b2b3ac21af50e
parent d8950b933c79e0b4baa2061d63f809522c2da6dd
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 24 Oct 2014 20:35:50 +0200

Instruct editor to display same viewport

Diffstat:
dvtm.c | 6+++++-
vt.c | 4++++
vt.h | 1+
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dvtm.c b/dvtm.c @@ -837,7 +837,7 @@ copymode(const char *args[]) { if (!(sel->editor = vt_create(sel->h - sel->has_title_line, sel->w, 0))) return; - char *ed = getenv("DVTM_EDITOR"); + char *ed = getenv("DVTM_EDITOR"), argline[32]; const char **argv; const char *cwd = NULL; const char *env[] = { "DVTM", VERSION, NULL }; @@ -852,6 +852,10 @@ copymode(const char *args[]) { ed = editor; argv = editor_args; } + if (!strcmp(ed, "vis") || !strcmp(ed, "vim") || !strcmp(ed, "less")) { + snprintf(argline, sizeof(argline), "+%d", vt_content_start(sel->app)); + argv = (const char*[]){ ed, argline, "-", NULL }; + } if (!strcmp(ed, "vis")) from = &sel->editor_fds[1]; if (vt_forkpty(sel->editor, ed, argv, cwd, env, to, from) < 0) { diff --git a/vt.c b/vt.c @@ -1869,3 +1869,7 @@ size_t vt_content_get(Vt *t, char **buf) { return s - *buf; } + +int vt_content_start(Vt *t) { + return t->buffer->scroll_above; +} diff --git a/vt.h b/vt.h @@ -62,5 +62,6 @@ void vt_togglebell(Vt*); pid_t vt_pid_get(Vt*); size_t vt_content_get(Vt*, char **s); +int vt_content_start(Vt*); #endif /* VT_H */