@ -3597,11 +3597,12 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob
r - > num_chars = ( int ) ( text_remaining - ( text + line_start_idx ) ) ;
}
// When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators.
static bool is_separator ( unsigned int c ) { return ImCharIsBlankW ( c ) | | c = = ' , ' | | c = = ' ; ' | | c = = ' ( ' | | c = = ' ) ' | | c = = ' { ' | | c = = ' } ' | | c = = ' [ ' | | c = = ' ] ' | | c = = ' | ' ; }
static int is_word_boundary_from_right ( STB_TEXTEDIT_STRING * obj , int idx ) { return idx > 0 ? ( is_separator ( obj - > TextW [ idx - 1 ] ) & & ! is_separator ( obj - > TextW [ idx ] ) ) : 1 ; }
static int is_word_boundary_from_right ( STB_TEXTEDIT_STRING * obj , int idx ) { if ( obj - > Flags & ImGuiInputTextFlags_Password ) return 0 ; return idx > 0 ? ( is_separator ( obj - > TextW [ idx - 1 ] ) & & ! is_separator ( obj - > TextW [ idx ] ) ) : 1 ; }
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL ( STB_TEXTEDIT_STRING * obj , int idx ) { idx - - ; while ( idx > = 0 & & ! is_word_boundary_from_right ( obj , idx ) ) idx - - ; return idx < 0 ? 0 : idx ; }
# ifdef __APPLE__ // FIXME: Move setting to IO structure
static int is_word_boundary_from_left ( STB_TEXTEDIT_STRING * obj , int idx ) { return idx > 0 ? ( ! is_separator ( obj - > TextW [ idx - 1 ] ) & & is_separator ( obj - > TextW [ idx ] ) ) : 1 ; }
static int is_word_boundary_from_left ( STB_TEXTEDIT_STRING * obj , int idx ) { if ( obj - > Flags & ImGuiInputTextFlags_Password ) return 0 ; return idx > 0 ? ( ! is_separator ( obj - > TextW [ idx - 1 ] ) & & is_separator ( obj - > TextW [ idx ] ) ) : 1 ; }
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL ( STB_TEXTEDIT_STRING * obj , int idx ) { idx + + ; int len = obj - > CurLenW ; while ( idx < len & & ! is_word_boundary_from_left ( obj , idx ) ) idx + + ; return idx > len ? len : idx ; }
# else
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL ( STB_TEXTEDIT_STRING * obj , int idx ) { idx + + ; int len = obj - > CurLenW ; while ( idx < len & & ! is_word_boundary_from_right ( obj , idx ) ) idx + + ; return idx > len ? len : idx ; }
@ -3627,7 +3628,7 @@ static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n)
static bool STB_TEXTEDIT_INSERTCHARS ( STB_TEXTEDIT_STRING * obj , int pos , const ImWchar * new_text , int new_text_len )
{
const bool is_resizable = ( obj - > User Flags & ImGuiInputTextFlags_CallbackResize ) ! = 0 ;
const bool is_resizable = ( obj - > Flags & ImGuiInputTextFlags_CallbackResize ) ! = 0 ;
const int text_len = obj - > CurLenW ;
IM_ASSERT ( pos < = text_len ) ;
@ -4067,7 +4068,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
backup_current_text_length = state - > CurLenA ;
state - > Edited = false ;
state - > BufCapacityA = buf_size ;
state - > User Flags = flags ;
state - > Flags = flags ;
state - > UserCallback = callback ;
state - > UserCallbackData = callback_user_data ;
@ -4420,7 +4421,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
}
// Clear temporary user storage
state - > User Flags = 0 ;
state - > Flags = ImGuiInputTextFlags_None ;
state - > UserCallback = NULL ;
state - > UserCallbackData = NULL ;
}