Re: edit_status () prints bad status line



Pavel Tsekov wrote:
For further explanation read my email regarding the internal editor + ncurses, the section which quotes
the `addch' manpage. Also read the printf (3) manpage
regarding the use of '*'.


Might this help?

Roland
Index: edit/editdraw.c
===================================================================
RCS file: /cvsroot/mc/mc/edit/editdraw.c,v
retrieving revision 1.34
diff -u -p -r1.34 editdraw.c
--- edit/editdraw.c	23 Oct 2004 13:14:14 -0000	1.34
+++ edit/editdraw.c	31 Oct 2004 17:39:00 -0000
@@ -115,9 +115,9 @@ edit_status (WEdit *edit)
 
     widget_move (edit, 0, 0);
     attrset (SELECTED_COLOR);
-    printw ("%-*s", fname_len + gap, fname);
+    printwstr (fname, fname_len + gap);
     if (fname_len + gap < w)
-        printw ("%-*s  ", w - (fname_len + gap), status);
+        printwstr (status, w - (fname_len + gap));
     attrset (EDITOR_NORMAL_COLOR);
 
     g_free (status);
Index: src/tty.h
===================================================================
RCS file: /cvsroot/mc/mc/src/tty.h,v
retrieving revision 1.8
diff -u -p -r1.8 tty.h
--- src/tty.h	8 Sep 2002 16:22:55 -0000	1.8
+++ src/tty.h	31 Oct 2004 17:39:00 -0000
@@ -32,4 +32,9 @@ int got_interrupt (void);
 
 void mc_refresh (void);
 
+static inline void printwstr (const char *s, int len)
+{
+    printw("%-*.*s", len, len, s);
+}
+
 #endif /* !__MC_TTY_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]