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();
|
noecho();
|
||||||
keypad(stdscr,TRUE);
|
keypad(stdscr,TRUE);
|
||||||
cbreak();
|
cbreak();
|
||||||
|
// scrollok(stdscr,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigint_handler(int dummy) {
|
void sigint_handler(int dummy) {
|
||||||
@@ -97,6 +98,7 @@ void sigint_handler(int dummy) {
|
|||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
signal(SIGINT,sigint_handler);
|
signal(SIGINT,sigint_handler);
|
||||||
Buffer* buffer = new_buffer(10);
|
Buffer* buffer = new_buffer(10);
|
||||||
|
FILE* logfile = fopen("logfile.txt","w");
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
int num_of_chars = 0;
|
int num_of_chars = 0;
|
||||||
@@ -144,6 +146,11 @@ int main(int argc, char** argv) {
|
|||||||
addch(*(buffer->text + i));
|
addch(*(buffer->text + i));
|
||||||
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);
|
move(y,x);
|
||||||
@@ -175,6 +182,9 @@ int main(int argc, char** argv) {
|
|||||||
exception here), but that's a problem for another day. */
|
exception here), but that's a problem for another day. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
buffer_insert(ch,buffer);
|
buffer_insert(ch,buffer);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user