]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Some more cleanup of LyXView:
[lyx.git] / src / Text3.cpp
index 56697384d028ef61a45c2776dc2dd20e39969350..f400794e985a21345107f10e813f1d89638bb896 100644 (file)
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
+#include "ParIterator.h"
+#include "TextClass.h"
 #include "TextMetrics.h"
 #include "VSpace.h"
-#include "ParIterator.h"
 
 #include "frontends/Clipboard.h"
 #include "frontends/Selection.h"
@@ -69,6 +70,7 @@
 #include "mathed/MathMacroTemplate.h"
 
 #include <boost/current_function.hpp>
+#include <boost/next_prior.hpp>
 
 #include <clocale>
 #include <sstream>
@@ -90,7 +92,7 @@ using support::isStrUnsignedInt;
 using support::token;
 
 // globals...
-static Font freefont(ignore_font);
+static Font freefont(ignore_font, ignore_language);
 static bool toggleall = false;
 
 static void toggleAndShow(Cursor & cur, Text * text,
@@ -99,12 +101,12 @@ static void toggleAndShow(Cursor & cur, Text * text,
        text->toggleFree(cur, font, toggleall);
 
        if (font.language() != ignore_language ||
-                       font.fontInfo().number() != FONT_IGNORE) {
+           font.fontInfo().number() != FONT_IGNORE) {
                TextMetrics const & tm = cur.bv().textMetrics(text);
-               if (cur.boundary() != tm.isRTLBoundary(cur.pit(),
-                                                                                                               cur.pos(), cur.real_current_font))
+               if (cur.boundary() != tm.isRTLBoundary(cur.pit(), cur.pos(),
+                                                      cur.real_current_font))
                        text->setCursor(cur, cur.pit(), cur.pos(),
-                                                                                       false, !cur.boundary());
+                                       false, !cur.boundary());
        }
 }
 
@@ -247,6 +249,129 @@ string const freefont2string()
 }
 
 
