From 2953531913ff48f7574305f9a6942953f225a061 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Fri, 13 Feb 2015 15:33:21 +0800 Subject: [PATCH] Insure that mlwrite( "") as same effect as mlerase(). --- Makefile | 6 +++--- buffer.c | 6 +++--- display.c | 4 ++-- mlout.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d555f94..ea5408a 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ bindable.o: bindable.c bindable.h defines.h buffer.h crypt.h line.h \ retcode.h utf8.h display.h estruct.h file.h input.h bind.h lock.h \ mlout.h terminal.h buffer.o: buffer.c buffer.h crypt.h line.h retcode.h utf8.h defines.h \ - display.h estruct.h file.h input.h bind.h window.h + estruct.h file.h input.h bind.h mlout.h window.h crypt.o: crypt.c crypt.h display.o: display.c display.h estruct.h buffer.h crypt.h line.h \ retcode.h utf8.h input.h bind.h termio.h terminal.h defines.h version.h \ @@ -164,8 +164,8 @@ line.o: line.c line.h retcode.h utf8.h buffer.h crypt.h estruct.h mlout.h \ window.h defines.h lock.o: lock.c estruct.h lock.h main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \ - line.h retcode.h utf8.h display.h eval.h execute.h file.h input.h \ - mlout.h lock.h random.h search.h terminal.h defines.h termio.h version.h \ + line.h retcode.h utf8.h display.h eval.h execute.h file.h input.h lock.h \ + mlout.h random.h search.h terminal.h defines.h termio.h version.h \ window.h mingw32.o: mingw32.c mlout.o: mlout.c mlout.h diff --git a/buffer.c b/buffer.c index 625e1b7..341e6d4 100644 --- a/buffer.c +++ b/buffer.c @@ -17,10 +17,10 @@ #include #include "defines.h" -#include "display.h" #include "estruct.h" #include "file.h" #include "input.h" +#include "mlout.h" #include "window.h" @@ -189,7 +189,7 @@ int zotbuf(struct buffer *bp) int s; if (bp->b_nwnd != 0) { /* Error if on screen. */ - mlwrite("Buffer is being displayed"); + mloutstr("Buffer is being displayed"); return FALSE; } if ((s = bclear(bp)) != TRUE) /* Blow text away. */ @@ -238,7 +238,7 @@ int namebuffer(int f, int n) strcpy(curbp->b_bname, bufn); /* copy buffer name to structure */ curwp->w_flag |= WFMODE; /* make mode line replot */ - mlerase(); + mloutstr( "") ; /* erase message line */ return TRUE; } diff --git a/display.c b/display.c index 69e0e13..18bc062 100644 --- a/display.c +++ b/display.c @@ -1370,6 +1370,7 @@ void mlwrite(const char *fmt, ...) else movecursor( term.t_nrow, 0) ; + mpresf = *fmt ? TRUE : FALSE ; /* flag if line has content or not */ va_start(ap, fmt); while ((c = *fmt++) != 0) { if (c != '%') @@ -1417,7 +1418,6 @@ void mlwrite(const char *fmt, ...) TTeeol() ; TTflush(); - mpresf = TRUE; } /* @@ -1432,7 +1432,7 @@ void mlforce( char *s) { oldcmd = discmd; /* save the discmd value */ discmd = TRUE; /* and turn display on */ - mlwrite( "%s", s) ; /* write the string out */ + mlwrite( (*s) ? "%s" : "", s) ; /* write the string out or erase line */ discmd = oldcmd; /* and restore the original setting */ } diff --git a/mlout.c b/mlout.c index 73f6eb2..3c7ebd0 100644 --- a/mlout.c +++ b/mlout.c @@ -9,7 +9,7 @@ static void mloutdump( const char *buf, ...) { void (*mloutfmt)( const char *, ...) = mloutdump ; void mloutstr( const char *str) { - mloutfmt( "%s", str) ; + mloutfmt( (*str) ? "%s" : "", str) ; } /* end of mlout.c */