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 i = 0;
char* c = inputbox->buffer;
while (*c != '\0') {
while (true) {
if (x < cX) {
index = i;
}

View file

@ -3,6 +3,7 @@
#include "djui.h"
#include "djui_panel.h"
#include "djui_panel_menu.h"
#include "djui_unicode.h"
#include "pc/configfile.h"
#include "pc/network/network_player.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) {
if (buffer[0] == '\0') { return false; }
while (*buffer != '\0') {
if (*buffer >= '!' && *buffer <= '~') {
buffer++;
continue;
}
return false;
char* c = buffer;
while (*c != '\0') {
if (*c == ' ') { return false; }
if (!djui_unicode_valid_char(c)) { return false; }
c = djui_unicode_next_char(c);
}
return true;
}