mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +03:00
[readline] Add replace_string()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -117,6 +117,17 @@ static void kill_eol ( struct edit_string *string ) {
|
|||||||
insert_delete ( string, ~( ( size_t ) 0 ), NULL );
|
insert_delete ( string, ~( ( size_t ) 0 ), NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace editable string
|
||||||
|
*
|
||||||
|
* @v string Editable string
|
||||||
|
* @v replacement Replacement string
|
||||||
|
*/
|
||||||
|
void replace_string ( struct edit_string *string, const char *replacement ) {
|
||||||
|
string->cursor = 0;
|
||||||
|
insert_delete ( string, ~( ( size_t ) 0 ), replacement );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit editable string
|
* Edit editable string
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ static inline void init_editstring ( struct edit_string *string, char *buf,
|
|||||||
string->len = len;
|
string->len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void replace_string ( struct edit_string *string,
|
||||||
|
const char *replacement ) __nonnull;
|
||||||
extern int edit_string ( struct edit_string *string, int key ) __nonnull;
|
extern int edit_string ( struct edit_string *string, int key ) __nonnull;
|
||||||
|
|
||||||
#endif /* _IPXE_EDITSTRING_H */
|
#endif /* _IPXE_EDITSTRING_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user