|
|
@ -168,6 +168,13 @@ void page_up_handler(Buffer* buffer) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void keypress_handler(char key, Buffer* buffer) {
|
|
|
|
|
|
|
|
buffer_insert(key,buffer);
|
|
|
|
|
|
|
|
if ((getcury(mainwin) + 1) == getmaxy(mainwin)) {
|
|
|
|
|
|
|
|
scroll_page_down_handler(buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int is_file(char* path) {
|
|
|
|
int is_file(char* path) {
|
|
|
|
struct stat st;
|
|
|
|
struct stat st;
|
|
|
|
if (stat(path, &st) < 0) {
|
|
|
|
if (stat(path, &st) < 0) {
|
|
|
@ -295,7 +302,7 @@ int main(int argc, char** argv) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 10: /* Enter key */
|
|
|
|
case 10: /* Enter key */
|
|
|
|
buffer_insert('\n',buffer); /* Why handle this separately?
|
|
|
|
keypress_handler('\n',buffer); /* Why handle this separately?
|
|
|
|
Because, by default, curses seems to send '\r\n',
|
|
|
|
Because, by default, curses seems to send '\r\n',
|
|
|
|
which is technically two characters. I should
|
|
|
|
which is technically two characters. I should
|
|
|
|
probably add some code to deal with this scenario
|
|
|
|
probably add some code to deal with this scenario
|
|
|
@ -327,7 +334,7 @@ int main(int argc, char** argv) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
buffer_insert(ch,buffer);
|
|
|
|
keypress_handler(ch,buffer);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|