- BufferParams const & bufparams = bv->buffer().params();
- bool const hebrew =
- par.getFontSettings(bufparams, pos).language()->lang() == "hebrew";
- bool const allow_inset_quote = !(par.isPassThru() || hebrew);
-
- string const arg = to_utf8(cmd.argument());
- if (allow_inset_quote) {
- char_type c = ' ';
- if (pos > 0 && (!cur.prevInset() || !cur.prevInset()->isSpace()))
+ bool const inner = (cmd.getArg(0) == "single" || cmd.getArg(0) == "inner");
+
+ // Guess quote side.
+ // A space triggers an opening quote. This is passed if the preceding
+ // char/inset is a space or at paragraph start.
+ char_type c = ' ';
+ if (pos > 0 && !par.isSpace(pos - 1)) {
+ if (cur.prevInset() && cur.prevInset()->lyxCode() == QUOTE_CODE) {
+ // If an opening double quotation mark precedes, and this
+ // is a single quote, make it opening as well
+ InsetQuotes & ins =
+ static_cast<InsetQuotes &>(*cur.prevInset());
+ string const type = ins.getType();
+ if (!suffixIs(type, "ld") || !inner)
+ c = par.getChar(pos - 1);
+ }
+ else if (!cur.prevInset()
+ || (cur.prevInset() && cur.prevInset()->isChar()))
+ // If a char precedes, pass that and let InsetQuote decide