+/// the type of outline operation
+enum OutlineOp {
+       OutlineUp, // Move this header with text down
+       OutlineDown,   // Move this header with text up
+       OutlineIn, // Make this header deeper
+       OutlineOut // Make this header shallower
+};
+
+
+static void outline(OutlineOp mode, Cursor & cur)
+{
+       Buffer & buf = cur.buffer();
+       pit_type & pit = cur.pit();
+       ParagraphList & pars = buf.text().paragraphs();
+       ParagraphList::iterator bgn = pars.begin();
+       // The first paragraph of the area to be copied:
+       ParagraphList::iterator start = boost::next(bgn, pit);
+       // The final paragraph of area to be copied:
+       ParagraphList::iterator finish = start;
+       ParagraphList::iterator end = pars.end();
+
+       TextClass::const_iterator lit =
+               buf.params().getTextClass().begin();
+       TextClass::const_iterator const lend =
+               buf.params().getTextClass().end();
+
+       int const thistoclevel = start->layout()->toclevel;
+       int toclevel;
+       switch (mode) {
+               case OutlineUp: {
+                       // Move out (down) from this section header
+                       if (finish != end)
+                               ++finish;
+                       // Seek the one (on same level) below
+                       for (; finish != end; ++finish) {
+                               toclevel = finish->layout()->toclevel;
+                               if (toclevel != Layout::NOT_IN_TOC
+                                   && toclevel <= thistoclevel) {
+                                       break;
+                               }
+                       }
+                       ParagraphList::iterator dest = start;
+                       // Move out (up) from this header
+                       if (dest == bgn)
+                               break;
+                       // Search previous same-level header above
+                       do {
+                               --dest;
+                               toclevel = dest->layout()->toclevel;
+                       } while(dest != bgn
+                               && (toclevel == Layout::NOT_IN_TOC
+                                   || toclevel > thistoclevel));
+                       // Not found; do nothing
+                       if (toclevel == Layout::NOT_IN_TOC || toclevel > thistoclevel)
+                               break;
+                       pit_type const newpit = std::distance(bgn, dest);
+                       pit_type const len = std::distance(start, finish);
+                       pit_type const deletepit = pit + len;
+                       buf.undo().recordUndo(cur, ATOMIC_UNDO, newpit, deletepit - 1);
+                       pars.insert(dest, start, finish);
+                       start = boost::next(pars.begin(), deletepit);
+                       pit = newpit;
+                       pars.erase(start, finish);
+                       break;
+               }
+               case OutlineDown: {
+                       // Go down out of current header:
+                       if (finish != end)
+                               ++finish;
+                       // Find next same-level header:
+                       for (; finish != end; ++finish) {
+                               toclevel = finish->layout()->toclevel;
+                               if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
+                                       break;
+                       }
+                       ParagraphList::iterator dest = finish;
+                       // Go one down from *this* header:
+                       if (dest != end)
+                               ++dest;
+                       else
+                               break;
+                       // Go further down to find header to insert in front of:
+                       for (; dest != end; ++dest) {
+                               toclevel = dest->layout()->toclevel;
+                               if (toclevel != Layout::NOT_IN_TOC && toclevel <= thistoclevel)
+                                       break;
+                       }
+                       // One such was found:
+                       pit_type newpit = std::distance(bgn, dest);
+                       pit_type const len = std::distance(start, finish);
+                       buf.undo().recordUndo(cur, ATOMIC_UNDO, pit, newpit - 1);
+                       pars.insert(dest, start, finish);
+                       start = boost::next(bgn, pit);
+                       pit = newpit - len;
+                       pars.erase(start, finish);
+                       break;
+               }
+               case OutlineIn:
+                       buf.undo().recordUndo(cur);
+                       for (; lit != lend; ++lit) {
+                               if ((*lit)->toclevel == thistoclevel + 1 &&
+                                   start->layout()->labeltype == (*lit)->labeltype) {
+                                       start->layout((*lit));
+                                       break;
+                               }
+                       }
+                       break;
+               case OutlineOut:
+                       buf.undo().recordUndo(cur);
+                       for (; lit != lend; ++lit) {
+                               if ((*lit)->toclevel == thistoclevel - 1 &&
+                                   start->layout()->labeltype == (*lit)->labeltype) {
+                                       start->layout((*lit));
+                                       break;
+                               }
+                       }
+                       break;
+               default:
+                       break;
+       }
+}
+
+
 void Text::number(Cursor & cur)
 {
        FontInfo font = ignore_font;
@@ -263,7 +388,7 @@ bool Text::isRTL(Buffer const & buffer, Paragraph const & par) const
 
 void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 {
-       LYXERR(Debug::ACTION) << "Text::dispatch: cmd: " << cmd << endl;
+       LYXERR(Debug::ACTION, "Text::dispatch: cmd: " << cmd);
 
        // FIXME: We use the update flag to indicates wether a singlePar or a
        // full screen update is needed. We reset it here but shall we restore it
@@ -411,29 +536,27 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_CHAR_LEFT_SELECT:
                //FIXME: for visual cursor, really move left
                if (reverseDirectionNeeded(cur)) {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_CHAR_LEFT_SELECT ? 
-                                       LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
+                       cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? 
+                                       LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD;
                } else {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_CHAR_LEFT_SELECT ? 
-                                       LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
+                       cmd.action = cmd.action == LFUN_CHAR_LEFT_SELECT ? 
+                                       LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD;
                }
-               break;
+               dispatch(cur, cmd);
+               return;
 
        case LFUN_CHAR_RIGHT:
        case LFUN_CHAR_RIGHT_SELECT:
                //FIXME: for visual cursor, really move right
                if (reverseDirectionNeeded(cur)) {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_CHAR_RIGHT_SELECT ? 
-                                       LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD));
+                       cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? 
+                                       LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD;
                } else {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_CHAR_RIGHT_SELECT ? 
-                                       LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD));
+                       cmd.action = cmd.action == LFUN_CHAR_RIGHT_SELECT ? 
+                                       LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD;
                }
