mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Simplify some code now that we don't need it for indexes.
This has the effect that inserting nomenclature entries does not cut the selection (implicit or explicit) but rather copies it, which seems to me to make a lot more sense. If anyone objects, let me know.
This commit is contained in:
parent
aa2f409d87
commit
ba0f28a09b
@ -112,7 +112,7 @@ public:
|
||||
|
||||
/// ???
|
||||
/// FIXME: replace Cursor with DocIterator.
|
||||
docstring getStringToIndex(Cursor const & cur);
|
||||
docstring getStringForDialog(Cursor & cur);
|
||||
|
||||
/// Convert the paragraphs to a string.
|
||||
/// \param AsStringParameter options. This can contain any combination of
|
||||
|
@ -432,7 +432,7 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
|
||||
}
|
||||
|
||||
|
||||
docstring Text::getStringToIndex(Cursor const & cur)
|
||||
docstring Text::getStringForDialog(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
@ -442,17 +442,10 @@ docstring Text::getStringToIndex(Cursor const & cur)
|
||||
// Try implicit word selection. If there is a change
|
||||
// in the language the implicit word selection is
|
||||
// disabled.
|
||||
Cursor tmpcur = cur;
|
||||
selectWord(tmpcur, PREVIOUS_WORD);
|
||||
|
||||
if (!tmpcur.selection())
|
||||
cur.message(_("Nothing to index!"));
|
||||
else if (tmpcur.selBegin().pit() != tmpcur.selEnd().pit())
|
||||
cur.message(_("Cannot index more than one paragraph!"));
|
||||
else
|
||||
return tmpcur.selectionAsString(false);
|
||||
|
||||
return docstring();
|
||||
selectWordWhenUnderCursor(cur, WHOLE_WORD);
|
||||
docstring const & retval = cur.selectionAsString(false);
|
||||
cur.clearSelection();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2128,9 +2128,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_NOMENCL_INSERT: {
|
||||
InsetCommandParams p(NOMENCL_CODE);
|
||||
if (cmd.argument().empty())
|
||||
p["symbol"] = bv->cursor().innerText()->getStringToIndex(bv->cursor());
|
||||
else
|
||||
if (cmd.argument().empty()) {
|
||||
p["symbol"] =
|
||||
bv->cursor().innerText()->getStringForDialog(bv->cursor());
|
||||
cur.clearSelection();
|
||||
} else
|
||||
p["symbol"] = cmd.argument();
|
||||
string const data = InsetCommand::params2string(p);
|
||||
bv->showDialog("nomenclature", data);
|
||||
|
Loading…
Reference in New Issue
Block a user