mirror of
https://github.com/rfivet/uemacs.git
synced 2024-06-29 21:15:30 +00:00
Insure writing on message line does not exceed terminal size.
This commit is contained in:
parent
daa6395128
commit
09d5907f9e
62
display.c
62
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,12 +1307,9 @@ 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) ;
|
||||||
|
@ -1326,13 +1321,24 @@ void mlerase(void)
|
||||||
|
|
||||||
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, 1) ; /* force the move! */
|
||||||
movecursor( term.t_nrow, 0) ;
|
movecursor( term.t_nrow, 0) ;
|
||||||
}
|
}
|
||||||
TTflush();
|
|
||||||
mpresf = FALSE ;
|
mpresf = FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TTflush() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mlputc( char c) {
|
||||||
|
if( ttcol < term.t_ncol) {
|
||||||
|
TTputc( c) ;
|
||||||
|
++ttcol ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a message into the message line. Keep track of the physical cursor
|
* Write a message into the message line. Keep track of the physical cursor
|
||||||
* position. A small class of printf like format items is handled. Assumes the
|
* position. A small class of printf like format items is handled. Assumes the
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1439,7 +1443,7 @@ void mlforce( char *s) {
|
||||||
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,14 +1453,13 @@ 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 ;
|
||||||
|
@ -1464,20 +1467,18 @@ static void mlputi(int i, int 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 ;
|
||||||
|
@ -1485,8 +1486,7 @@ static void mlputli(long l, int 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,8 +1494,7 @@ 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 */
|
||||||
|
|
||||||
|
@ -1505,10 +1504,9 @@ static void mlputf(int s)
|
||||||
|
|
||||||
/* 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