Version: 1.3.1 (using KDE 3.2.2, (testing/unstable)) Compiler: gcc version 3.3.3 (Debian 20040401) OS: Linux (i686) release 2.4.22 After an opening parenthesis, If I type double quotes and "replace double quotes with typographical quotes" is checked, closing typographical quotes are displayed instead of opening ones. (this happens when I want to put a quotation between parenthesis)
Happens for me too. Running cvs head from 09.07.2004. Cheers Jo
To be sure: are the right quotes defined in "Settings"/"Configure Autocorrection", tab "Custom Quotes"? Can you check that it is not a font problem? Have a nice day!
Sorry for the long time passed ! Yes, the rignt quotes are defined in "Settings"/"Configure Autocorrection",tab "Custom Quotes", and I don't think it is a font problem since it works fine when the opening quotes comes after a space. The problem really seems to come from the fact that kword considers the opening parenthesis as an ordinary text character instead of considering it as a separator for quotes management.
Apparantly the code that decides between open an close quotes looks at the previous character. And after following a space correctly decides it needs a opening quote. The bug seems to be that we should not only count a space, but also a number of other characters to be used as a word separator, which then cause an opening quote to be used. So; find the code that detects the space and add characters like (<{-= as well. Goal is to make a character follow one of those characters to be an opening quote.
Created an attachment (id=15641) [details] make smart quotes a bit less dumb Ok, here's a patch to make parenthetical quotes, nested quotes, and quotations of single letters all work correctly. If someone with commit privs could review and commit it, that'd be tops. The patch is against the 1.5 branch, but I'd expect it to apply to 1.6 and trunk, too.
SVN commit 530775 by dfaure: Apply patch by "Benjamin K.Stuhl" <benjamin.stuhl colorado.edu> to fix [Bug 84562] JJ: wrong direction typographical quotes Thanks! BUG: 84562 M +44 -3 KoAutoFormat.cpp --- branches/koffice/1.5/koffice/lib/kotext/KoAutoFormat.cpp #530774:530775 @@ -1468,11 +1468,52 @@ textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); // Need to determine if we want a starting or ending quote. - // I see two solutions: either simply alternate, or depend on leading space. - // MSWord does the latter afaics... + // we use a starting quote in three cases: + // 1. if the previous character is a space + // 2. if the previous character is some kind of opening punctuation (e.g., "(", "[", or "{") + // a. and the character before that is not an opening quote (so that we get quotations of single characters + // right) + // 3. if the previous character is an opening quote (so that we get nested quotations right) + // a. and the character before that is not an opening quote (so that we get quotations of single characters + // right) + // b. and the previous quote of a different kind (so that we get empty quotations right) QString replacement; - if ( index > 0 && !parag->at( index - 1 )->c.isSpace() ) + bool ending = true; + + if( index > 0 ) { + QChar::Category c1 = parag->at( index - 1 )->c.category(); + + // case 1 and 2 + if ( c1 == QChar::Separator_Space || c1 == QChar::Separator_Line || c1 == QChar::Separator_Paragraph || + c1 == QChar::Punctuation_Open ) + ending = false; + + // case 3 + if ( c1 == QChar::Punctuation_InitialQuote ) + { + QChar openingQuote; + + if( doubleQuotes ) + openingQuote = m_typographicDoubleQuotes.begin; + else + openingQuote = m_typographicSimpleQuotes.begin; + + // case 3b + if( parag->at( index - 1 )->c != openingQuote ) + ending = false; + } + } + + // cases 2a and 3a + if( index > 1 && !ending ) + { + QChar::Category c2 = parag->at( index - 2 )->c.category(); + ending = (c2 == QChar::Punctuation_InitialQuote); + } + + if( ending ) + { if( doubleQuotes ) replacement = m_typographicDoubleQuotes.end; else
You need to log in before you can comment on or make changes to this bug.