Bug #9005: various things that do not work as intended in passthru paragraphs

* disable branch-add-insert in pass thru paragraphs

* when it is not possible to input a quote inset, insert a single
  ascii quote when argument to quote-insert is "single"

* handle "mathspace" dialog in Text::getStatus

* disable insertion of newline inset in pass thru paragraphs

* handle "mathdelimiter" and "mathmatrix" dialogs in GuiView::getStatus.
This commit is contained in:
Jean-Marc Lasgouttes 2014-03-04 11:56:03 +01:00
parent c80f1009b3
commit ad56bded03
3 changed files with 17 additions and 9 deletions

View File

@ -1079,7 +1079,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
case LFUN_STATISTICS:
case LFUN_BRANCH_ADD_INSERT:
case LFUN_KEYMAP_OFF:
case LFUN_KEYMAP_PRIMARY:
case LFUN_KEYMAP_SECONDARY:
@ -1154,6 +1153,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
break;
case LFUN_BRANCH_ADD_INSERT:
flag.setEnabled(!(cur.inTexted() && cur.paragraph().isPassThru()));
break;
case LFUN_DIALOG_SHOW_NEW_INSET:
// FIXME: this is wrong, but I do not understand the
// intent (JMarc)

View File

@ -1473,11 +1473,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
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()))
c = par.getChar(pos - 1);
string const arg = to_utf8(cmd.argument());
InsetQuotes::QuoteTimes const quote_type = (arg == "single")
? InsetQuotes::SingleQuotes : InsetQuotes::DoubleQuotes;
cur.insert(new InsetQuotes(cur.buffer(), c, quote_type));
@ -1485,7 +1485,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
} else {
// The cursor might have been invalidated by the replaceSelection.
cur.buffer()->changed(true);
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
string const quote_string = (arg == "single") ? "'" : "\"";
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, quote_string));
}
break;
}
@ -2472,6 +2473,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
code = INDEX_CODE;
else if (cmd.argument() == "index_print")
code = INDEX_PRINT_CODE;
else if (cmd.argument() == "listings")
code = LISTINGS_CODE;
else if (cmd.argument() == "mathspace")
code = MATH_HULL_CODE;
else if (cmd.argument() == "nomenclature")
code = NOMENCL_CODE;
else if (cmd.argument() == "nomencl_print")
@ -2494,8 +2499,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
code = VSPACE_CODE;
else if (cmd.argument() == "wrap")
code = WRAP_CODE;
else if (cmd.argument() == "listings")
code = LISTINGS_CODE;
break;
case LFUN_ERT_INSERT:
@ -2896,7 +2899,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_NEWLINE_INSERT:
// LaTeX restrictions (labels or empty par)
enable = (cur.pos() > cur.paragraph().beginOfBody());
enable = !cur.paragraph().isPassThru()
&& cur.pos() > cur.paragraph().beginOfBody();
break;
case LFUN_TAB_INSERT:

View File

@ -1732,7 +1732,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
else if (name == "print")
enable = doc_buffer->params().isExportable("dvi")
&& lyxrc.print_command != "none";
else if (name == "character" || name == "symbols") {
else if (name == "character" || name == "symbols"
|| name == "mathdelimiter" || name == "mathmatrix") {
if (!buf || buf->isReadonly())
enable = false;
else {