mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-17 15:06:21 -05:00
Revise line primitives linstr() and lover()
This commit is contained in:
parent
62e1109802
commit
a370d748c4
36
line.c
36
line.c
@ -266,8 +266,8 @@ void lchange(int flag)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* insert spaces forward into text
|
||||
|
||||
/* insert spaces forward into text
|
||||
*
|
||||
* int f, n; default flag and numeric argument
|
||||
*/
|
||||
@ -278,23 +278,18 @@ BINDABLE( insspace) {
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
* linstr -- Insert a string at the current point
|
||||
*/
|
||||
|
||||
int linstr( char *instr) {
|
||||
int status = TRUE ;
|
||||
|
||||
/* linstr -- Insert a string at the current point */
|
||||
boolean linstr( char *instr) {
|
||||
boolean status = TRUE ;
|
||||
if( instr != NULL) {
|
||||
unicode_t tmpc ;
|
||||
int c ;
|
||||
|
||||
while( (tmpc = *instr++ & 0xFF)) {
|
||||
status = (tmpc == '\n') ? lnewline() : linsert_byte( 1, tmpc) ;
|
||||
|
||||
/* Insertion error? */
|
||||
if( status != TRUE) {
|
||||
while( (c = (unsigned char) *instr++)) {
|
||||
status = (c == '\n') ? lnewline() : linsert_byte( 1, c) ;
|
||||
if( status != TRUE) { /* Insertion error? */
|
||||
mloutstr( "%Out of memory while inserting") ;
|
||||
return status ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -432,14 +427,13 @@ static boolean lowrite( int c) {
|
||||
|
||||
|
||||
/* lover -- Overwrite a string at the current point */
|
||||
int lover( char *ostr) {
|
||||
int status = TRUE ;
|
||||
|
||||
boolean lover( char *ostr) {
|
||||
boolean status = TRUE ;
|
||||
if( ostr != NULL) {
|
||||
char tmpc ;
|
||||
int c ;
|
||||
|
||||
while( (tmpc = *ostr++)) {
|
||||
status = (tmpc == '\n' ? lnewline() : lowrite( tmpc)) ;
|
||||
while( (c = (unsigned char) *ostr++)) {
|
||||
status = (c == '\n') ? lnewline() : lowrite( c) ;
|
||||
if( status != TRUE) { /* Insertion error? */
|
||||
mloutstr( "%Out of memory while overwriting") ;
|
||||
break ;
|
||||
|
4
line.h
4
line.h
@ -39,10 +39,10 @@ BBINDABLE( forwchar) ;
|
||||
|
||||
void lfree( line_p lp) ;
|
||||
void lchange( int flag) ;
|
||||
int linstr( char *instr) ;
|
||||
boolean linstr( char *instr) ;
|
||||
boolean linsert( int n, unicode_t c) ;
|
||||
boolean linsert_byte( int n, int c) ;
|
||||
int lover( char *ostr) ;
|
||||
boolean lover( char *ostr) ;
|
||||
boolean lnewline( void) ;
|
||||
boolean ldelete( long n, boolean kflag) ;
|
||||
boolean ldelchar( long n, boolean kflag) ;
|
||||
|
2
random.c
2
random.c
@ -837,7 +837,7 @@ static int adjustmode( int kind, int global) {
|
||||
}
|
||||
|
||||
|
||||
static int iovstring( int f, int n, const char *prompt, int (*fun)( char *)) {
|
||||
static int iovstring( int f, int n, const char *prompt, boolean (*fun)( char *)) {
|
||||
char *tstring ; /* string to add */
|
||||
|
||||
/* ask for string to insert */
|
||||
|
Loading…
Reference in New Issue
Block a user