]> git.mdlowis.com Git - projs/tide.git/commitdiff
Fixed loading of buffer contents from stdin
authorMike Lowis <mike.lowis@gentex.com>
Mon, 10 Oct 2016 17:12:06 +0000 (13:12 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Mon, 10 Oct 2016 17:12:06 +0000 (13:12 -0400)
buf.c

diff --git a/buf.c b/buf.c
index b32d69a1f9437faa2d386b5b4fee8fa2db32f58a..91c68926b9c6ed375897f5764ec37f71ee6f86d5 100644 (file)
--- a/buf.c
+++ b/buf.c
@@ -62,7 +62,10 @@ static void binsave(Buf* buf, FILE* file) {
 void buf_load(Buf* buf, char* path) {
     buf->insert_mode = true;
     if (!strcmp(path,"-")) {
-        buf_ins(buf, 0, (Rune)'\n');
+        buf->charset = UTF_8;
+        Rune r;
+        while (RUNE_EOF != (r = fgetrune(stdin)))
+            buf_ins(buf, buf_end(&Buffer), r);
     } else {
         FMap file = fmap(path);
         buf->path = strdup(path);