1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-17 18:16:22 -05:00

Align implementation of overwrite-string with insert-string.

This commit is contained in:
Renaud 2015-09-28 13:37:22 +08:00
parent cbbd860bdc
commit 3ffa8967ef

View File

@ -1184,19 +1184,12 @@ int fmatch(int ch)
return TRUE;
}
/*
* ask for and insert a string into the current
* buffer at the current point
*
* int f, n; ignored arguments
*/
int istring(int f, int n)
{
static int iovstring( int f, int n, const char *prompt, int (*fun)( char *)) {
int status ; /* status return code */
char *tstring ; /* string to add */
/* ask for string to insert */
tstring = newmlreplyt( "String to insert<META>: ") ;
tstring = newmlreplyt( prompt) ;
if( tstring == NULL)
return FALSE ;
@ -1208,36 +1201,30 @@ int istring(int f, int n)
/* insert it */
status = TRUE ;
while( n-- && status)
status = linstr( tstring) ;
status = fun( tstring) ;
free( tstring) ;
return status ;
}
/*
* ask for and insert a string into the current
* buffer at the current point
*
* int f, n; ignored arguments
*/
int istring( int f, int n) {
return iovstring( f, n, "String to insert<META>: ", linstr) ;
}
/*
* ask for and overwite a string into the current
* buffer at the current point
*
* int f, n; ignored arguments
*/
int ovstring(int f, int n)
{
int status; /* status return code */
char tstring[ NSTRING + 1] ; /* string to add */
/* ask for string to insert */
status =
mlreplyt( "String to overwrite<META>: ", tstring, NSTRING) ;
if (status != TRUE)
return status;
if (f == FALSE)
n = 1;
if (n < 0)
n = -n;
/* insert it */
while (n-- && (status = lover(tstring)));
return status;
int ovstring( int f, int n) {
return iovstring( f, n, "String to overwrite<META>: ", lover) ;
}
/* end of random.c */