mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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:
parent
c80f1009b3
commit
ad56bded03
@ -1079,7 +1079,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
case LFUN_BIBTEX_DATABASE_ADD:
|
case LFUN_BIBTEX_DATABASE_ADD:
|
||||||
case LFUN_BIBTEX_DATABASE_DEL:
|
case LFUN_BIBTEX_DATABASE_DEL:
|
||||||
case LFUN_STATISTICS:
|
case LFUN_STATISTICS:
|
||||||
case LFUN_BRANCH_ADD_INSERT:
|
|
||||||
case LFUN_KEYMAP_OFF:
|
case LFUN_KEYMAP_OFF:
|
||||||
case LFUN_KEYMAP_PRIMARY:
|
case LFUN_KEYMAP_PRIMARY:
|
||||||
case LFUN_KEYMAP_SECONDARY:
|
case LFUN_KEYMAP_SECONDARY:
|
||||||
@ -1154,6 +1153,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
|
flag.setEnabled(cur.inset().allowParagraphCustomization(cur.idx()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_BRANCH_ADD_INSERT:
|
||||||
|
flag.setEnabled(!(cur.inTexted() && cur.paragraph().isPassThru()));
|
||||||
|
break;
|
||||||
|
|
||||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||||
// FIXME: this is wrong, but I do not understand the
|
// FIXME: this is wrong, but I do not understand the
|
||||||
// intent (JMarc)
|
// intent (JMarc)
|
||||||
|
@ -1472,12 +1472,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
bool const hebrew =
|
bool const hebrew =
|
||||||
par.getFontSettings(bufparams, pos).language()->lang() == "hebrew";
|
par.getFontSettings(bufparams, pos).language()->lang() == "hebrew";
|
||||||
bool const allow_inset_quote = !(par.isPassThru() || hebrew);
|
bool const allow_inset_quote = !(par.isPassThru() || hebrew);
|
||||||
|
|
||||||
|
string const arg = to_utf8(cmd.argument());
|
||||||
if (allow_inset_quote) {
|
if (allow_inset_quote) {
|
||||||
char_type c = ' ';
|
char_type c = ' ';
|
||||||
if (pos > 0 && (!cur.prevInset() || !cur.prevInset()->isSpace()))
|
if (pos > 0 && (!cur.prevInset() || !cur.prevInset()->isSpace()))
|
||||||
c = par.getChar(pos - 1);
|
c = par.getChar(pos - 1);
|
||||||
string const arg = to_utf8(cmd.argument());
|
|
||||||
InsetQuotes::QuoteTimes const quote_type = (arg == "single")
|
InsetQuotes::QuoteTimes const quote_type = (arg == "single")
|
||||||
? InsetQuotes::SingleQuotes : InsetQuotes::DoubleQuotes;
|
? InsetQuotes::SingleQuotes : InsetQuotes::DoubleQuotes;
|
||||||
cur.insert(new InsetQuotes(cur.buffer(), c, quote_type));
|
cur.insert(new InsetQuotes(cur.buffer(), c, quote_type));
|
||||||
@ -1485,8 +1485,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
} else {
|
} else {
|
||||||
// The cursor might have been invalidated by the replaceSelection.
|
// The cursor might have been invalidated by the replaceSelection.
|
||||||
cur.buffer()->changed(true);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2472,6 +2473,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
code = INDEX_CODE;
|
code = INDEX_CODE;
|
||||||
else if (cmd.argument() == "index_print")
|
else if (cmd.argument() == "index_print")
|
||||||
code = INDEX_PRINT_CODE;
|
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")
|
else if (cmd.argument() == "nomenclature")
|
||||||
code = NOMENCL_CODE;
|
code = NOMENCL_CODE;
|
||||||
else if (cmd.argument() == "nomencl_print")
|
else if (cmd.argument() == "nomencl_print")
|
||||||
@ -2494,8 +2499,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
code = VSPACE_CODE;
|
code = VSPACE_CODE;
|
||||||
else if (cmd.argument() == "wrap")
|
else if (cmd.argument() == "wrap")
|
||||||
code = WRAP_CODE;
|
code = WRAP_CODE;
|
||||||
else if (cmd.argument() == "listings")
|
|
||||||
code = LISTINGS_CODE;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ERT_INSERT:
|
case LFUN_ERT_INSERT:
|
||||||
@ -2896,7 +2899,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
|
|
||||||
case LFUN_NEWLINE_INSERT:
|
case LFUN_NEWLINE_INSERT:
|
||||||
// LaTeX restrictions (labels or empty par)
|
// LaTeX restrictions (labels or empty par)
|
||||||
enable = (cur.pos() > cur.paragraph().beginOfBody());
|
enable = !cur.paragraph().isPassThru()
|
||||||
|
&& cur.pos() > cur.paragraph().beginOfBody();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_TAB_INSERT:
|
case LFUN_TAB_INSERT:
|
||||||
|
@ -1732,7 +1732,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
else if (name == "print")
|
else if (name == "print")
|
||||||
enable = doc_buffer->params().isExportable("dvi")
|
enable = doc_buffer->params().isExportable("dvi")
|
||||||
&& lyxrc.print_command != "none";
|
&& lyxrc.print_command != "none";
|
||||||
else if (name == "character" || name == "symbols") {
|
else if (name == "character" || name == "symbols"
|
||||||
|
|| name == "mathdelimiter" || name == "mathmatrix") {
|
||||||
if (!buf || buf->isReadonly())
|
if (!buf || buf->isReadonly())
|
||||||
enable = false;
|
enable = false;
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user