… | |
… | |
767 | int wrapped = 0; |
767 | int wrapped = 0; |
768 | const char *break_p = NULL; |
768 | const char *break_p = NULL; |
769 | |
769 | |
770 | while (*p) |
770 | while (*p) |
771 | { |
771 | { |
|
|
772 | int cw, len; |
|
|
773 | |
772 | /* find the length in bytes of the next multibyte character */ |
774 | /* find the length in bytes of the next multibyte character */ |
773 | int len = mblen (p, l); |
775 | len = mblen (p, l); |
774 | if (len <= 0) |
776 | if (len <= 0) |
775 | len = 1; /* ignore (don't skip) illegal character sequences */ |
777 | len = 1; /* ignore (don't skip) illegal character sequences */ |
776 | |
778 | |
777 | /* find the width in pixels of the next character */ |
779 | /* find the width in pixels of the next character */ |
778 | int cw = XmbTextEscapement (fontset, p, len); |
780 | cw = XmbTextEscapement (fontset, p, len); |
779 | if (cw + w > width - effect_x_space) |
781 | if (cw + w > width - effect_x_space) |
780 | { |
782 | { |
781 | if (p == beg) |
783 | if (p == beg) |
782 | { |
784 | { |
783 | fprintf (stderr, "we can't even fit a single character onto the line\n"); |
785 | fprintf (stderr, "we can't even fit a single character onto the line\n"); |
… | |
… | |
855 | } |
857 | } |
856 | |
858 | |
857 | static void |
859 | static void |
858 | main_loop (void) |
860 | main_loop (void) |
859 | { |
861 | { |
860 | lines = xmalloc (sizeof (struct linematrix) * listlen); |
|
|
861 | display = xmalloc (sizeof (struct displaymatrix) * listlen); |
|
|
862 | int lin; |
862 | int lin; |
863 | time_t lastreload; |
863 | time_t lastreload; |
864 | Region region = XCreateRegion (); |
864 | Region region = XCreateRegion (); |
865 | XEvent xev; |
865 | XEvent xev; |
866 | struct logfile_entry *lastprinted = NULL; |
866 | struct logfile_entry *lastprinted = NULL; |
867 | struct logfile_entry *current; |
867 | struct logfile_entry *current; |
868 | int need_update = 1; |
868 | int need_update = 1; |
|
|
869 | |
|
|
870 | lines = xmalloc (sizeof (struct linematrix) * listlen); |
|
|
871 | display = xmalloc (sizeof (struct displaymatrix) * listlen); |
869 | |
872 | |
870 | lastreload = time (NULL); |
873 | lastreload = time (NULL); |
871 | |
874 | |
872 | /* Initialize linematrix */ |
875 | /* Initialize linematrix */ |
873 | for (lin = 0; lin < listlen; lin++) |
876 | for (lin = 0; lin < listlen; lin++) |