Started implementing overflow and scrolling for files

master
Aadhavan Srinivasan 2 years ago
parent 5414cf41c9
commit 071ddf5ac0

@ -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);

Loading…
Cancel
Save