1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
2 | * File: screen.c |
2 | * File: screen.c |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * $Id: screen.C,v 1.12 2003/12/18 14:11:47 pcg Exp $ |
4 | * $Id: screen.C,v 1.14 2003/12/26 07:42:23 pcg Exp $ |
5 | * |
5 | * |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
289 | else if (nrow > prev_nrow) |
289 | else if (nrow > prev_nrow) |
290 | { |
290 | { |
291 | /* add rows */ |
291 | /* add rows */ |
292 | scr_reset_realloc (); /* realloc _first_ */ |
292 | scr_reset_realloc (); /* realloc _first_ */ |
293 | |
293 | |
294 | TermWin.ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this |
294 | TermWin.ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this |
295 | |
295 | |
296 | k = min (TermWin.nscrolled, nrow - prev_nrow); |
296 | k = min (TermWin.nscrolled, nrow - prev_nrow); |
297 | |
297 | |
298 | for (p = prev_total_rows; p < total_rows; p++) |
298 | for (p = prev_total_rows; p < total_rows; p++) |
299 | { |
299 | { |
… | |
… | |
899 | case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; |
899 | case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; |
900 | case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; |
900 | case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; |
901 | } |
901 | } |
902 | |
902 | |
903 | rend_t rend = SET_FONT (R->rstyle, R->TermWin.fontset->find_font (c)); |
903 | rend_t rend = SET_FONT (R->rstyle, R->TermWin.fontset->find_font (c)); |
|
|
904 | // rely on wcwidth to tell us the character width, at least for non-ascii |
|
|
905 | int width = c <= 128 ? 1 : wcwidth (c); |
904 | |
906 | |
905 | stp[R->screen.cur.col] = c; |
907 | // width 0 characters (e.g. combining chars) are ignored. your problem, really |
906 | srp[R->screen.cur.col] = rend; |
908 | while (width-- > 0) |
907 | |
|
|
908 | if (c > 255) |
|
|
909 | { |
909 | { |
910 | // rely on wcwidth to tell us the character width, at least for non iso-8859-1 |
910 | stp[R->screen.cur.col] = c; |
911 | int width = wcwidth (c); |
911 | srp[R->screen.cur.col] = rend; |
|
|
912 | |
|
|
913 | if (R->screen.cur.col < last_col - 1) |
|
|
914 | R->screen.cur.col++; |
912 | |
915 | else |
913 | if (width > 1) |
|
|
914 | { |
916 | { |
915 | while (--width > 0 && R->screen.cur.col < last_col - 1) |
917 | R->screen.tlen[row] = last_col; |
|
|
918 | if (R->screen.flags & Screen_Autowrap) |
|
|
919 | R->screen.flags |= Screen_WrapNext; |
916 | { |
920 | break; |
917 | |
|
|
918 | srp[R->screen.cur.col] |= RS_wide; |
|
|
919 | |
|
|
920 | R->screen.cur.col++; |
|
|
921 | stp[R->screen.cur.col] = NOCHAR; |
|
|
922 | srp[R->screen.cur.col] = rend; |
|
|
923 | } |
|
|
924 | } |
921 | } |
|
|
922 | |
|
|
923 | c = NOCHAR; |
925 | } |
924 | } |
926 | |
|
|
927 | if (R->screen.cur.col < last_col - 1) |
|
|
928 | R->screen.cur.col++; |
|
|
929 | else { |
|
|
930 | R->screen.tlen[row] = last_col; |
|
|
931 | if (R->screen.flags & Screen_Autowrap) |
|
|
932 | R->screen.flags |= Screen_WrapNext; |
|
|
933 | } |
|
|
934 | } |
925 | } |
935 | if (R->screen.tlen[row] != -1) /* XXX: think about this */ |
926 | if (R->screen.tlen[row] != -1) /* XXX: think about this */ |
936 | MAX_IT(R->screen.tlen[row], R->screen.cur.col); |
927 | MAX_IT(R->screen.tlen[row], R->screen.cur.col); |
937 | |
928 | |
938 | /* |
929 | /* |