vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit e18cb20b2e22a9f74499f0cd68194cea59ca86f6
parent 694cdeb2aa192504170b6b37122999199f5b842f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 30 May 2017 10:35:35 +0200

ui: reopen terminal read-writeable

libtermkey fails if the terminal file descriptor is read only.
This should fix the `v` command in less(1).

Diffstat:
Mui-terminal.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui-terminal.c b/ui-terminal.c @@ -649,7 +649,7 @@ static bool ui_init(Ui *ui, Vis *vis) { errno = 0; if (!(tui->termkey = ui_termkey_new(STDIN_FILENO))) { /* work around libtermkey bug which fails if stdin is /dev/null */ - if (errno == EBADF && !isatty(STDIN_FILENO)) { + if (errno == EBADF) { errno = 0; if (!(tui->termkey = ui_termkey_reopen(ui, STDIN_FILENO)) && errno == ENXIO) tui->termkey = termkey_new_abstract(term, UI_TERMKEY_FLAGS);