# HG changeset patch # User ali # Date 1381005451 -3600 # Node ID 783eff3047bc0827c354408c4d666ee0523d48e4 # Parent 37da646396b98688519d402293acf70d6a6aa300 Fix bug #21: False positive: Opening slanted double-quote, followed by single slanted quote, should be accepted by BL diff -r 37da646396b9 -r 783eff3047bc bookloupe/bookloupe.c --- a/bookloupe/bookloupe.c Tue Oct 15 07:57:45 2013 +0100 +++ b/bookloupe/bookloupe.c Sat Oct 05 21:37:31 2013 +0100 @@ -1478,7 +1478,7 @@ } s1=g_utf8_next_char(g_utf8_next_char(t)); while (*s1 && !g_unichar_isalpha(g_utf8_get_char(s1)) && - !isdigit(g_utf8_get_char(s1))) + !g_unichar_isdigit(g_utf8_get_char(s1))) s1=g_utf8_next_char(s1); if (g_unichar_islower(g_utf8_get_char(s1))) { @@ -2036,7 +2036,7 @@ if (!parity) { /* parity even */ - if (!g_utf8_strchr("_-.'`/,;:!?)]} ",-1,nc)) + if (!g_utf8_strchr("_-.'`‘’/,;:!?)]} ",-1,nc)) { if (pswit[ECHO_SWITCH]) g_print("\n%s\n",aline); @@ -2051,8 +2051,8 @@ else { /* parity odd */ - if (!g_unichar_isalpha(nc) && !isdigit(nc) && - !g_utf8_strchr("_-/.'`([{$",-1,nc) || !nc) + if (!g_unichar_isalpha(nc) && !g_unichar_isdigit(nc) && + !g_utf8_strchr("_-/.'`‘’([{$",-1,nc) || !nc) { if (pswit[ECHO_SWITCH]) g_print("\n%s\n",aline); @@ -2111,7 +2111,7 @@ else { /* parity odd */ - if (!g_unichar_isalpha(nc) && !isdigit(nc) && + if (!g_unichar_isalpha(nc) && !g_unichar_isdigit(nc) && !g_utf8_strchr("_-/\".'`",-1,nc) || !nc) { if (pswit[ECHO_SWITCH]) @@ -2777,9 +2777,27 @@ for (;;) { c=g_utf8_get_char(*etext); + if (!c) + { + if (*etext==theline) + return NULL; + else if (pswit[LINE_END_SWITCH]) + { + if (pswit[ECHO_SWITCH]) + { + s=g_strndup(theline,eos-theline); + g_print("\n%s\n",s); + g_free(s); + } + if (!pswit[OVERVIEW_SWITCH]) + /* There may, or may not, have been a CR */ + g_print(" Line %ld - No LF?\n",lcnt); + else + cnt_lineend++; + } + break; + } *etext=g_utf8_next_char(*etext); - if (!c) - return NULL; /* either way, it's end of line */ if (c=='\n') { diff -r 37da646396b9 -r 783eff3047bc test/bookloupe/curved-quotes.tst --- a/test/bookloupe/curved-quotes.tst Tue Oct 15 07:57:45 2013 +0100 +++ b/test/bookloupe/curved-quotes.tst Sat Oct 05 21:37:31 2013 +0100 @@ -19,6 +19,16 @@ you’d like to come.” “Sure! they chorused. + +* * * + +“‘Think I want to lug a bear two mile into camp?’ says he. ‘No, sir, I +lured this here bear in so’s I could kill him handy to where I wanted +him. I jest figgered to make him carry himself into camp,’ says he.” + +The widow shook her head. “’Tain’t nothin’ but a memento no more. Husbands +is all right, but enough’s enough. Let me make you acquainted with Miss +Ducharme, Mr. Ashe.” **************** WARNINGS ****************