* src/Text3.cpp (doDispatch):

- always replace selected text when inserting an inset (bug 672)
	- inset selected text in inserted URL inset (bug 683)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19232 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-07-30 10:34:51 +00:00
parent 2a3514c21f
commit 39650c58f4
2 changed files with 36 additions and 4 deletions

View File

@ -755,6 +755,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
dispatch(cur, fr);
}
*/
if (cur.selection())
cutSelection(cur, true, false);
insertInset(cur, inset);
cur.posRight();
}
@ -1158,15 +1160,39 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_URL_INSERT: {
InsetCommandParams p("url");
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
cutSelection(cur, true, false);
}
p["target"] = (cmd.argument().empty()) ?
content : cmd.argument();
string const data = InsetCommandMailer::params2string("url", p);
if (p["target"].empty()) {
bv->showInsetDialog("url", data, 0);
} else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
}
break;
}
case LFUN_HTML_INSERT: {
InsetCommandParams p("htmlurl");
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
cutSelection(cur, true, false);
}
p["target"] = (cmd.argument().empty()) ?
content : cmd.argument();
string const data = InsetCommandMailer::params2string("url", p);
if (p["target"].empty()) {
bv->showInsetDialog("url", data, 0);
} else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
}
break;
}
@ -1503,9 +1529,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_FLOAT_LIST: {
TextClass const & tclass = bv->buffer()->params().getTextClass();
if (tclass.floats().typeExist(to_utf8(cmd.argument()))) {
// not quite sure if we want this...
recordUndo(cur);
cur.clearSelection();
if (cur.selection())
cutSelection(cur, true, false);
breakParagraph(cur);
if (cur.lastpos() != 0) {

View File

@ -33,6 +33,12 @@ What's new
- Get rid of annoying LaTeX error after changing the document language
(bug 2468)
- Coherent behaviour when inserting over a selection: now the selection
is always replaced by the insertion (bug 672)
- When inserting an URL over selected text, insert the selected
text in the URL inset (bug 683)
* USER INTERFACE:
- Don't allow invalid listings parameters to be passed when