1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
2 | * File: screen.c |
2 | * File: screen.c |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * $Id: screen.C,v 1.13 2003/12/24 09:22:29 pcg Exp $ |
4 | * $Id: screen.C,v 1.15 2004/01/16 16:34:56 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 |
… | |
… | |
447 | /* then so is screen.rend[i] */ |
447 | /* then so is screen.rend[i] */ |
448 | assert(screen.rend[i]); |
448 | assert(screen.rend[i]); |
449 | } |
449 | } |
450 | #endif |
450 | #endif |
451 | |
451 | |
452 | delete talloc; |
452 | delete talloc; talloc = 0; |
453 | delete ralloc; |
453 | delete ralloc; ralloc = 0; |
454 | |
454 | |
455 | free (screen.text); |
455 | free (screen.text); |
456 | free (screen.tlen); |
456 | free (screen.tlen); |
457 | free (screen.rend); |
457 | free (screen.rend); |
458 | free (drawn_text); |
458 | free (drawn_text); |
… | |
… | |
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 | /* |