Fix bug 2445.

* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to 
	simpler 'keep_layout'

	* src/Text.cpp (breakParagraph): change parameter keep_layout to 
	inverse_logic.

	* src/Text3.cpp (dispatch): remove LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT;
	implement "inverse" flag to LFUN_BREAK_PARAGRAPH.

	* lib/bind/cua.bind:
	* lib/bind/xemacs.bind: 
	* lib/bind/emacs.bind:
	* lib/bind/mac.bind: adapt bindings.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@20848 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-10-08 13:35:16 +00:00
parent d753a754ea
commit e16f8a2fd3
9 changed files with 21 additions and 22 deletions

View File

@ -194,7 +194,7 @@
\bind "C-Delete" "word-delete-forward"
\bind "C-BackSpace" "word-delete-backward"
\bind "M-Return" "break-paragraph-keep-layout"
\bind "M-Return" "break-paragraph inverse"
\bind "C-Return" "break-line"
\bind "C-k" "line-delete-forward"
\bind "C-space" "space-insert protected"

View File

@ -208,7 +208,7 @@
\bind "C-Delete" "word-delete-forward"
\bind "M-d" "word-delete-forward"
\bind "C-BackSpace" "word-delete-backward"
\bind "M-Return" "break-paragraph-keep-layout"
\bind "M-Return" "break-paragraph inverse"
\bind "C-Return" "break-line"
\bind "C-S-L" "ligature-break-insert"
\bind "C-space" "space-insert protected"

View File

@ -176,7 +176,7 @@
\bind "M-Delete" "word-delete-forward"
\bind "M-BackSpace" "word-delete-backward"
\bind "M-Return" "break-paragraph-keep-layout"
\bind "M-Return" "break-paragraph inverse"
\bind "C-Return" "break-line"
\bind "C-k" "line-delete-forward"
\bind "M-space" "space-insert protected"

View File

@ -219,7 +219,7 @@
\bind "C-Delete" "word-delete-forward"
\bind "M-d" "word-delete-forward"
\bind "C-BackSpace" "word-delete-backward"
\bind "M-Return" "break-paragraph-keep-layout"
\bind "M-Return" "break-paragraph inverse"
\bind "C-Return" "break-line"
\bind "C-S-L" "ligature-break-insert"
\bind "C-space" "space-insert protected"
@ -330,7 +330,7 @@
\bind "C-c percent" "layout Comment"
\bind "C-c Return" "break-paragraph-keep-layout"
\bind "C-c Return" "break-paragraph inverse"
#
## End AucTeX
#

View File

@ -583,7 +583,7 @@ Color_color Text::backgroundColor() const
}
void Text::breakParagraph(Cursor & cur, bool keep_layout)
void Text::breakParagraph(Cursor & cur, bool inverse_logic)
{
BOOST_ASSERT(this == cur.text());
@ -608,11 +608,9 @@ void Text::breakParagraph(Cursor & cur, bool keep_layout)
cpar.eraseChar(cur.pos(), cur.buffer().params().trackChanges);
// What should the layout for the new paragraph be?
int preserve_layout = 0;
if (keep_layout)
preserve_layout = 2;
else
preserve_layout = layout->isEnvironment();
bool keep_layout = inverse_logic ?
!layout->isEnvironment()
: layout->isEnvironment();
// We need to remember this before we break the paragraph, because
// that invalidates the layout variable
@ -622,7 +620,7 @@ void Text::breakParagraph(Cursor & cur, bool keep_layout)
bool const isempty = cpar.allowEmpty() && cpar.empty();
lyx::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
cur.pos(), preserve_layout);
cur.pos(), keep_layout);
// After this, neither paragraph contains any rows!

View File

@ -77,7 +77,7 @@ public:
Font const & font, bool toggleall = false);
/// what you expect when pressing \<enter\> at cursor position
void breakParagraph(Cursor & cur, bool keep_layout = false);
void breakParagraph(Cursor & cur, bool inverse_logic = false);
/// set layout over selection
void setLayout(Buffer const & buffer, pit_type start, pit_type end,

View File

@ -668,7 +668,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_BREAK_PARAGRAPH:
cap::replaceSelection(cur);
breakParagraph(cur, false);
breakParagraph(cur, cmd.argument() == "inverse");
cur.resetAnchor();
break;

View File

@ -60,7 +60,8 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos,
void breakParagraph(BufferParams const & bparams,
ParagraphList & pars, pit_type par_offset, pos_type pos, int flag)
ParagraphList & pars, pit_type par_offset, pos_type pos,
bool keep_layout)
{
// create a new paragraph, and insert into the list
ParagraphList::iterator tmp =
@ -76,7 +77,7 @@ void breakParagraph(BufferParams const & bparams,
tmp->setInsetOwner(par.inInset());
// layout stays the same with latex-environments
if (flag) {
if (keep_layout) {
tmp->layout(par.layout());
tmp->setLabelWidthString(par.params().labelWidthString());
tmp->params().depth(par.params().depth());
@ -90,7 +91,7 @@ void breakParagraph(BufferParams const & bparams,
bool const isempty = (par.allowEmpty() && par.empty());
if (!isempty && (par.size() > pos || par.empty() || flag == 2)) {
if (!isempty && (par.size() > pos || par.empty())) {
tmp->layout(par.layout());
tmp->params().align(par.params().align());
tmp->setLabelWidthString(par.params().labelWidthString());
@ -142,7 +143,7 @@ void breakParagraph(BufferParams const & bparams,
}
// layout stays the same with latex-environments
if (flag) {
if (keep_layout) {
par.layout(tmp->layout());
par.setLabelWidthString(tmp->params().labelWidthString());
par.params().depth(tmp->params().depth());

View File

@ -27,9 +27,9 @@ class ParagraphList;
/**
* This breaks a paragraph at the specified position.
* The new paragraph will:
* get the default layout, when flag == 0
* will inherit the existing one, except for depth, when flag == 1
* will inherit the existing one, including depth, when flag == 2
* - Decrease depth by one (or chenge layout to default layout when
* keep_layout == false
* - keep current depth and layout when keep_layout == true
* Be aware that the old or new paragraph does not contain any rows
* after this.
*/
@ -37,7 +37,7 @@ void breakParagraph(BufferParams const & bparams,
ParagraphList & paragraphs,
pit_type par,
pos_type pos,
int flag);
bool keep_layout);
///
void breakParagraphConservative(BufferParams const & bparams,