268 #ifndef INCLUDE_STB_TEXTEDIT_H 269 #define INCLUDE_STB_TEXTEDIT_H 280 #ifndef STB_TEXTEDIT_UNDOSTATECOUNT 281 #define STB_TEXTEDIT_UNDOSTATECOUNT 99 283 #ifndef STB_TEXTEDIT_UNDOCHARCOUNT 284 #define STB_TEXTEDIT_UNDOCHARCOUNT 999 286 #ifndef STB_TEXTEDIT_CHARTYPE 287 #define STB_TEXTEDIT_CHARTYPE int 289 #ifndef STB_TEXTEDIT_POSITIONTYPE 290 #define STB_TEXTEDIT_POSITIONTYPE int 361 #endif //INCLUDE_STB_TEXTEDIT_H 374 #ifdef STB_TEXTEDIT_IMPLEMENTATION 376 #ifndef STB_TEXTEDIT_memmove 378 #define STB_TEXTEDIT_memmove memmove 392 float base_y = 0, prev_x;
405 if (i==0 && y < base_y + r.
ymin)
408 if (y < base_y + r.
ymax)
501 find->first_char = 0;
514 find->first_char =
i;
516 find->prev_first = prev_start;
536 find->prev_first = prev_start;
545 #define STB_TEXT_HAS_SELECTION(s) ((s)->select_start != (s)->select_end) 618 #ifdef STB_TEXTEDIT_IS_SPACE 624 #ifndef STB_TEXTEDIT_MOVEWORDLEFT 627 while( c >= 0 && !is_word_boundary( _str, c ) )
635 #define STB_TEXTEDIT_MOVEWORDLEFT stb_textedit_move_to_word_previous 638 #ifndef STB_TEXTEDIT_MOVEWORDRIGHT 642 while( c < len && !is_word_boundary( _str, c ) )
650 #define STB_TEXTEDIT_MOVEWORDRIGHT stb_textedit_move_to_word_next 728 #ifdef STB_TEXTEDIT_K_INSERT 729 case STB_TEXTEDIT_K_INSERT:
774 #ifdef STB_TEXTEDIT_MOVEWORDLEFT 795 #ifdef STB_TEXTEDIT_MOVEWORDRIGHT 850 int start = find.first_char + find.length;
856 #ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE 898 if (find.prev_first != find.first_char) {
902 state->
cursor = find.prev_first;
907 #ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE 953 #ifdef STB_TEXTEDIT_K_TEXTSTART2 954 case STB_TEXTEDIT_K_TEXTSTART2:
961 #ifdef STB_TEXTEDIT_K_TEXTEND2 962 case STB_TEXTEDIT_K_TEXTEND2:
970 #ifdef STB_TEXTEDIT_K_TEXTSTART2 979 #ifdef STB_TEXTEDIT_K_TEXTEND2 989 #ifdef STB_TEXTEDIT_K_LINESTART2 990 case STB_TEXTEDIT_K_LINESTART2:
997 state->
cursor = find.first_char;
1002 #ifdef STB_TEXTEDIT_K_LINEEND2 1003 case STB_TEXTEDIT_K_LINEEND2:
1012 state->
cursor = find.first_char + find.length;
1018 #ifdef STB_TEXTEDIT_K_LINESTART2 1031 #ifdef STB_TEXTEDIT_K_LINEEND2 1040 state->
cursor = find.first_char + find.length;
1142 if (insert_len == 0) {
1290 for (i=0; i < old_length; ++
i)
1308 state->
single_line = (
unsigned char) is_single_line;
1317 #endif//STB_TEXTEDIT_IMPLEMENTATION
static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
#define STB_TEXTEDIT_K_LINESTART
GLenum GLenum GLsizei void * row
static ImWchar STB_TEXTEDIT_NEWLINE
static void stb_textedit_move_to_first(STB_TexteditState *state)
static void stb_textedit_discard_redo(StbUndoState *state)
static void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)
unsigned char initialized
static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING *obj, int idx)
static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING *obj)
#define STB_TEXTEDIT_K_UNDO
GLdouble GLdouble GLdouble w
static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key)
#define STB_TEXTEDIT_K_TEXTEND
#define STB_TEXTEDIT_K_SHIFT
static void stb_textedit_flush_redo(StbUndoState *state)
#define STB_TEXTEDIT_K_REDO
static void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int len)
#define STB_TEXTEDIT_K_DOWN
#define STB_TEXTEDIT_K_LINEEND
#define STB_TEXTEDIT_GETWIDTH_NEWLINE
unsigned char has_preferred_x
static void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
#define STB_TEXTEDIT_MOVEWORDLEFT
static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING *obj, int pos, const ImWchar *new_text, int new_text_len)
static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING *obj, int line_start_idx, int char_idx)
#define STB_TEXTEDIT_UNDOSTATECOUNT
#define STB_TEXTEDIT_CHARTYPE
static void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)
STB_TEXTEDIT_CHARTYPE undo_char[STB_TEXTEDIT_UNDOCHARCOUNT]
static void stb_textedit_clear_state(STB_TexteditState *state, int is_single_line)
static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *str, int n, int single_line)
static STB_TEXTEDIT_CHARTYPE * stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)
unsigned char single_line
GLint GLsizei GLsizei height
static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING *obj, int pos, int n)
#define STB_TEXTEDIT_MOVEWORDRIGHT
static void stb_textedit_discard_undo(StbUndoState *state)
#define STB_TEXTEDIT_UNDOCHARCOUNT
static int STB_TEXTEDIT_KEYTOTEXT(int key)
#define STB_TEXT_HAS_SELECTION(s)
#define STB_TEXTEDIT_K_DELETE
unsigned char insert_mode
static void stb_textedit_sortselection(STB_TexteditState *state)
#define STB_TEXTEDIT_K_BACKSPACE
#define STB_TEXTEDIT_K_WORDLEFT
unsigned char cursor_at_end_of_line
static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)
static void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)
static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow *r, STB_TEXTEDIT_STRING *obj, int line_start_idx)
#define STB_TEXTEDIT_POSITIONTYPE
#define STB_TEXTEDIT_memmove
#define STB_TEXTEDIT_K_WORDRIGHT
#define STB_TEXTEDIT_K_RIGHT
#define STB_TEXTEDIT_STRING
#define STB_TEXTEDIT_K_UP
#define STB_TEXTEDIT_K_TEXTSTART
GLenum GLuint GLenum GLsizei length
static void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length)
static StbUndoRecord * stb_text_create_undo_record(StbUndoState *state, int numchars)
static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)
STB_TEXTEDIT_POSITIONTYPE where
static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
#define STB_TEXTEDIT_K_LEFT
static void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)
StbUndoRecord undo_rec[STB_TEXTEDIT_UNDOSTATECOUNT]
static void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
static void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)