comparison mcabber/src/screen.c @ 1486:f83a51eaa5ed

Fix multiline output in /buffer save
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 Apr 2008 16:56:43 +0200
parents 0121b6f3047c
children f61ed2466f7c
comparison
equal deleted inserted replaced
1485:0121b6f3047c 1486:f83a51eaa5ed
829 17, 829 17,
830 11, 830 11,
831 6 831 6
832 }; 832 };
833 833
834 static const char *gettprefix() 834 static const char *gettprefix(void)
835 { 835 {
836 guint n = settings_opt_get_int("time_prefix"); 836 guint n = settings_opt_get_int("time_prefix");
837 return timeprefixes[(n < 3 ? n : 0)]; 837 return timeprefixes[(n < 3 ? n : 0)];
838 } 838 }
839 839
840 static const char *getspectprefix() 840 static const char *getspectprefix(void)
841 { 841 {
842 guint n = settings_opt_get_int("time_prefix"); 842 guint n = settings_opt_get_int("time_prefix");
843 return spectimeprefixes[(n < 3 ? n : 0)]; 843 return spectimeprefixes[(n < 3 ? n : 0)];
844 } 844 }
845 845
846 static unsigned getprefixwidth() 846 guint getprefixwidth(void)
847 { 847 {
848 guint n = settings_opt_get_int("time_prefix"); 848 guint n = settings_opt_get_int("time_prefix");
849 return timepreflengths[(n < 3 ? n : 0)]; 849 return timepreflengths[(n < 3 ? n : 0)];
850 } 850 }
851 851
1050 // scr_UpdateWindow() 1050 // scr_UpdateWindow()
1051 // (Re-)Display the given chat window. 1051 // (Re-)Display the given chat window.
1052 static void scr_UpdateWindow(winbuf *win_entry) 1052 static void scr_UpdateWindow(winbuf *win_entry)
1053 { 1053 {
1054 int n; 1054 int n;
1055 int width, prefixwidth; 1055 int width;
1056 guint prefixwidth;
1056 char pref[96]; 1057 char pref[96];
1057 hbb_line **lines, *line; 1058 hbb_line **lines, *line;
1058 GList *hbuf_head; 1059 GList *hbuf_head;
1059 int color; 1060 int color;
1060 1061
1061 width = getmaxx(win_entry->win); 1062 width = getmaxx(win_entry->win);
1062 prefixwidth = getprefixwidth(); 1063 prefixwidth = getprefixwidth();
1064 prefixwidth = MIN(prefixwidth, sizeof pref);
1063 1065
1064 // Should the window be empty? 1066 // Should the window be empty?
1065 if (win_entry->bd->cleared) { 1067 if (win_entry->bd->cleared) {
1066 werase(win_entry->win); 1068 werase(win_entry->win);
1067 return; 1069 return;
1110 1112
1111 if (color != COLOR_GENERAL) 1113 if (color != COLOR_GENERAL)
1112 wattrset(win_entry->win, get_color(color)); 1114 wattrset(win_entry->win, get_color(color));
1113 1115
1114 // Generate the prefix area and display it 1116 // Generate the prefix area and display it
1115 scr_line_prefix(line, pref, sizeof pref); 1117 scr_line_prefix(line, pref, prefixwidth);
1116 wprintw(win_entry->win, pref); 1118 wprintw(win_entry->win, pref);
1117 1119
1118 // Make sure we are at the right position 1120 // Make sure we are at the right position
1119 wmove(win_entry->win, n, prefixwidth-1); 1121 wmove(win_entry->win, n, prefixwidth-1);
1120 1122