blob: bf8db841d61b8702b8ac3b9d78d657d72817ad13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* vi.c - You can't spell "evil" without "vi".
*
* Copyright 2015 Rob Landley <rob@landley.net>
*
* See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html
USE_VI(NEWTOY(vi, "<1>1", TOYFLAG_USR|TOYFLAG_BIN))
config VI
bool "vi"
default n
help
usage: vi FILE
Visual text editor. Predates the existence of standardized cursor keys,
so the controls are weird and historical.
*/
#define FOR_vi
#include "toys.h"
GLOBALS(
struct linestack *ls;
char *statline;
)
struct linestack_show {
struct linestack_show *next;
long top, left;
int x, width, y, height;
};
// linestack, what to show, where to show it
void linestack_show(struct linestack *ls, struct linestack_show *lss)
{
return;
}
void vi_main(void)
{
int i;
if (!(TT.ls = linestack_load(*toys.optargs)))
TT.ls = xzalloc(sizeof(struct linestack));
for (i=0; i<TT.ls->len; i++)
printf("%.*s\n", (int)TT.ls->idx[i].len, (char *)TT.ls->idx[i].ptr);
}
|