Fixed clicking your cursor on the rightmost letter of inputbox

This commit is contained in:
MysterD 2023-04-01 03:56:23 -07:00
parent bc079903a7
commit bff3dc74fe
2 changed files with 7 additions and 7 deletions

View file

@ -71,7 +71,7 @@ static u16 djui_inputbox_get_cursor_index(struct DjuiInputbox* inputbox) {
u16 index = 0; u16 index = 0;
u16 i = 0; u16 i = 0;
char* c = inputbox->buffer; char* c = inputbox->buffer;
while (*c != '\0') { while (true) {
if (x < cX) { if (x < cX) {
index = i; index = i;
} }

View file

@ -3,6 +3,7 @@
#include "djui.h" #include "djui.h"
#include "djui_panel.h" #include "djui_panel.h"
#include "djui_panel_menu.h" #include "djui_panel_menu.h"
#include "djui_unicode.h"
#include "pc/configfile.h" #include "pc/configfile.h"
#include "pc/network/network_player.h" #include "pc/network/network_player.h"
#include "game/level_update.h" #include "game/level_update.h"
@ -166,12 +167,11 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
static bool djui_panel_player_name_valid(char* buffer) { static bool djui_panel_player_name_valid(char* buffer) {
if (buffer[0] == '\0') { return false; } if (buffer[0] == '\0') { return false; }
while (*buffer != '\0') { char* c = buffer;
if (*buffer >= '!' && *buffer <= '~') { while (*c != '\0') {
buffer++; if (*c == ' ') { return false; }
continue; if (!djui_unicode_valid_char(c)) { return false; }
} c = djui_unicode_next_char(c);
return false;
} }
return true; return true;
} }