• Home
  • Raw
  • Download

Lines Matching refs:string

32 static void insert_delete ( struct edit_string *string, size_t delete_len,
35 static void insert_character ( struct edit_string *string,
37 static void delete_character ( struct edit_string *string ) __nonnull;
38 static void backspace ( struct edit_string *string ) __nonnull;
39 static void kill_eol ( struct edit_string *string ) __nonnull;
48 static void insert_delete ( struct edit_string *string, size_t delete_len, in insert_delete() argument
53 old_len = strlen ( string->buf ); in insert_delete()
54 assert ( string->cursor <= old_len ); in insert_delete()
55 max_delete_len = ( old_len - string->cursor ); in insert_delete()
59 max_insert_len = ( ( string->len - 1 ) - ( old_len - delete_len ) ); in insert_delete()
65 string->mod_start = string->cursor; in insert_delete()
66 string->mod_end = ( ( new_len > old_len ) ? new_len : old_len ); in insert_delete()
69 memmove ( ( string->buf + string->cursor + insert_len ), in insert_delete()
70 ( string->buf + string->cursor + delete_len ), in insert_delete()
74 memcpy ( ( string->buf + string->cursor ), insert_text, insert_len ); in insert_delete()
75 string->cursor += insert_len; in insert_delete()
84 static void insert_character ( struct edit_string *string, in insert_character() argument
87 insert_delete ( string, 0, insert_text ); in insert_character()
95 static void delete_character ( struct edit_string *string ) { in delete_character() argument
96 insert_delete ( string, 1, NULL ); in delete_character()
104 static void backspace ( struct edit_string *string ) { in backspace() argument
105 if ( string->cursor > 0 ) { in backspace()
106 string->cursor--; in backspace()
107 delete_character ( string ); in backspace()
116 static void kill_eol ( struct edit_string *string ) { in kill_eol() argument
117 insert_delete ( string, ~( ( size_t ) 0 ), NULL ); in kill_eol()
137 int edit_string ( struct edit_string *string, int key ) { in edit_string() argument
139 size_t len = strlen ( string->buf ); in edit_string()
142 string->last_cursor = string->cursor; in edit_string()
143 string->mod_start = string->cursor; in edit_string()
144 string->mod_end = string->cursor; in edit_string()
149 insert_character ( string, key ); in edit_string()
153 backspace ( string ); in edit_string()
158 delete_character ( string ); in edit_string()
162 kill_eol ( string ); in edit_string()
167 string->cursor = 0; in edit_string()
172 string->cursor = len; in edit_string()
177 if ( string->cursor > 0 ) in edit_string()
178 string->cursor--; in edit_string()
183 if ( string->cursor < len ) in edit_string()
184 string->cursor++; in edit_string()