aboutsummaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-10-17 12:51:13 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-10-17 14:15:31 +0200
commitbd354843c2751ec6c7b5b85ef08f9145f6232e6e (patch)
tree384528ba3c384160b5a07159f7e49fe6efdd0f01 /editor.c
parent9c4999fc9ee4a071bba068e68d690ba637ec28f5 (diff)
downloadvis-bd354843c2751ec6c7b5b85ef08f9145f6232e6e.tar.gz
vis-bd354843c2751ec6c7b5b85ef08f9145f6232e6e.tar.xz
Read stdin when given - as filename
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/editor.c b/editor.c
index 4af96d9..f0123c9 100644
--- a/editor.c
+++ b/editor.c
@@ -365,6 +365,17 @@ bool editor_window_new(Editor *ed, const char *filename) {
return true;
}
+bool editor_window_new_fd(Editor *ed, int fd) {
+ Text *txt = text_load_fd(fd);
+ if (!txt)
+ return false;
+ EditorWin *win = editor_window_new_text(ed, txt);
+ if (!win)
+ return false;
+ editor_draw(ed);
+ return true;
+}
+
static void editor_window_detach(Editor *ed, EditorWin *win) {
if (win->prev)
win->prev->next = win->next;