Fix two hyperlink-insert problems

1. Do not prematurely cut selection (#10306); patch proposed by Daniel Ramöller
2. Obey lfun argument, even if there is a selection
This commit is contained in:
Juergen Spitzmueller 2016-12-29 09:17:53 +01:00
parent a18e53f760
commit 3522782c44

View File

@ -1775,13 +1775,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
case LFUN_HREF_INSERT: {
// FIXME If we're actually given an argument, shouldn't
// we use it, whether or not we have a selection?
docstring content = cmd.argument();
if (cur.selection()) {
if (content.empty() && cur.selection())
content = cur.selectionAsString(false);
cutSelection(cur, true, false);
}
InsetCommandParams p(HYPERLINK_CODE);
if (!content.empty()){