@ -177,7 +177,7 @@
// Keyboard input must be encoded as a single integer value; e.g. a character code
// Keyboard input must be encoded as a single integer value; e.g. a character code
// and some bitflags that represent shift states. to simplify the interface, SHIFT must
// and some bitflags that represent shift states. to simplify the interface, SHIFT must
// be a bitflag, so we can test the shifted state of cursor movements to allow selection,
// be a bitflag, so we can test the shifted state of cursor movements to allow selection,
// i.e. (STB_TEXTED_K_RIGHT|STB_TEXTEDIT_K_SHIFT) should be shifted right-arrow.
// i.e. (STB_TEXTEDIT _K_RIGHT|STB_TEXTEDIT_K_SHIFT) should be shifted right-arrow.
//
//
// You can encode other things, such as CONTROL or ALT, in additional bits, and
// You can encode other things, such as CONTROL or ALT, in additional bits, and
// then test for their presence in e.g. STB_TEXTEDIT_K_WORDLEFT. For example,
// then test for their presence in e.g. STB_TEXTEDIT_K_WORDLEFT. For example,
@ -877,6 +877,12 @@ retry:
// now find character position down a row
// now find character position down a row
if ( find . length ) {
if ( find . length ) {
// [DEAR IMGUI]
// going down while being on the last line shouldn't bring us to that line end
if ( STB_TEXTEDIT_GETCHAR ( str , find . first_char + find . length - 1 ) ! = STB_TEXTEDIT_NEWLINE )
break ;
float goal_x = state - > has_preferred_x ? state - > preferred_x : find . x ;
float goal_x = state - > has_preferred_x ? state - > preferred_x : find . x ;
float x ;
float x ;
int start = find . first_char + find . length ;
int start = find . first_char + find . length ;
@ -1134,7 +1140,7 @@ static void stb_textedit_discard_redo(StbUndoState *state)
state - > undo_rec [ i ] . char_storage + = n ;
state - > undo_rec [ i ] . char_storage + = n ;
}
}
// now move all the redo records towards the end of the buffer; the first one is at 'redo_point'
// now move all the redo records towards the end of the buffer; the first one is at 'redo_point'
// { DEAR IMGUI]
// [ DEAR IMGUI]
size_t move_size = ( size_t ) ( ( STB_TEXTEDIT_UNDOSTATECOUNT - state - > redo_point - 1 ) * sizeof ( state - > undo_rec [ 0 ] ) ) ;
size_t move_size = ( size_t ) ( ( STB_TEXTEDIT_UNDOSTATECOUNT - state - > redo_point - 1 ) * sizeof ( state - > undo_rec [ 0 ] ) ) ;
const char * buf_begin = ( char * ) state - > undo_rec ; ( void ) buf_begin ;
const char * buf_begin = ( char * ) state - > undo_rec ; ( void ) buf_begin ;
const char * buf_end = ( char * ) state - > undo_rec + sizeof ( state - > undo_rec ) ; ( void ) buf_end ;
const char * buf_end = ( char * ) state - > undo_rec + sizeof ( state - > undo_rec ) ; ( void ) buf_end ;