Started working on Down arrow key support
This commit is contained in:
7
editor.c
7
editor.c
@@ -96,6 +96,8 @@ void sigint_handler(int dummy) {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int index_to_start = 0;
|
||||
|
||||
signal(SIGINT,sigint_handler);
|
||||
Buffer* buffer = new_buffer(10);
|
||||
FILE* logfile = fopen("logfile.txt","w");
|
||||
@@ -130,7 +132,7 @@ int main(int argc, char** argv) {
|
||||
while (true) {
|
||||
clear();
|
||||
|
||||
int i=0;
|
||||
int i=index_to_start;
|
||||
if ((buffer->start != buffer->text) || (buffer->gap_size != buffer->size)) { /* We don't want to print the string, if the
|
||||
gap starts at the first index of the string, and continues till the end */
|
||||
|
||||
@@ -147,7 +149,7 @@ int main(int argc, char** argv) {
|
||||
i++;
|
||||
|
||||
fprintf(logfile,"At line %d of %d\n",getcury(stdscr),getmaxy(stdscr));
|
||||
if (*(buffer->text + i) == '\n' && (getcury(stdscr) == getmaxy(stdscr))) {
|
||||
if (*(buffer->text + i) == '\n' && ((getcury(stdscr) + 1) == getmaxy(stdscr))) {
|
||||
fprintf(logfile,"Read newline\n");
|
||||
break;
|
||||
}
|
||||
@@ -182,6 +184,7 @@ int main(int argc, char** argv) {
|
||||
exception here), but that's a problem for another day. */
|
||||
break;
|
||||
|
||||
case KEY_DOWN:
|
||||
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user