Introduction
Introduction Statistics Contact Development Disclaimer Help
tSimplify a bit more tdeletechar and tinsertblank - st - [fork] customized buil…
git clone git://src.adamsgaard.dk/st
Log
Files
Refs
README
LICENSE
---
commit 6b7f63bac597ca03e18fe63ad522b4d1bded08d1
parent 80b32af794b659cb15745cfb2a19fce0829c42c7
Author: Roberto E. Vargas Caballero <[email protected]>
Date: Fri, 25 Apr 2014 17:24:12 +0200
Simplify a bit more tdeletechar and tinsertblank
The large and repeated expression used in memmove to indirect
tthe line can be simplified using a pointer, that makes more
clear where begins and where ends the movement.
Diffstat:
M st.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/st.c b/st.c
t@@ -1587,30 +1587,32 @@ tclearregion(int x1, int y1, int x2, int y2) {
void
tdeletechar(int n) {
int dst, src, size;
+ Glyph *line;
LIMIT(n, 0, term.col - term.c.x);
dst = term.c.x;
src = term.c.x + n;
size = term.col - src;
+ line = term.line[term.c.y];
- memmove(&term.line[term.c.y][dst], &term.line[term.c.y][src],
- size * sizeof(Glyph));
+ memmove(&line[dst], &line[src], size * sizeof(Glyph));
tclearregion(term.col-n, term.c.y, term.col-1, term.c.y);
}
void
tinsertblank(int n) {
int dst, src, size;
+ Glyph *line;
LIMIT(n, 0, term.col - term.c.x);
dst = term.c.x + n;
src = term.c.x;
size = term.col - dst;
+ line = term.line[term.c.y];
- memmove(&term.line[term.c.y][dst], &term.line[term.c.y][src],
- size * sizeof(Glyph));
+ memmove(&line[dst], &line[src], size * sizeof(Glyph));
tclearregion(src, term.c.y, dst - 1, term.c.y);
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.