mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-17 23:06:25 -05:00
Merge common code for setting prompt of search and incremental search.
This commit is contained in:
parent
ac267617ae
commit
247fcfdfb8
@ -209,7 +209,7 @@ static int isearch(int f, int n)
|
||||
start_over:
|
||||
|
||||
/* ask the user for the text of a pattern */
|
||||
col = promptpattern( "I-Search") ; /* Prompt, remember the col */
|
||||
col = promptpattern( "ISearch") ; /* Prompt, remember the col */
|
||||
|
||||
cpos = 0; /* Start afresh */
|
||||
status = TRUE; /* Assume everything's cool */
|
||||
@ -432,11 +432,7 @@ static int promptpattern(char *prompt)
|
||||
{
|
||||
char tpat[NPAT + 20];
|
||||
|
||||
strncpy( tpat, prompt, 8) ; /* copy prompt to output string */
|
||||
tpat[ 8] = '\0' ; /* only one pattern "I-Search" */
|
||||
strcat(tpat, " ("); /* build new prompt string */
|
||||
expandp(pat, &tpat[strlen(tpat)], NPAT / 2); /* add old pattern */
|
||||
strcat(tpat, ")<Meta>: ");
|
||||
setprompt( tpat, NPAT / 2, prompt, pat) ;
|
||||
|
||||
/* check to see if we are executing a command line */
|
||||
if (!clexec) {
|
||||
|
14
search.c
14
search.c
@ -682,6 +682,14 @@ int eq(unsigned char bc, unsigned char pc)
|
||||
return bc == pc;
|
||||
}
|
||||
|
||||
void setprompt( char *tpat, unsigned tpat_size, char *prompt, char *apat) {
|
||||
strncpy( tpat, prompt, 14) ; /* copy prompt to output string */
|
||||
tpat[ 14] = '\0' ; /* longest prompt is "Reverse Search" */
|
||||
strcat( tpat, " (") ; /* build new prompt string */
|
||||
expandp( apat, &tpat[ strlen( tpat)], tpat_size) ; /* add old pattern */
|
||||
strcat( tpat, ")<Meta>: ") ;
|
||||
}
|
||||
|
||||
/*
|
||||
* readpattern -- Read a pattern. Stash it in apat. If it is the
|
||||
* search string, create the reverse pattern and the magic
|
||||
@ -698,11 +706,7 @@ static int readpattern(char *prompt, char *apat, int srch)
|
||||
int status;
|
||||
char tpat[NPAT + 20];
|
||||
|
||||
strncpy( tpat, prompt, 14) ; /* copy prompt to output string */
|
||||
tpat[ 14] = '\0' ; /* longest prompt is "Reverse Search" */
|
||||
strcat(tpat, " ("); /* build new prompt string */
|
||||
expandp(&apat[0], &tpat[strlen(tpat)], NPAT / 2); /* add old pattern */
|
||||
strcat(tpat, ")<Meta>: ");
|
||||
setprompt( tpat, NPAT / 2, prompt, apat) ;
|
||||
|
||||
/* Read a pattern. Either we get one,
|
||||
* or we just get the META charater, and use the previous pattern.
|
||||
|
2
search.h
2
search.h
@ -39,6 +39,8 @@ int delins( int dlength, char *instr, int use_meta) ;
|
||||
int expandp( char *srcstr, char *deststr, int maxlength) ;
|
||||
int boundry( struct line *curline, int curoff, int dir) ;
|
||||
|
||||
void setprompt( char *tpat, unsigned tpat_size, char *prompt, char *apat) ;
|
||||
|
||||
#if MAGIC
|
||||
void mcclear( void) ;
|
||||
void rmcclear( void) ;
|
||||
|
Loading…
Reference in New Issue
Block a user