|
|
@ -86,6 +86,12 @@ void buffer_right(Buffer* buffer) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void right_key_handler(Buffer* buffer) {
|
|
|
|
|
|
|
|
if ((*(buffer->end) != '\n') || (getcury(mainwin) + 1 < getmaxy(mainwin))) {
|
|
|
|
|
|
|
|
buffer_right(buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void buffer_left(Buffer* buffer) {
|
|
|
|
void buffer_left(Buffer* buffer) {
|
|
|
|
if (buffer->start != buffer->text) {
|
|
|
|
if (buffer->start != buffer->text) {
|
|
|
|
char c = *(buffer->start - 1);
|
|
|
|
char c = *(buffer->start - 1);
|
|
|
@ -96,7 +102,11 @@ void buffer_left(Buffer* buffer) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void left_key_handler(Buffer* buffer) {
|
|
|
|
|
|
|
|
if ((getcurx(mainwin) > 0) || (getcury(mainwin) > 0)) {
|
|
|
|
|
|
|
|
buffer_left(buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void scroll_page_down_handler(Buffer* buffer) {
|
|
|
|
void scroll_page_down_handler(Buffer* buffer) {
|
|
|
|
while (*(buffer->text + index_to_start) != '\n') {
|
|
|
|
while (*(buffer->text + index_to_start) != '\n') {
|
|
|
@ -277,11 +287,11 @@ int main(int argc, char** argv) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KEY_LEFT:
|
|
|
|
case KEY_LEFT:
|
|
|
|
buffer_left(buffer);
|
|
|
|
left_key_handler(buffer);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KEY_RIGHT:
|
|
|
|
case KEY_RIGHT:
|
|
|
|
buffer_right(buffer);
|
|
|
|
right_key_handler(buffer);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 10: /* Enter key */
|
|
|
|
case 10: /* Enter key */
|
|
|
|