hi guys,

at the moment it is a bit involved to snap out of an itemize or enumerate

the attached a little patch allows the following

when the cursor is in an empty indented item:

1. blah
    (a) |

then <enter> decreases the depth:

1. blah
2. |

and when at the 1st level <enter> in an empty itemize/enumerate snaps out of it:

1. blah
|

i remember a discussion a long time ago (i think it was jean-marc who then suggested behavior like this)

any opinions?

best, ed.
Index: src/Text.cpp
===================================================================
--- src/Text.cpp        (revision 33053)
+++ src/Text.cpp        (working copy)
@@ -665,6 +665,17 @@
        DocumentClass const & tclass = cur.buffer()->params().documentClass();
        Layout const & layout = cpar.layout();
 
+       if (cur.lastpos() == 0) {
+               if (changeDepthAllowed(cur, DEC_DEPTH)) {
+                       changeDepth(cur, DEC_DEPTH);
+                       return;
+               } else if (layout.labeltype == LABEL_ENUMERATE ||
+                          layout.labeltype == LABEL_ITEMIZE) {
+                       setLayout(cur, tclass.defaultLayoutName());
+                       return;
+               }
+       }
+       
        // this is only allowed, if the current paragraph is not empty
        // or caption and if it has not the keepempty flag active
        if (cur.lastpos() == 0 && !cpar.allowEmpty() &&

Reply via email to