Reset attributes to remove bold style and adding history size in prompt

This commit is contained in:
Melefo
2020-05-24 20:58:21 +02:00
parent 95333aae3e
commit 8513c9c9a0
2 changed files with 6 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ int buffer_get_display_pos(buffer_t *buffer);
int self_insert_command(int key, buffer_t *buffer, env_t *env);
int newline_command(int key, buffer_t *buffer, env_t *env);
int eof_command(int key, buffer_t *buffer, env_t *env);
int history_size(history_t *hist);
int backward_delete_char_command(int key, buffer_t *buffer, env_t *env);
int delete_char_command(int key, buffer_t *buffer, env_t *env);

View File

@@ -8,6 +8,8 @@
#include "shell.h"
#include "my_ncurses.h"
#include "prompt.h"
#include "key_functions.h"
#include "utility.h"
#include <unistd.h>
#include <limits.h>
#include <stdio.h>
@@ -21,7 +23,7 @@ char *get_prompt_value2(char c, env_t *env)
if (c == 'B')
return (prompt_attr(BOLD, false));
if (c == 'b')
return (prompt_attr(BOLD, true));
return (prompt_attr(0, false));
if (c == 'U')
return (prompt_attr(UNDERLINE, false));
if (c == 'u')
@@ -30,6 +32,8 @@ char *get_prompt_value2(char c, env_t *env)
return (prompt_attr(REVERSE, false));
if (c == 's')
return (prompt_attr(REVERSE, true));
if (c == '!' || c == 'h')
return (tostr(history_size(env->history)));
return (NULL);
}