]> git.lyx.org Git - features.git/commitdiff
As explained in the comments, this is a partial fix for bug 2154:
authorAbdelrazak Younes <younes@lyx.org>
Thu, 1 Feb 2007 17:21:05 +0000 (17:21 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 1 Feb 2007 17:21:05 +0000 (17:21 +0000)
  http://bugzilla.lyx.org/show_bug.cgi?id=2154

This will automatically put the label inset _after_ a numbered section. It is possible to extend the mechanism to any kind of LateX environment.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17010 a592a061-630c-0410-9148-cb99ea01b6c8

src/text3.C

index 4e2636233158f9643ac9197a8ff7ce2b3ed588c7..46b8b7ff4a5dc03758576d8a478d705bf1d76d75 100644 (file)
@@ -697,6 +697,22 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                recordUndo(cur);
                InsetBase * inset = createInset(bv, cmd);
                if (inset) {
+                       Paragraph & par = pars_[cur.pit()];
+                       // FIXME (Abdel 01/02/2006:
+                       // What follows is a partial fix for bug 2154:
+                       //   http://bugzilla.lyx.org/show_bug.cgi?id=2154
+                       // This will automatically put the label inset _after_ a 
+                       // numbered section. It is possible to extend the mechanism
+                       // to any kind of LateX environement.
+                       if (inset->lyxCode() == InsetBase::LABEL_CODE
+                               && par.layout()->labeltype == LABEL_COUNTER) {
+                               // Go to the end of the paragraph
+                               // Warning: Because of Change-Tracking, the last
+                               // position is 'size()' and not 'size()-1':
+                               cur.pos() = par.size();
+                               // Insert a new paragraph
+                               dispatch(cur, FuncRequest(LFUN_BREAK_PARAGRAPH));
+                       }
                        insertInset(cur, inset);
                        cur.posRight();
                }