-               break;
+               dispatch(cur, cmd);
+               return;
 
        case LFUN_UP_SELECT:
        case LFUN_DOWN_SELECT:
@@ -507,15 +630,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_WORD_RIGHT_SELECT:
                //FIXME: for visual cursor mode, really move right
                if (reverseDirectionNeeded(cur)) {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_WORD_RIGHT_SELECT ?
-                                       LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD));
+                       cmd.action = cmd.action == LFUN_WORD_RIGHT_SELECT ?
+                                       LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD;
                } else {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_WORD_RIGHT_SELECT ?
-                                       LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD));
+                       cmd.action = cmd.action == LFUN_WORD_RIGHT_SELECT ?
+                                       LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD;
                }
-               break;
+               dispatch(cur, cmd);
+               return;
 
        case LFUN_WORD_FORWARD:
        case LFUN_WORD_FORWARD_SELECT:
@@ -527,15 +649,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_WORD_LEFT_SELECT:
                //FIXME: for visual cursor mode, really move left
                if (reverseDirectionNeeded(cur)) {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_WORD_LEFT_SELECT ?
-                                       LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD));
+                       cmd.action = cmd.action == LFUN_WORD_LEFT_SELECT ?
+                                       LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD;
                } else {
-                       lyx::dispatch(FuncRequest(
-                               cmd.action == LFUN_WORD_LEFT_SELECT ?
-                                       LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD));
+                       cmd.action = cmd.action == LFUN_WORD_LEFT_SELECT ?
+                                       LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD;
                }
-               break;
+               dispatch(cur, cmd);
+               return;
 
        case LFUN_WORD_BACKWARD:
        case LFUN_WORD_BACKWARD_SELECT:
@@ -834,7 +955,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_LAYOUT: {
                docstring layout = cmd.argument();
-               LYXERR(Debug::INFO) << "LFUN_LAYOUT: (arg) " << to_utf8(layout) << endl;
+               LYXERR(Debug::INFO, "LFUN_LAYOUT: (arg) " << to_utf8(layout));
 
                docstring const old_layout = cur.paragraph().layout()->name();
 
@@ -1016,37 +1137,40 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
                // ignore motions deeper nested than the real anchor
                Cursor & bvcur = cur.bv().cursor();
-               if (bvcur.anchor_.hasPart(cur)) {
-                       CursorSlice old = bvcur.top();
-
-                       int const wh = bv->workHeight();
-                       int const y = std::max(0, std::min(wh - 1, cmd.y));
-
-                       tm.setCursorFromCoordinates(cur, cmd.x, y);
-                       cur.setTargetX(cmd.x);
+               if (!bvcur.anchor_.hasPart(cur)) {
+                       cur.undispatched();
+                       break;
+               }
+               CursorSlice old = bvcur.top();
+
+               int const wh = bv->workHeight();
+               int const y = std::max(0, std::min(wh - 1, cmd.y));
+
+               tm.setCursorFromCoordinates(cur, cmd.x, y);
+               cur.setTargetX(cmd.x);
+               if (cmd.y >= wh)
+                       lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
+               else if (cmd.y < 0)
+                       lyx::dispatch(FuncRequest(LFUN_UP_SELECT));
+               // This is to allow jumping over large insets
+               if (cur.top() == old) {
                        if (cmd.y >= wh)
                                lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
                        else if (cmd.y < 0)
                                lyx::dispatch(FuncRequest(LFUN_UP_SELECT));
-                       // This is to allow jumping over large insets
-                       if (cur.top() == old) {
-                               if (cmd.y >= wh)
-                                       lyx::dispatch(FuncRequest(LFUN_DOWN_SELECT));
-                               else if (cmd.y < 0)
-                                       lyx::dispatch(FuncRequest(LFUN_UP_SELECT));
-                       }
-
-                       if (cur.top() == old)
-                               cur.noUpdate();
-                       else {
-                               // don't set anchor_
-                               bvcur.setCursor(cur);
-                               bvcur.selection() = true;
-                               //lyxerr << "MOTION: " << bv->cursor() << endl;
-                       }
+               }
 
-               } else
-                       cur.undispatched();
+               if (cur.top() == old)
+                       cur.noUpdate();
+               else {
+                       // FIXME: This is brute force! But without it the selected
+                       // area is not corrected updated while moving the mouse.
+                       cur.updateFlags(Update::Force | Update::FitCursor);
+                       // don't set anchor_
+                       bvcur.setCursor(cur);
+                       bvcur.selection() = true;
+                       //lyxerr << "MOTION: " << bv->cursor() << endl;
+               }
                break;
        }
 
