mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-19 07:46:24 -05:00
Review inspound, '#' insertion in C mode.
This commit is contained in:
parent
c390cf2a3e
commit
8dfa92ba44
26
execute.c
26
execute.c
@ -14,6 +14,32 @@
|
|||||||
int gasave = 256 ; /* global ASAVE size */
|
int gasave = 256 ; /* global ASAVE size */
|
||||||
int gacount = 256 ; /* count until next ASAVE */
|
int gacount = 256 ; /* count until next ASAVE */
|
||||||
|
|
||||||
|
|
||||||
|
/* insert a # into the text here...we are in CMODE */
|
||||||
|
static int inspound( void) {
|
||||||
|
/* if we are at the beginning of the line, no go */
|
||||||
|
if( curwp->w_doto != 0) {
|
||||||
|
int i ;
|
||||||
|
|
||||||
|
/* scan to see if all space before this is white space */
|
||||||
|
for( i = curwp->w_doto - 1 ; i >= 0 ; i -= 1) {
|
||||||
|
int ch ; /* last character before input */
|
||||||
|
|
||||||
|
ch = lgetc( curwp->w_dotp, i) ;
|
||||||
|
if( ch != ' ' && ch != '\t')
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* delete back first */
|
||||||
|
if( i < 0)
|
||||||
|
while( getccol( FALSE) >= 1)
|
||||||
|
backdel( FALSE, 1) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* and insert the required pound */
|
||||||
|
return linsert( 1, '#') ;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the general command execution routine. It handles the fake binding
|
* This is the general command execution routine. It handles the fake binding
|
||||||
* of all the keys to "self-insert". It also clears out the "thisflag" word,
|
* of all the keys to "self-insert". It also clears out the "thisflag" word,
|
||||||
|
24
random.c
24
random.c
@ -704,30 +704,6 @@ int insbrace(int n, int c)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int inspound(void)
|
|
||||||
{ /* insert a # into the text here...we are in CMODE */
|
|
||||||
int ch; /* last character before input */
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* if we are at the beginning of the line, no go */
|
|
||||||
if (curwp->w_doto == 0)
|
|
||||||
return linsert(1, '#');
|
|
||||||
|
|
||||||
/* scan to see if all space before this is white space */
|
|
||||||
for (i = curwp->w_doto - 1; i >= 0; --i) {
|
|
||||||
ch = lgetc(curwp->w_dotp, i);
|
|
||||||
if (ch != ' ' && ch != '\t')
|
|
||||||
return linsert(1, '#');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* delete back first */
|
|
||||||
while (getccol(FALSE) >= 1)
|
|
||||||
backdel(FALSE, 1);
|
|
||||||
|
|
||||||
/* and insert the required pound */
|
|
||||||
return linsert(1, '#');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete blank lines around dot. What this command does depends if dot is
|
* Delete blank lines around dot. What this command does depends if dot is
|
||||||
* sitting on a blank line. If dot is sitting on a blank line, this command
|
* sitting on a blank line. If dot is sitting on a blank line, this command
|
||||||
|
1
random.h
1
random.h
@ -30,7 +30,6 @@ int trim( int f, int n) ;
|
|||||||
int openline( int f, int n) ;
|
int openline( int f, int n) ;
|
||||||
int insert_newline( int f, int n) ;
|
int insert_newline( int f, int n) ;
|
||||||
int insbrace( int n, int c) ;
|
int insbrace( int n, int c) ;
|
||||||
int inspound( void) ;
|
|
||||||
int deblank( int f, int n) ;
|
int deblank( int f, int n) ;
|
||||||
int indent( int f, int n) ;
|
int indent( int f, int n) ;
|
||||||
int forwdel( int f, int n) ;
|
int forwdel( int f, int n) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user