Fixed clicking your cursor on the rightmost letter of inputbox
This commit is contained in:
parent
412e1cdb27
commit
01c165477d
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue