#include "insets/InsetFloatList.h"
#include "insets/InsetGraphics.h"
#include "insets/InsetGraphicsParams.h"
+#include "insets/InsetInfo.h"
#include "insets/InsetIPAMacro.h"
#include "insets/InsetNewline.h"
#include "insets/InsetQuotes.h"
}
case LFUN_INFO_INSERT: {
- Inset * inset;
- if (cmd.argument().empty() && cur.selection()) {
- // if command argument is empty use current selection as parameter.
- docstring ds = cur.selectionAsString(false);
- cutSelection(cur, false);
- FuncRequest cmd0(cmd, ds);
- inset = createInset(cur.buffer(), cmd0);
+ if (cmd.argument().empty()) {
+ bv->showDialog("info", cur.current_font.language()->lang());
} else {
+ Inset * inset;
inset = createInset(cur.buffer(), cmd);
+ if (!inset)
+ break;
+ cur.recordUndo();
+ insertInset(cur, inset);
+ cur.forceBufferUpdate();
+ cur.posForward();
}
- if (!inset)
- break;
- cur.recordUndo();
- insertInset(cur, inset);
- cur.forceBufferUpdate();
- cur.posForward();
break;
}
case LFUN_CAPTION_INSERT:
break;
case LFUN_INFO_INSERT:
code = INFO_CODE;
+ enable = infoparams.validateArgument(cur.buffer(), cmd.argument(), true);
break;
case LFUN_ARGUMENT_INSERT: {
code = ARG_CODE;
if (!cur.buffer()->areChangesPresent())
break;
- for (DocIterator it = cur.selectionBegin(); it < cur.selectionEnd(); it.forwardPar()) {
+ for (DocIterator it = cur.selectionBegin(); ; it.forwardPar()) {
pos_type const beg = it.pos();
pos_type end;
- if (it.paragraph().id() == cur.selectionEnd().paragraph().id())
+ bool const in_last_par = (it.pit() == cur.selectionEnd().pit());
+ if (in_last_par)
end = cur.selectionEnd().pos();
else
- end = it.paragraph().size();
+ end = it.lastpos();
if (beg != end && it.paragraph().isChanged(beg, end)) {
enable = true;
break;
}
+ if (in_last_par)
+ break;
}
}
break;