From af3c74e9159592dee721d88dc6a8d60e1284ce4d Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 29 Apr 2009 12:13:19 +0000 Subject: [PATCH] import.c: when importing ANSI or UTF-8 files, treat ^L as a canvas frame separator. Not extremely robust yet. --- caca/codec/import.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/caca/codec/import.c b/caca/codec/import.c index c938632..376eee1 100644 --- a/caca/codec/import.c +++ b/caca/codec/import.c @@ -21,6 +21,7 @@ #if !defined __KERNEL__ # include # include +# include #endif #include "caca.h" @@ -677,6 +678,16 @@ static ssize_t import_ansi(caca_canvas_t *cv, void const *data, free(string); } + /* Form feed means a new frame */ + else if(buffer[i] == '\f' && buffer[i + 1] == '\n') + { + int f = caca_get_frame_count(cv); + caca_create_frame(cv, f); + caca_set_frame(cv, f); + x = y = 0; + skip++; + } + /* Get the character we’re going to paste */ else if(utf8) {