mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 15:26:23 -05:00
Insure writing on message line does not exceed terminal size.
This commit is contained in:
parent
daa6395128
commit
09d5907f9e
128
display.c
128
display.c
@ -159,9 +159,7 @@ void vtfree(void)
|
|||||||
*/
|
*/
|
||||||
void vttidy(void)
|
void vttidy(void)
|
||||||
{
|
{
|
||||||
mlerase();
|
mlerase() ; /* ends with movecursor( term.t_nrow, 0) and TTflush() */
|
||||||
movecursor(term.t_nrow, 0);
|
|
||||||
TTflush();
|
|
||||||
TTclose();
|
TTclose();
|
||||||
TTkclose();
|
TTkclose();
|
||||||
#ifdef PKCODE
|
#ifdef PKCODE
|
||||||
@ -1309,28 +1307,36 @@ void movecursor(int row, int col)
|
|||||||
* is not considered to be part of the virtual screen. It always works
|
* is not considered to be part of the virtual screen. It always works
|
||||||
* immediately; the terminal buffer is flushed via a call to the flusher.
|
* immediately; the terminal buffer is flushed via a call to the flusher.
|
||||||
*/
|
*/
|
||||||
void mlerase(void)
|
void mlerase( void) {
|
||||||
{
|
movecursor( term.t_nrow, 0) ;
|
||||||
movecursor(term.t_nrow, 0);
|
if( discmd != FALSE) {
|
||||||
if (discmd == FALSE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if COLOR
|
#if COLOR
|
||||||
TTforg(7);
|
TTforg( 7) ;
|
||||||
TTbacg(0);
|
TTbacg( 0) ;
|
||||||
#endif
|
#endif
|
||||||
if (eolexist == TRUE)
|
if( eolexist == TRUE)
|
||||||
TTeeol();
|
TTeeol() ;
|
||||||
else {
|
else {
|
||||||
int i ;
|
int i ;
|
||||||
|
|
||||||
for( i = 1 ; i < term.t_ncol ; i++)
|
for( i = 1 ; i < term.t_ncol ; i++)
|
||||||
TTputc(' ');
|
TTputc(' ') ;
|
||||||
movecursor(term.t_nrow, 1); /* force the move! */
|
|
||||||
movecursor(term.t_nrow, 0);
|
movecursor( term.t_nrow, 1) ; /* force the move! */
|
||||||
|
movecursor( term.t_nrow, 0) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
mpresf = FALSE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
TTflush() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mlputc( char c) {
|
||||||
|
if( ttcol < term.t_ncol) {
|
||||||
|
TTputc( c) ;
|
||||||
|
++ttcol ;
|
||||||
}
|
}
|
||||||
TTflush();
|
|
||||||
mpresf = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1366,10 +1372,9 @@ void mlwrite(const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
while ((c = *fmt++) != 0) {
|
while ((c = *fmt++) != 0) {
|
||||||
if (c != '%') {
|
if (c != '%')
|
||||||
TTputc(c);
|
mlputc( c) ;
|
||||||
++ttcol;
|
else {
|
||||||
} else {
|
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@ -1401,8 +1406,7 @@ void mlwrite(const char *fmt, ...)
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TTputc(c);
|
mlputc( c) ;
|
||||||
++ttcol;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1437,11 +1441,11 @@ void mlforce( char *s) {
|
|||||||
* things will get screwed up a little.
|
* things will get screwed up a little.
|
||||||
*/
|
*/
|
||||||
static void mlputs( char *s) {
|
static void mlputs( char *s) {
|
||||||
int c;
|
int c ;
|
||||||
|
|
||||||
while ((c = *s++) != 0) {
|
while( ((c = *s++) != 0) && (ttcol < term.t_ncol)) {
|
||||||
TTputc(c);
|
TTputc( c) ;
|
||||||
++ttcol;
|
++ttcol ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1449,44 +1453,40 @@ static void mlputs( char *s) {
|
|||||||
* Write out an integer, in the specified radix. Update the physical cursor
|
* Write out an integer, in the specified radix. Update the physical cursor
|
||||||
* position.
|
* position.
|
||||||
*/
|
*/
|
||||||
static void mlputi(int i, int r)
|
static void mlputi( int i, int r) {
|
||||||
{
|
int q ;
|
||||||
int q;
|
static char hexdigits[] = "0123456789ABCDEF" ;
|
||||||
static char hexdigits[] = "0123456789ABCDEF";
|
|
||||||
|
|
||||||
if (i < 0) {
|
if( i < 0) {
|
||||||
i = -i;
|
i = -i ;
|
||||||
TTputc('-');
|
mlputc( '-') ;
|
||||||
}
|
}
|
||||||
|
|
||||||
q = i / r;
|
q = i / r ;
|
||||||
|
|
||||||
if (q != 0)
|
if( q != 0)
|
||||||
mlputi(q, r);
|
mlputi( q, r) ;
|
||||||
|
|
||||||
TTputc(hexdigits[i % r]);
|
mlputc( hexdigits[ i % r]) ;
|
||||||
++ttcol;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do the same except as a long integer.
|
* do the same except as a long integer.
|
||||||
*/
|
*/
|
||||||
static void mlputli(long l, int r)
|
static void mlputli( long l, int r) {
|
||||||
{
|
long q ;
|
||||||
long q;
|
|
||||||
|
|
||||||
if (l < 0) {
|
if( l < 0) {
|
||||||
l = -l;
|
l = -l ;
|
||||||
TTputc('-');
|
mlputc( '-') ;
|
||||||
}
|
}
|
||||||
|
|
||||||
q = l / r;
|
q = l / r ;
|
||||||
|
|
||||||
if (q != 0)
|
if( q != 0)
|
||||||
mlputli(q, r);
|
mlputli( q, r) ;
|
||||||
|
|
||||||
TTputc((int) (l % r) + '0');
|
mlputc( (int) (l % r) + '0') ;
|
||||||
++ttcol;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1494,21 +1494,19 @@ static void mlputli(long l, int r)
|
|||||||
*
|
*
|
||||||
* int s; scaled integer to output
|
* int s; scaled integer to output
|
||||||
*/
|
*/
|
||||||
static void mlputf(int s)
|
static void mlputf( int s) {
|
||||||
{
|
int i ; /* integer portion of number */
|
||||||
int i; /* integer portion of number */
|
int f ; /* fractional portion of number */
|
||||||
int f; /* fractional portion of number */
|
|
||||||
|
|
||||||
/* break it up */
|
/* break it up */
|
||||||
i = s / 100;
|
i = s / 100 ;
|
||||||
f = s % 100;
|
f = s % 100 ;
|
||||||
|
|
||||||
/* send out the integer portion */
|
/* send out the integer portion */
|
||||||
mlputi(i, 10);
|
mlputi( i, 10) ;
|
||||||
TTputc('.');
|
mlputc('.') ;
|
||||||
TTputc((f / 10) + '0');
|
mlputc((f / 10) + '0') ;
|
||||||
TTputc((f % 10) + '0');
|
mlputc((f % 10) + '0') ;
|
||||||
ttcol += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if RAINBOW
|
#if RAINBOW
|
||||||
|
Loading…
Reference in New Issue
Block a user