diff --git a/dev/script.js b/dev/script.js index 9ace2be..5d31677 100644 --- a/dev/script.js +++ b/dev/script.js @@ -456,7 +456,7 @@ Plymouth.SetDisplayNormalFunction(display_normal_callback); function display_password_callback(prompt_text, bullets) { global.status = "password"; - if(!global.dialog) + if (!global.dialog) dialog_setup(); else dialog_opacity(1); @@ -466,8 +466,8 @@ function display_password_callback(prompt_text, bullets) { LINE_WIDTH = 100; - for(index = LINE_WIDTH; index > 0; index--) { - if((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) { + for (index = LINE_WIDTH; index > 0; index--) { + if ((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) { LINE_WIDTH = LINE_WIDTH - 1; } else { @@ -481,8 +481,10 @@ function display_password_callback(prompt_text, bullets) { line_count = i; } - if (str_len % line_count > 0) { - line_count = line_count + 1; + if (str_len > LINE_WIDTH) { + if (str_len % LINE_WIDTH > 0) { + line_count = line_count + 1; + } } i = 1; @@ -491,7 +493,7 @@ function display_password_callback(prompt_text, bullets) { text = ""; - for(i = 1; i <= line_count; i++) { + for (i = 1; i <= line_count; i++) { text += prompt_text.SubString(start, end); text += "\n"; diff --git a/melawy-fenek/script.script b/melawy-fenek/script.script index 4af9e79..0a8baf7 100644 --- a/melawy-fenek/script.script +++ b/melawy-fenek/script.script @@ -456,7 +456,7 @@ Plymouth.SetDisplayNormalFunction(display_normal_callback); fun display_password_callback(prompt_text, bullets) { global.status = "password"; - if(!global.dialog) + if (!global.dialog) dialog_setup(); else dialog_opacity(1); @@ -466,8 +466,8 @@ fun display_password_callback(prompt_text, bullets) { LINE_WIDTH = 100; - for(index = LINE_WIDTH; index > 0; index--) { - if((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) { + for (index = LINE_WIDTH; index > 0; index--) { + if ((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) { LINE_WIDTH = LINE_WIDTH - 1; } else { @@ -481,8 +481,10 @@ fun display_password_callback(prompt_text, bullets) { line_count = i; } - if (str_len % line_count > 0) { - line_count = line_count + 1; + if (str_len > LINE_WIDTH) { + if (str_len % LINE_WIDTH > 0) { + line_count = line_count + 1; + } } i = 1; @@ -491,7 +493,7 @@ fun display_password_callback(prompt_text, bullets) { text = ""; - for(i = 1; i <= line_count; i++) { + for (i = 1; i <= line_count; i++) { text += prompt_text.SubString(start, end); text += "\n";