billiob pushed a commit to branch master.
commit d90396a8030d243ca0fc042441fa58951d8ce254
Author: Boris Faure <[email protected]>
Date: Sat Mar 23 23:42:02 2013 +0100
reflow: define OLD_SCREEN() on a higher level
---
src/bin/termpty.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 6d49a66..eaadd77 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -486,6 +486,9 @@ ssize_t termpty_line_length(const Termcell *cells, ssize_t
nb_cells)
return 0;
}
+#define OLD_SCREEN(_X, _Y) \
+ old_screen[_X + (((_Y + old_circular_offset) % old_h) * old_w)]
+
static void
_termpty_horizontally_expand(Termpty *ty, int old_w, int old_h,
Termcell *old_screen)
@@ -617,8 +620,6 @@ expand_screen:
* change of height (handle later?)
* double-width :)
*/
-#define OLD_SCREEN(_X, _Y) \
- old_screen[_X + (((_Y + old_circular_offset) % old_h) * old_w)]
for (old_y = 0; old_y < old_h; old_y++)
{
@@ -712,7 +713,6 @@ expand_screen:
ty->state.cy -= old_h - y;
if (ty->state.cy < 0) ty->state.cy = 0;
}
-#undef OLD_SCREEN
}
static void
@@ -726,9 +726,6 @@ _termpty_vertically_expand(Termpty *ty, int old_w, int
old_h,
ty->circular_offset = 0;
-#define OLD_SCREEN(_X, _Y) \
- old_screen[_X + (((_Y + old_circular_offset) % old_h) * old_w)]
-
for (y = 0; y < old_h; y++)
{
Termcell *c1, *c2;
@@ -737,7 +734,6 @@ _termpty_vertically_expand(Termpty *ty, int old_w, int
old_h,
c2 = &(TERMPTY_SCREEN(ty, 0, y));
_termpty_text_copy(ty, c1, c2, old_w);
}
-#undef OLD_SCREEN
}
/* TODO: display content from backlog */
@@ -753,11 +749,6 @@ _termpty_vertically_shrink(Termpty *ty, int old_w, int
old_h,
y;
Termcell *src, *dst;
- circular_offset = ty->circular_offset;
-
-#define OLD_SCREEN(_X, _Y) \
- old_screen[_X + (((_Y + old_circular_offset) % old_h) * old_w)]
-
old_circular_offset = ty->circular_offset;
for (y = 0; y < to_history; y++)
@@ -800,8 +791,6 @@ _termpty_vertically_shrink(Termpty *ty, int old_w, int
old_h,
}
ty->circular_offset = 0;
}
-
-#undef OLD_SCREEN
}
@@ -811,6 +800,7 @@ _termpty_horizontally_shrink(Termpty *ty, int old_w, int
old_h,
{
/* TODO */
}
+#undef OLD_SCREEN
void
--
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter