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

Loading…
Cancel
Save