mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Fix bug #3821 by allowing insertStringAs* to reset the cursor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5a63cba12a
commit
e1b2466faf
@ -1045,6 +1045,7 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs)
|
|||||||
cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
|
cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
|
||||||
else
|
else
|
||||||
cur.text()->insertStringAsLines(cur, text, cur.current_font);
|
cur.text()->insertStringAsLines(cur, text, cur.current_font);
|
||||||
|
cur.setSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
11
src/Text.cpp
11
src/Text.cpp
@ -755,12 +755,12 @@ void Text::breakParagraph(Cursor & cur, bool inverse_logic)
|
|||||||
|
|
||||||
|
|
||||||
// needed to insert the selection
|
// needed to insert the selection
|
||||||
void Text::insertStringAsLines(DocIterator const & dit, docstring const & str,
|
void Text::insertStringAsLines(Cursor & cur, docstring const & str,
|
||||||
Font const & font)
|
Font const & font)
|
||||||
{
|
{
|
||||||
BufferParams const & bparams = owner_->buffer().params();
|
BufferParams const & bparams = owner_->buffer().params();
|
||||||
pit_type pit = dit.pit();
|
pit_type pit = cur.pit();
|
||||||
pos_type pos = dit.pos();
|
pos_type pos = cur.pos();
|
||||||
|
|
||||||
// insert the string, don't insert doublespace
|
// insert the string, don't insert doublespace
|
||||||
bool space_inserted = true;
|
bool space_inserted = true;
|
||||||
@ -802,12 +802,13 @@ void Text::insertStringAsLines(DocIterator const & dit, docstring const & str,
|
|||||||
space_inserted = (*cit == ' ');
|
space_inserted = (*cit == ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setCursor(cur, pit, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// turn double CR to single CR, others are converted into one
|
// turn double CR to single CR, others are converted into one
|
||||||
// blank. Then insertStringAsLines is called
|
// blank. Then insertStringAsLines is called
|
||||||
void Text::insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
|
void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str,
|
||||||
Font const & font)
|
Font const & font)
|
||||||
{
|
{
|
||||||
docstring linestr = str;
|
docstring linestr = str;
|
||||||
@ -829,7 +830,7 @@ void Text::insertStringAsParagraphs(DocIterator const & dit, docstring const & s
|
|||||||
newline_inserted = false;
|
newline_inserted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
insertStringAsLines(dit, linestr, font);
|
insertStringAsLines(cur, linestr, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,10 +263,10 @@ public:
|
|||||||
/* these things are for search and replace */
|
/* these things are for search and replace */
|
||||||
|
|
||||||
/// needed to insert the selection
|
/// needed to insert the selection
|
||||||
void insertStringAsLines(DocIterator const & dit, docstring const & str,
|
void insertStringAsLines(Cursor & cur, docstring const & str,
|
||||||
Font const & font);
|
Font const & font);
|
||||||
/// needed to insert the selection
|
/// needed to insert the selection
|
||||||
void insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
|
void insertStringAsParagraphs(Cursor & cur, docstring const & str,
|
||||||
Font const & font);
|
Font const & font);
|
||||||
|
|
||||||
/// access to our paragraphs
|
/// access to our paragraphs
|
||||||
|
Loading…
Reference in New Issue
Block a user