'asterisk_empty' config attribute added

This commit is contained in:
Alexandr Shibaev 2021-04-26 03:00:39 +03:00
parent 77f6958241
commit 9276d4176f
4 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,10 @@
#asterisk = * #asterisk = *
#asterisk = o #asterisk = o
# print nor asterisk and password
#asterisk_empty = true
#asterisk_empty = false
# background color id # background color id
#bg = 0 #bg = 0

View File

@ -158,6 +158,7 @@ void config_load(const char *cfg_path)
{"animate", &config.animate, config_handle_bool}, {"animate", &config.animate, config_handle_bool},
{"animation", &config.animation, config_handle_u8}, {"animation", &config.animation, config_handle_u8},
{"asterisk", &config.asterisk, config_handle_char}, {"asterisk", &config.asterisk, config_handle_char},
{"asterisk_empty", &config.asterisk_empty, config_handle_bool},
{"bg", &config.bg, config_handle_u8}, {"bg", &config.bg, config_handle_u8},
{"blank_box", &config.blank_box, config_handle_bool}, {"blank_box", &config.blank_box, config_handle_bool},
{"blank_password", &config.blank_password, config_handle_bool}, {"blank_password", &config.blank_password, config_handle_bool},
@ -264,6 +265,7 @@ void config_defaults()
config.animate = false; config.animate = false;
config.animation = 0; config.animation = 0;
config.asterisk = '*'; config.asterisk = '*';
config.asterisk_empty = false;
config.bg = 0; config.bg = 0;
config.blank_box = true; config.blank_box = true;
config.blank_password = false; config.blank_password = false;

View File

@ -63,6 +63,7 @@ struct config
bool animate; bool animate;
u8 animation; u8 animation;
char asterisk; char asterisk;
bool asterisk_empty;
u8 bg; u8 bg;
bool blank_box; bool blank_box;
bool blank_password; bool blank_password;

View File

@ -457,6 +457,7 @@ void position_input(
{ {
u16 x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1; u16 x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
i32 len = buf->box_x + buf->box_width - config.margin_box_h - x; i32 len = buf->box_x + buf->box_width - config.margin_box_h - x;
i32 len_password = config.asterisk_empty ? 0 : len;
if (len < 0) if (len < 0)
{ {
@ -473,7 +474,7 @@ void position_input(
password->x = x; password->x = x;
password->y = buf->box_y + config.margin_box_v + 6; password->y = buf->box_y + config.margin_box_v + 6;
password->visible_len = len; password->visible_len = len_password;
} }
static void doom_init(struct term_buf* buf) static void doom_init(struct term_buf* buf)