mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix Helge's index bugs.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6010 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8a4110a1bd
commit
c7fb290bfd
@ -1,3 +1,11 @@
|
||||
2003-01-30 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* factory.C (createInset): create an InsetCommandParam of type "index"
|
||||
and use it to 'do the right thing'.
|
||||
|
||||
* text2.C (getStringToIndex): ensure that cursor position is always
|
||||
reset to the reset_cursor position.
|
||||
|
||||
2003-01-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* lyxfunc.C (getStatus): "buffer-export custom" should never be
|
||||
|
@ -93,11 +93,16 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
return 0;
|
||||
|
||||
case LFUN_INDEX_INSERT: {
|
||||
string entry = cmd.argument;
|
||||
if (entry.empty())
|
||||
entry = bv->getLyXText()->getStringToIndex(bv);
|
||||
if (!entry.empty())
|
||||
return new InsetIndex(InsetCommandParams("index", entry));
|
||||
string const entry = cmd.argument.empty() ?
|
||||
"index" : cmd.argument;
|
||||
InsetCommandParams icp;
|
||||
icp.setFromString(entry);
|
||||
|
||||
if (icp.getContents().empty())
|
||||
icp.setContents(bv->getLyXText()->getStringToIndex(bv));
|
||||
if (!icp.getContents().empty())
|
||||
return new InsetIndex(icp);
|
||||
|
||||
bv->owner()->getDialogs().createIndex();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-01-30 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs2.C (createIndex): enable ControlCommand to create an
|
||||
InsetCommandParam of type "index", not null.
|
||||
|
||||
2003-01-26 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* ui/QThesaurusDialogBase.ui: add colons to labels.
|
||||
|
@ -127,7 +127,7 @@ void Dialogs::showIndex(InsetCommand * ic)
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset(string());
|
||||
pimpl_->index.controller().createInset("index");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-01-30 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs2.C (createIndex): enable ControlCommand to create an
|
||||
InsetCommandParam of type "index", not null.
|
||||
|
||||
2003-01-26 Michael Schmitt <michael.schmitt@teststep.org>
|
||||
|
||||
* forms/form_thesaurus.fd: add colons to labels. Shrink dialog.
|
||||
|
@ -129,7 +129,7 @@ void Dialogs::showIndex(InsetCommand * ic)
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset(string());
|
||||
pimpl_->index.controller().createInset("index");
|
||||
}
|
||||
|
||||
|
||||
|
28
src/text2.C
28
src/text2.C
@ -1039,33 +1039,29 @@ void LyXText::toggleFree(BufferView * bview,
|
||||
|
||||
string LyXText::getStringToIndex(BufferView * bview)
|
||||
{
|
||||
string idxstring;
|
||||
|
||||
// Try implicit word selection
|
||||
// If there is a change in the language the implicit word selection
|
||||
// is disabled.
|
||||
LyXCursor const reset_cursor = cursor;
|
||||
bool const implicitSelection = selectWordWhenUnderCursor(bview, PREVIOUS_WORD);
|
||||
|
||||
if (!selection.set()) {
|
||||
string idxstring;
|
||||
if (!selection.set())
|
||||
bview->owner()->message(_("Nothing to index!"));
|
||||
return string();
|
||||
}
|
||||
if (selection.start.par() != selection.end.par()) {
|
||||
else if (selection.start.par() != selection.end.par())
|
||||
bview->owner()->message(_("Cannot index more than one paragraph!"));
|
||||
return string();
|
||||
}
|
||||
else
|
||||
idxstring = selectionAsString(bview->buffer(), false);
|
||||
|
||||
idxstring = selectionAsString(bview->buffer(), false);
|
||||
// Reset cursors to their original position.
|
||||
cursor = reset_cursor;
|
||||
setCursor(bview, cursor.par(), cursor.pos());
|
||||
selection.cursor = cursor;
|
||||
|
||||
// Implicit selections are cleared afterwards
|
||||
//and cursor is set to the original position.
|
||||
if (implicitSelection) {
|
||||
// Clear the implicit selection.
|
||||
if (implicitSelection)
|
||||
clearSelection();
|
||||
cursor = reset_cursor;
|
||||
setCursor(bview, cursor.par(), cursor.pos());
|
||||
selection.cursor = cursor;
|
||||
}
|
||||
|
||||
return idxstring;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user