vi: code shrink
function old new delta new_screen 84 75 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
3e61b59ef3
commit
e1a1b64f43
19
editors/vi.c
19
editors/vi.c
@ -722,20 +722,25 @@ static void screen_erase(void)
|
|||||||
memset(screen, ' ', screensize); // clear new screen
|
memset(screen, ' ', screensize); // clear new screen
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *new_screen(int ro, int co)
|
static void new_screen(int ro, int co)
|
||||||
{
|
{
|
||||||
int li;
|
char *s;
|
||||||
|
|
||||||
free(screen);
|
free(screen);
|
||||||
screensize = ro * co + 8;
|
screensize = ro * co + 8;
|
||||||
screen = xmalloc(screensize);
|
s = screen = xmalloc(screensize);
|
||||||
// initialize the new screen. assume this will be a empty file.
|
// initialize the new screen. assume this will be a empty file.
|
||||||
screen_erase();
|
screen_erase();
|
||||||
// non-existent text[] lines start with a tilde (~).
|
// non-existent text[] lines start with a tilde (~).
|
||||||
for (li = 1; li < ro - 1; li++) {
|
//screen[(1 * co) + 0] = '~';
|
||||||
screen[(li * co) + 0] = '~';
|
//screen[(2 * co) + 0] = '~';
|
||||||
|
//..
|
||||||
|
//screen[((ro-2) * co) + 0] = '~';
|
||||||
|
ro -= 2;
|
||||||
|
while (--ro >= 0) {
|
||||||
|
s += co;
|
||||||
|
*s = '~';
|
||||||
}
|
}
|
||||||
return screen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Synchronize the cursor to Dot --------------------------
|
//----- Synchronize the cursor to Dot --------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user