Started working on Down arrow key support

master
Aadhavan Srinivasan 2 years ago
parent 071ddf5ac0
commit 4d4f0f16c8

@ -96,6 +96,8 @@ void sigint_handler(int dummy) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
int index_to_start = 0;
signal(SIGINT,sigint_handler); signal(SIGINT,sigint_handler);
Buffer* buffer = new_buffer(10); Buffer* buffer = new_buffer(10);
FILE* logfile = fopen("logfile.txt","w"); FILE* logfile = fopen("logfile.txt","w");
@ -130,7 +132,7 @@ int main(int argc, char** argv) {
while (true) { while (true) {
clear(); 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 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 */ 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++; i++;
fprintf(logfile,"At line %d of %d\n",getcury(stdscr),getmaxy(stdscr)); 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"); fprintf(logfile,"Read newline\n");
break; break;
} }
@ -182,7 +184,8 @@ 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;
case KEY_DOWN:
break; break;
default: default:

Loading…
Cancel
Save