Implementing the ctrl L

This commit is contained in:
Anonymus Raccoon
2020-05-24 14:07:55 +02:00
parent 3ad96316a1
commit 89a137e223
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -44,4 +44,6 @@ int end_of_line_command(int key, buffer_t *buffer, env_t *env);
int up_history_command(int key, buffer_t *buffer, env_t *env);
int down_history_command(int key, buffer_t *buffer, env_t *env);
int clear_screen_command(int key, buffer_t *buffer, env_t *env);
int complete_command(int key, buffer_t *buffer, env_t *env);
+8
View File
@@ -75,4 +75,12 @@ int down_history_command(int key, buffer_t *buffer, env_t *env)
buffer->history_index--;
set_buffer_to_history(buffer, env);
return (0);
}
int clear_screen_command(int key, buffer_t *buffer, env_t *env)
{
my_move(env->window, 0, 0);
my_clrtobot();
prompt_prepare(buffer, env);
return (0);
}
+2
View File
@@ -23,6 +23,7 @@ const key_function_t key_functions[] = {
{"up-history", &up_history_command},
{"down-history", &down_history_command},
{"complete-command", &complete_command},
{"clear-screen", &clear_screen_command},
{NULL, NULL}
};
@@ -39,6 +40,7 @@ const binding_t emacs_bindings[] = {
{KEY_UP, &up_history_command},
{KEY_DOWN, &down_history_command},
{'\t', &complete_command},
{CTRL('l'), &clear_screen_command},
{0, NULL}
};