Mercurial > emacs
comparison src/fontset.c @ 57921:a17e7dae99c0
(fontset_pattern_regexp): If '*' is preceded by '\',
treat it as a literal character.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 04 Nov 2004 02:26:43 +0000 |
parents | b935fc1cb542 |
children | 678d2c0d522e e24e2e78deda |
comparison
equal
deleted
inserted
replaced
57920:56342493afe3 | 57921:a17e7dae99c0 |
---|---|
794 | 794 |
795 for (p0 = SDATA (pattern); *p0; p0++) | 795 for (p0 = SDATA (pattern); *p0; p0++) |
796 { | 796 { |
797 if (*p0 == '-') | 797 if (*p0 == '-') |
798 ndashes++; | 798 ndashes++; |
799 else if (*p0 == '*') | 799 else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') |
800 nstars++; | 800 nstars++; |
801 } | 801 } |
802 | 802 |
803 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise | 803 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise |
804 we convert "*" to "[^-]*" which is much faster in regular | 804 we convert "*" to "[^-]*" which is much faster in regular |
809 p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); | 809 p1 = regex = (char *) alloca (SBYTES (pattern) + 5 * nstars + 1); |
810 | 810 |
811 *p1++ = '^'; | 811 *p1++ = '^'; |
812 for (p0 = (char *) SDATA (pattern); *p0; p0++) | 812 for (p0 = (char *) SDATA (pattern); *p0; p0++) |
813 { | 813 { |
814 if (*p0 == '*') | 814 if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') |
815 { | 815 { |
816 if (ndashes < 14) | 816 if (ndashes < 14) |
817 *p1++ = '.'; | 817 *p1++ = '.'; |
818 else | 818 else |
819 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']'; | 819 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']'; |