Started implementing overflow and scrolling for files
This commit is contained in:
10
editor.c
10
editor.c
@@ -87,6 +87,7 @@ void init_curses() {
|
||||
noecho();
|
||||
keypad(stdscr,TRUE);
|
||||
cbreak();
|
||||
// scrollok(stdscr,TRUE);
|
||||
}
|
||||
|
||||
void sigint_handler(int dummy) {
|
||||
@@ -97,6 +98,7 @@ void sigint_handler(int dummy) {
|
||||
int main(int argc, char** argv) {
|
||||
signal(SIGINT,sigint_handler);
|
||||
Buffer* buffer = new_buffer(10);
|
||||
FILE* logfile = fopen("logfile.txt","w");
|
||||
|
||||
if (argc == 2) {
|
||||
int num_of_chars = 0;
|
||||
@@ -144,6 +146,11 @@ int main(int argc, char** argv) {
|
||||
addch(*(buffer->text + i));
|
||||
i++;
|
||||
|
||||
fprintf(logfile,"At line %d of %d\n",getcury(stdscr),getmaxy(stdscr));
|
||||
if (*(buffer->text + i) == '\n' && (getcury(stdscr) == getmaxy(stdscr))) {
|
||||
fprintf(logfile,"Read newline\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
move(y,x);
|
||||
@@ -175,6 +182,9 @@ int main(int argc, char** argv) {
|
||||
exception here), but that's a problem for another day. */
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
buffer_insert(ch,buffer);
|
||||
|
||||
|
Reference in New Issue
Block a user