@@ -1082,17 +1206,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // "auto_region_delete", which defaults to
                // true (on).
 
-               if (lyxrc.auto_region_delete && cur.selection()) {
-                       pit_type const begpit = cur.selBegin().pit();
-                       pit_type const endpit = cur.selEnd().pit();
+               if (lyxrc.auto_region_delete && cur.selection())
                        cutSelection(cur, false, false);
-                       // When a selection spans multiple paragraphs, the metrics update
-                       // mechanism sometimes fail to detect that a full update is needed.
-                       // In this case, we force the full update:
-                       // (see http://bugzilla.lyx.org/show_bug.cgi?id=4317)
-                       if (isMainText(cur.bv().buffer()) && begpit != endpit)
-                               cur.updateFlags(Update::Force);
-               }
 
                cur.clearSelection();
                Font const old_font = cur.real_current_font;
@@ -1118,7 +1233,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        content : cmd.argument();
                string const data = InsetCommandMailer::params2string("href", p);
                if (p["target"].empty()) {
-                       bv->showInsetDialog("href", data, 0);
+                       bv->showDialog("href", data);
                } else {
                        FuncRequest fr(LFUN_INSET_INSERT, data);
                        dispatch(cur, fr);
@@ -1135,7 +1250,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                string const data = InsetCommandMailer::params2string("label", p);
 
                if (cmd.argument().empty()) {
-                       bv->showInsetDialog("label", data, 0);
+                       bv->showDialog("label", data);
                } else {
                        FuncRequest fr(LFUN_INSET_INSERT, data);
                        dispatch(cur, fr);
@@ -1338,42 +1453,42 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_FONT_EMPH: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setEmph(FONT_TOGGLE);
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_BOLD: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setSeries(BOLD_SERIES);
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_NOUN: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setNoun(FONT_TOGGLE);
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_TYPEWRITER: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setFamily(TYPEWRITER_FAMILY); // no good
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_SANS: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setFamily(SANS_FAMILY);
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_ROMAN: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setFamily(ROMAN_FAMILY);
                toggleAndShow(cur, this, font);
                break;
@@ -1386,14 +1501,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_FONT_UNDERLINE: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                font.fontInfo().setUnderbar(FONT_TOGGLE);
                toggleAndShow(cur, this, font);
                break;
        }
 
        case LFUN_FONT_SIZE: {
-               Font font(ignore_font);
+               Font font(ignore_font, ignore_language);
                setLyXSize(to_utf8(cmd.argument()), font.fontInfo());
                toggleAndShow(cur, this, font);
                break;
@@ -1403,8 +1518,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                Language const * lang = languages.getLanguage(to_utf8(cmd.argument()));
                if (!lang)
                        break;
-               Font font(ignore_font);
-               font.setLanguage(lang);
+               Font font(ignore_font, lang);
                toggleAndShow(cur, this, font);
                break;
        }
@@ -1431,7 +1545,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_FINISHED_LEFT:
-               LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
+               LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_LEFT:\n" << cur);
                if (reverseDirectionNeeded(cur)) {
                        ++cur.pos();
                        cur.setCurrentFont();
@@ -1439,7 +1553,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_FINISHED_RIGHT:
-               LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
+               LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_RIGHT:\n" << cur);
                if (!reverseDirectionNeeded(cur)) {
                        ++cur.pos();
                        cur.setCurrentFont();
@@ -1447,11 +1561,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_FINISHED_BACKWARD:
-               LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_BACKWARD:\n" << cur << endl;
+               LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_BACKWARD:\n" << cur);
                break;
 
        case LFUN_FINISHED_FORWARD:
-               LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_FORWARD:\n" << cur << endl;
+               LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_FORWARD:\n" << cur);
                ++cur.pos();
                cur.setCurrentFont();
                break;
@@ -1460,7 +1574,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                string data;
                params2string(cur.paragraph(), data);
                data = "show\n" + data;
-               bv->showDialogWithData("paragraph", data);
+               bv->showDialog("paragraph", data);
                break;
        }
 
@@ -1545,7 +1659,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                arg = cur.selectionAsString(false);
                        }
                }
