editor updates
This commit is contained in:
@@ -40,6 +40,7 @@ static struct {
|
||||
|
||||
|
||||
/* terminal.c */
|
||||
void nextline(); /* TODO: destroy this */
|
||||
void terminal_refresh();
|
||||
void terminal_init();
|
||||
void terminal_deinit();
|
||||
@@ -49,5 +50,8 @@ int terminal_getch();
|
||||
/* input.c */
|
||||
int handle_keypress(int c);
|
||||
|
||||
/* file_buffer.c */
|
||||
void init_buffer(struct buffer *buf)
|
||||
|
||||
|
||||
#endif /* KTE_DEFS_H */
|
||||
|
||||
10
kte/file_buffer.c
Normal file
10
kte/file_buffer.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
void
|
||||
init_buffer(struct buffer *buf)
|
||||
{
|
||||
/* put the cursor at the top of the file */
|
||||
buf->curx = 0;
|
||||
buf->cury = 0;
|
||||
}
|
||||
@@ -17,7 +17,8 @@ handle_keypress(int c)
|
||||
static int mode = MODE_NORMAL;
|
||||
|
||||
if (mode == MODE_NORMAL) {
|
||||
printf("%02x\t", c);
|
||||
printf("%02x", c);
|
||||
nextline();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
12
kte/main.c
12
kte/main.c
@@ -11,11 +11,9 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
void
|
||||
deinit()
|
||||
{
|
||||
endwin();
|
||||
}
|
||||
struct buffer *buffers;
|
||||
int nbufs;
|
||||
int cbuf; /* current buffer */
|
||||
|
||||
|
||||
int
|
||||
@@ -23,6 +21,10 @@ main()
|
||||
{
|
||||
int c, up = 1;
|
||||
|
||||
buffers = calloc(1, sizeof(struct buffer));
|
||||
nbufs = 1;
|
||||
cbuf = 0;
|
||||
|
||||
terminal_init();
|
||||
terminal_message("welcome to KTE", 14);
|
||||
terminal_refresh();
|
||||
|
||||
@@ -5,6 +5,18 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
*/
|
||||
static int cury = 0;
|
||||
|
||||
void
|
||||
nextline()
|
||||
{
|
||||
printf("\t%d", cury);
|
||||
wrefresh(editor.main);
|
||||
cury++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
terminal_refresh()
|
||||
{
|
||||
@@ -14,6 +26,11 @@ terminal_refresh()
|
||||
if ((time(NULL) - editor.msgtm) > KTE_MSG_TIME) {
|
||||
wrefresh(editor.message);
|
||||
}
|
||||
|
||||
wmove(editor.main, cury, 0);
|
||||
if (cury > LINES-3) {
|
||||
cury = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user