-               bv->showDialogWithData("thesaurus", to_utf8(arg));
+               bv->showDialog("thesaurus", to_utf8(arg));
                break;
        }
 
@@ -1582,11 +1696,35 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                }
                break;
 
+       case LFUN_OUTLINE_UP:
+               outline(OutlineUp, cur);
+               setCursor(cur, cur.pit(), 0);
+               updateLabels(cur.buffer());
+               needsUpdate = true;
+               break;
+
+       case LFUN_OUTLINE_DOWN:
+               outline(OutlineDown, cur);
+               setCursor(cur, cur.pit(), 0);
+               updateLabels(cur.buffer());
+               needsUpdate = true;
+               break;
+
+       case LFUN_OUTLINE_IN:
+               outline(OutlineIn, cur);
+               updateLabels(cur.buffer());
+               needsUpdate = true;
+               break;
+
+       case LFUN_OUTLINE_OUT:
+               outline(OutlineOut, cur);
+               updateLabels(cur.buffer());
+               needsUpdate = true;
+               break;
+
        default:
-               LYXERR(Debug::ACTION)
-                       << BOOST_CURRENT_FUNCTION
-                       << ": Command " << cmd
-                       << " not DISPATCHED by Text" << endl;
+               LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION
+                       << ": Command " << cmd << " not DISPATCHED by Text");
                cur.undispatched();
                break;
        }
@@ -1609,14 +1747,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // Inserting characters does not change par height
                ParagraphMetrics const & pms
                        = cur.bv().parMetrics(cur.bottom().text(), cur.bottom().pit());
-               if (pms.dim().height()
-                   == olddim.height()) {
+               if (pms.dim().height() == olddim.height()) {
                        // if so, update _only_ this paragraph
                        cur.updateFlags(Update::SinglePar |
                                Update::FitCursor);
                        return;
-               } else
-                       needsUpdate = true;
+               }
+               needsUpdate = true;
        }
 
        if (!needsUpdate
@@ -1756,7 +1893,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                InsetLayout il =  cur.buffer().params().getTextClass().insetlayout(from_utf8(s));
                if (il.lyxtype != "charstyle" &&
                    il.lyxtype != "custom" &&
-                   il.lyxtype != "element")
+                   il.lyxtype != "element" &&
+                   il.lyxtype != "standard")
                        enable = false;
                break;
                }
@@ -1910,6 +2048,13 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                enable = true;
                break;
 
+       case LFUN_OUTLINE_UP:
+       case LFUN_OUTLINE_DOWN:
+       case LFUN_OUTLINE_IN:
+       case LFUN_OUTLINE_OUT:
+               enable = (cur.paragraph().layout()->toclevel != Layout::NOT_IN_TOC);
+               break;
+
        case LFUN_WORD_DELETE_FORWARD:
        case LFUN_WORD_DELETE_BACKWARD:
        case LFUN_LINE_DELETE: