Probably won't build but it's a sketch ... comments ?

Note we could make it have a really big width but  this would actually
just complicated rowBreakPoint() and we'd *still* have to special case
it anyway.

john


Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.431
diff -u -p -r1.431 buffer.C
--- buffer.C    12 Mar 2003 11:52:22 -0000      1.431
+++ buffer.C    12 Mar 2003 16:13:34 -0000
@@ -911,18 +911,6 @@ string const Buffer::asciiParagraph(Para
                }
                break;
 
-               case Paragraph::META_NEWLINE:
-                       if (linelen > 0) {
-                               buffer << word << "\n";
-                               word.erase();
-
-                               pair<int, string> p = addDepth(depth,
-                                                              ltype_depth);
-                               buffer << p.second;
-                               currlinelen = p.first;
-                       }
-                       break;
-
                default:
                        if (c == ' ') {
                                if (linelen > 0 &&
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.249
diff -u -p -r1.249 paragraph.C
--- paragraph.C 12 Mar 2003 06:53:49 -0000      1.249
+++ paragraph.C 12 Mar 2003 16:13:36 -0000
@@ -209,10 +209,6 @@ void Paragraph::write(Buffer const * buf
                                }
                }
                break;
-               case META_NEWLINE:
-                       os << "\n\\newline \n";
-                       column = 0;
-                       break;
                case '\\':
                        os << "\n\\backslash \n";
                        column = 0;
@@ -787,19 +783,22 @@ int Paragraph::beginningOfBody() const
        // and remember the previous character to
        // remove unnecessary GetChar() calls
        pos_type i = 0;
-       if (i < size() && getChar(i) != Paragraph::META_NEWLINE) {
+       if (i < size() && !isNewline(i)) {
                ++i;
                char previous_char = 0;
                char temp = 0;
-               if (i < size()
-                   && (previous_char = getChar(i)) != Paragraph::META_NEWLINE) {
-                       // Yes, this  ^ is supposed to be "= " not "=="
-                       ++i;
-                       while (i < size()
-                              && previous_char != ' '
-                              && (temp = getChar(i)) != Paragraph::META_NEWLINE) {
+               if (i < size()) {
+                       previous_char = getChar(i);
+                       if (!isNewline(i)) {
                                ++i;
-                               previous_char = temp;
+                               while (i < size() && previous_char != ' ') {
+                                       temp = getChar(i);
+                                       if (isNewline(i))
+                                               break;
+
+                                       ++i;
+                                       previous_char = temp;
+                               }
                        }
                }
        }
@@ -1150,38 +1149,12 @@ bool Paragraph::simpleTeXOnePar(Buffer c
                column += Changes::latexMarkChange(os, running_change, change);
                running_change = change;
 
-               if (c == Paragraph::META_NEWLINE) {
-                       // newlines are handled differently here than
-                       // the default in SimpleTeXSpecialChars().
-                       if (!style->newline_allowed) {
-                               os << '\n';
-                       } else {
-                               if (open_font) {
-                                       column += 
running_font.latexWriteEndChanges(os, basefont, basefont);
-                                       open_font = false;
-                               }
-                               basefont = getLayoutFont(bparams);
-                               running_font = basefont;
-                               if (font.family() ==
-                                   LyXFont::TYPEWRITER_FAMILY) {
-                                       os << '~';
-                               }
-                               if (moving_arg)
-                                       os << "\\protect ";
-
-                               os << "\\\\\n";
-                       }
-                       texrow.newline();
-                       texrow.start(this, i + 1);
-                       column = 0;
-               } else {
-                       pimpl_->simpleTeXSpecialChars(buf, bparams,
-                                                     os, texrow, moving_arg,
-                                                     font, running_font,
-                                                     basefont, open_font,
-                                                     running_change,
-                                                     *style, i, column, c);
-               }
+               pimpl_->simpleTeXSpecialChars(buf, bparams,
+                                             os, texrow, moving_arg,
+                                             font, running_font,
+                                             basefont, open_font,
+                                             running_change,
+                                             *style, i, column, c);
        }
 
        column += Changes::latexMarkChange(os,
@@ -1229,7 +1202,7 @@ bool Paragraph::simpleTeXOnePar(Buffer c
 bool Paragraph::isHfill(pos_type pos) const
 {
        return IsInsetChar(getChar(pos))
-                                       && getInset(pos)->lyxCode() == 
Inset::HFILL_CODE;
+              && getInset(pos)->lyxCode() == Inset::HFILL_CODE;
 }
 
 
@@ -1241,7 +1214,8 @@ bool Paragraph::isInset(pos_type pos) co
 
 bool Paragraph::isNewline(pos_type pos) const
 {
-       return pos >= 0 && IsNewlineChar(getChar(pos));
+       return IsInsetChar(getChar(pos))
+              && getInset(pos)->lyxCode() == Inset::NEWLINE_CODE;
 }
 
 
@@ -1371,8 +1345,6 @@ string const Paragraph::asString(Buffer 
                value_type const c = getUChar(buffer->params, i);
                if (IsPrintable(c))
                        os << c;
-               else if (c == META_NEWLINE)
-                       os << '\n';
                else if (c == META_INSET) 
                        getInset(i)->ascii(buffer, os);
        }
Index: paragraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
retrieving revision 1.62
diff -u -p -r1.62 paragraph.h
--- paragraph.h 11 Mar 2003 15:01:27 -0000      1.62
+++ paragraph.h 12 Mar 2003 16:13:37 -0000
@@ -40,8 +40,6 @@ public:
        ///
        enum META_KIND {
                ///
-               META_NEWLINE = 2,
-               ///
                META_INSET
        };
        ///
Index: paragraph_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v
retrieving revision 1.19
diff -u -p -r1.19 paragraph_funcs.C
--- paragraph_funcs.C   12 Mar 2003 11:52:22 -0000      1.19
+++ paragraph_funcs.C   12 Mar 2003 16:13:39 -0000
@@ -32,6 +32,7 @@
 #include "insets/insettabular.h"
 #include "insets/insethfill.h"
 #include "insets/inseterror.h"
+#include "insets/insetnewline.h"
 
 extern string bibitemWidest(Buffer const *);
 
@@ -918,7 +919,9 @@ int readParToken(Buffer & buf, Paragraph
                par.insertChar(par.size(), '\\', font, change);
        // do not delete this token, it is still needed!
        } else if (token == "\\newline") {
-               par.insertChar(par.size(), Paragraph::META_NEWLINE, font, change);
+               Inset * inset = new InsetNewline();
+               inset->read(&buf, lex);
+               par.insertInset(par.size(), inset, font, change);
        } else if (token == "\\LyXTable") {
                Inset * inset = new InsetTabular(buf);
                inset->read(&buf, lex);
Index: paragraph_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.C,v
retrieving revision 1.51
diff -u -p -r1.51 paragraph_pimpl.C
--- paragraph_pimpl.C   11 Mar 2003 15:01:27 -0000      1.51
+++ paragraph_pimpl.C   12 Mar 2003 16:13:40 -0000
@@ -513,6 +513,34 @@ void Paragraph::Pimpl::simpleTeXSpecialC
                if (!inset)
                        break;
 
+               // This is what the old META_NEWLINE code did.
+               if (inset->lyxCode() == Inset::NEWLINE_CODE) {
+                       // newlines are handled differently here than
+                       // the default in simpleTeXSpecialChars().
+                       if (!style.newline_allowed) {
+                               os << '\n';
+                       } else {
+                               if (open_font) {
+                                       column += 
running_font.latexWriteEndChanges(os, basefont, basefont);
+                                       open_font = false;
+                               }
+                               basefont = getLayoutFont(bparams);
+                               running_font = basefont;
+
+                               if (font.family() == LyXFont::TYPEWRITER_FAMILY)
+                                       os << '~';
+
+                               if (moving_arg)
+                                       os << "\\protect ";
+
+                               os << "\\\\\n";
+                       }
+                       texrow.newline();
+                       texrow.start(owner_, i + 1);
+                       column = 0;
+                       break;
+               }
+
                if (inset->isTextInset()) {
                        column += Changes::latexMarkChange(os, running_change,
                                Change::UNCHANGED);
@@ -564,17 +592,6 @@ void Paragraph::Pimpl::simpleTeXSpecialC
                }
        }
        break;
-
-       case Paragraph::META_NEWLINE:
-               if (open_font) {
-                       column += running_font.latexWriteEndChanges(os,
-                                                                   basefont,
-                                                                   basefont);
-                       open_font = false;
-               }
-               basefont = owner_->getLayoutFont(bparams);
-               running_font = basefont;
-               break;
 
        default:
                // And now for the special cases within each mode
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.3
diff -u -p -r1.3 rowpainter.C
--- rowpainter.C        9 Mar 2003 12:37:20 -0000       1.3
+++ rowpainter.C        12 Mar 2003 16:13:41 -0000
@@ -105,53 +105,6 @@ int RowPainter::leftMargin() const
 }
 
 
-void RowPainter::paintNewline(pos_type const pos)
-{
-       LyXFont const font = getFont(pos);
-       int const wid = font_metrics::width('n', font);
-       int const asc = font_metrics::maxAscent(font);
-       int const y = yo_ + row_.baseline();
-       // FIXME: rtl_pos, or ltr_pos ?
-       bool const rtl_pos = (text_.bidi_level(pos) % 2 == 0);
-       int xp[3];
-       int yp[3];
-
-       yp[0] = int(y - 0.875 * asc * 0.75);
-       yp[1] = int(y - 0.500 * asc * 0.75);
-       yp[2] = int(y - 0.125 * asc * 0.75);
-
-       if (rtl_pos) {
-               xp[0] = int(x_ + wid * 0.375);
-               xp[1] = int(x_);
-               xp[2] = int(x_ + wid * 0.375);
-       } else {
-               xp[0] = int(x_ + wid * 0.625);
-               xp[1] = int(x_ + wid);
-               xp[2] = int(x_ + wid * 0.625);
-       }
-
-       pain_.lines(xp, yp, 3, LColor::eolmarker);
-
-       yp[0] = int(y - 0.500 * asc * 0.75);
-       yp[1] = int(y - 0.500 * asc * 0.75);
-       yp[2] = int(y - asc * 0.75);
-
-       if (rtl_pos) {
-               xp[0] = int(x_);
-               xp[1] = int(x_ + wid);
-               xp[2] = int(x_ + wid);
-       } else {
-               xp[0] = int(x_ + wid);
-               xp[1] = int(x_);
-               xp[2] = int(x_);
-       }
-
-       pain_.lines(xp, yp, 3, LColor::eolmarker);
-
-       x_ += wid;
-}
-
-
 bool RowPainter::paintInset(pos_type const pos)
 {
        Inset * inset = const_cast<Inset*>(par_.getInset(pos));
@@ -318,11 +271,7 @@ bool RowPainter::paintFromPos(pos_type &
 
        char const c = par_.getChar(pos);
 
-       if (IsNewlineChar(c)) {
-               ++vpos;
-               paintNewline(pos);
-               return true;
-       } else if (IsInsetChar(c)) {
+       if (IsInsetChar(c)) {
                if (paintInset(pos))
                        return true;
                ++vpos;
Index: rowpainter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.h,v
retrieving revision 1.1
diff -u -p -r1.1 rowpainter.h
--- rowpainter.h        26 Feb 2003 17:04:06 -0000      1.1
+++ rowpainter.h        12 Mar 2003 16:13:42 -0000
@@ -45,7 +45,6 @@ private:
        void paintChangeBar();
        void paintFirst();
        void paintLast();
-       void paintNewline(lyx::pos_type const pos);
        void paintForeignMark(float const orig_x, LyXFont const & orig_font);
        void paintHebrewComposeChar(lyx::pos_type & vpos);
        void paintArabicComposeChar(lyx::pos_type & vpos);
Index: sgml.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/sgml.C,v
retrieving revision 1.5
diff -u -p -r1.5 sgml.C
--- sgml.C      11 Mar 2003 15:01:27 -0000      1.5
+++ sgml.C      12 Mar 2003 16:13:42 -0000
@@ -26,9 +26,6 @@ pair<bool, string> escapeChar(char c)
        string str;
 
        switch (c) {
-       case Paragraph::META_NEWLINE:
-               str = '\n';
-               break;
        case ' ':
                return make_pair(true, string(" "));
                break;
Index: tabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular.C,v
retrieving revision 1.150
diff -u -p -r1.150 tabular.C
--- tabular.C   12 Mar 2003 11:52:22 -0000      1.150
+++ tabular.C   12 Mar 2003 16:13:47 -0000
@@ -2766,7 +2766,7 @@ LyXTabular::BoxType LyXTabular::UseParbo
 
        for (; cit != end; ++cit) {
                for (int i = 0; i < cit->size(); ++i) {
-                       if (cit->getChar(i) == Paragraph::META_NEWLINE)
+                       if (cit->isNewLine(i))
                                return BOX_PARBOX;
                }
        }
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.307
diff -u -p -r1.307 text.C
--- text.C      11 Mar 2003 15:01:27 -0000      1.307
+++ text.C      12 Mar 2003 16:13:52 -0000
@@ -254,8 +254,6 @@ int LyXText::singleWidth(BufferView * bv
 
        if (IsSeparatorChar(c))
                c = ' ';
-       else if (IsNewlineChar(c))
-               c = 'n';
        return font_metrics::width(c, font);
 }
 
@@ -739,13 +737,13 @@ LyXText::rowBreakPoint(BufferView & bv, 
 
        for (i = pos; i < last; ++i) {
 
-               char const c = par->getChar(i);
-
-               if (IsNewlineChar(c)) {
+               if (par->isNewline(i)) {
                        point = i;
                        break;
                }
 
+               char const c = par->getChar(i);
+
                int thiswidth = singleWidth(&bv, par, i, c);
 
                // add the auto-hfill from label end to the body
@@ -1594,7 +1592,12 @@ void LyXText::insertChar(BufferView * bv
                        charInserted();
                        return;
                }
-       } else if (IsNewlineChar(c)) {
+       }
+       
+#warning newline
+#if 0  
+
+       else if (IsNewlineChar(c)) {
                if (cursor.pos() <= cursor.par()->beginningOfBody()) {
                        charInserted();
                        return;
@@ -1608,6 +1611,7 @@ void LyXText::insertChar(BufferView * bv
                        cursorRight(bview);
                cursor.row()->fill(-1);        // to force a new break
        }
+#endif
 
        // the display inset stuff
        if (cursor.row()->par()->isInset(cursor.row()->pos())) {
@@ -1959,7 +1963,8 @@ void LyXText::cursorLeftOneWord(LyXCurso
        cur = cursor;
        while (cur.pos()
               && (cur.par()->isSeparator(cur.pos() - 1)
-                  || cur.par()->isKomma(cur.pos() - 1))
+                  || cur.par()->isKomma(cur.pos() - 1)
+                  || cur.par()->isNewline(cur.pos() - 1))
               && !(cur.par()->isHfill(cur.pos() - 1)
                    || cur.par()->isInset(cur.pos() - 1)))
                cur.pos(cur.pos() - 1);
@@ -1993,8 +1998,10 @@ void LyXText::getWord(LyXCursor & from, 
                if (cursor.pos() == 0 || cursor.pos() == cursor.par()->size()
                    || cursor.par()->isSeparator(cursor.pos())
                    || cursor.par()->isKomma(cursor.pos())
+                   || cursor.par()->isNewline(cursor.pos())
                    || cursor.par()->isSeparator(cursor.pos() - 1)
-                   || cursor.par()->isKomma(cursor.pos() - 1)) {
+                   || cursor.par()->isKomma(cursor.pos() - 1)
+                   || cursor.par()->isNewline(cursor.pos() - 1)) {
                        to = from;
                        return;
                }
@@ -2003,7 +2010,8 @@ void LyXText::getWord(LyXCursor & from, 
        case WHOLE_WORD:
                // Move cursor to the beginning, when not already there.
                if (from.pos() && !from.par()->isSeparator(from.pos() - 1)
-                   && !from.par()->isKomma(from.pos() - 1))
+                   && !(from.par()->isKomma(from.pos() - 1)
+                        || from.par()->isNewline(from.pos() - 1)))
                        cursorLeftOneWord(from);
                break;
        case PREVIOUS_WORD:
@@ -2020,6 +2028,7 @@ void LyXText::getWord(LyXCursor & from, 
        while (to.pos() < to.par()->size()
               && !to.par()->isSeparator(to.pos())
               && !to.par()->isKomma(to.pos())
+              && !to.par()->isNewline(to.pos())
               && !to.par()->isHfill(to.pos())
               && !to.par()->isInset(to.pos()))
        {
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.43
diff -u -p -r1.43 text3.C
--- text3.C     11 Mar 2003 15:01:29 -0000      1.43
+++ text3.C     12 Mar 2003 16:13:54 -0000
@@ -33,6 +33,7 @@
 #include "insets/insettext.h"
 #include "insets/insetquotes.h"
 #include "insets/insetcommand.h"
+#include "insets/insetnewline.h"
 #include "undo_funcs.h"
 
 #include <ctime>
@@ -718,7 +719,7 @@ Inset::RESULT LyXText::dispatch(FuncRequ
 
        case LFUN_BREAKLINE:
                bv->beforeChange(this);
-               insertChar(bv, Paragraph::META_NEWLINE);
+               insertInset(bv, new InsetNewline());
                update(bv, true);
                setCursor(bv, cursor.par(), cursor.pos());
                moveCursorUpdate(bv, false);
Index: insets/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/Makefile.am,v
retrieving revision 1.56
diff -u -p -r1.56 Makefile.am
--- insets/Makefile.am  11 Mar 2003 11:52:05 -0000      1.56
+++ insets/Makefile.am  12 Mar 2003 16:13:57 -0000
@@ -71,6 +71,8 @@ libinsets_la_SOURCES = \
        insetmarginal.C \
        insetminipage.C \
        insetminipage.h \
+       insetnewline.C \
+       insetnewline.h \
        insetnote.C \
        insetnote.h \
        insetoptarg.C \
Index: insets/inset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v
retrieving revision 1.75
diff -u -p -r1.75 inset.h
--- insets/inset.h      11 Mar 2003 11:52:05 -0000      1.75
+++ insets/inset.h      12 Mar 2003 16:13:58 -0000
@@ -125,7 +125,9 @@ public:
                ///
                OPTARG_CODE,
                ///
-               HFILL_CODE
+               HFILL_CODE,
+               ///
+               NEWLINE_CODE
        };
 
        ///
Index: insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.106
diff -u -p -r1.106 insetert.C
--- insets/insetert.C   11 Mar 2003 15:01:29 -0000      1.106
+++ insets/insetert.C   12 Mar 2003 16:13:59 -0000
@@ -208,11 +208,14 @@ void InsetERT::write(Buffer const * buf,
                        Paragraph::value_type c = par->getChar(i);
                        switch (c) {
                        case Paragraph::META_INSET:
-                               lyxerr << "Element is not allowed in insertERT"
-                                      << endl;
-                       case Paragraph::META_NEWLINE:
-                               os << "\n\\newline \n";
+                               if (par->getInset(i)->lyxCode() != 
Inset::NEWLINE_CODE) {
+                                       lyxerr << "Element is not allowed in insertERT"
+                                              << endl;
+                               } else {
+                                       par->getInset(i)->write(buf, os);
+                               }
                                break;
+
                        case '\\':
                                os << "\n\\backslash \n";
                                break;
@@ -353,15 +356,11 @@ int InsetERT::latex(Buffer const *, ostr
                        if (isDeletedText(*par, i))
                                continue;
  
-                       Paragraph::value_type c = par->getChar(i);
-                       switch (c) {
-                       case Paragraph::META_NEWLINE:
+                       if (par->isNewline(i)) {
                                os << '\n';
                                ++lines;
-                               break;
-                       default:
-                               os << c;
-                               break;
+                       } else {
+                               os << par->getChar(i);
                        }
                }
                par = par->next();
@@ -388,15 +387,11 @@ int InsetERT::linuxdoc(Buffer const *, o
        while (par) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
-                       Paragraph::value_type c = par->getChar(i);
-                       switch (c) {
-                       case Paragraph::META_NEWLINE:
+                       if (par->isNewline(i)) {
                                os << '\n';
                                ++lines;
-                               break;
-                       default:
-                               os << c;
-                               break;
+                       } else {
+                               os << par->getChar(i);
                        }
                }
                par = par->next();
@@ -417,15 +412,11 @@ int InsetERT::docbook(Buffer const *, os
        while (par) {
                pos_type siz = par->size();
                for (pos_type i = 0; i < siz; ++i) {
-                       Paragraph::value_type c = par->getChar(i);
-                       switch (c) {
-                       case Paragraph::META_NEWLINE:
+                       if (par->isNewline(i)) {
                                os << '\n';
                                ++lines;
-                               break;
-                       default:
-                               os << c;
-                               break;
+                       } else {
+                               os << par->getChar(i);
                        }
                }
                par = par->next();
Index: insets/insetnewline.C
===================================================================
RCS file: insets/insetnewline.C
diff -N insets/insetnewline.C
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ insets/insetnewline.C       12 Mar 2003 16:13:59 -0000
@@ -0,0 +1,140 @@
+/**
+ * \file insetnewline.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+
+#include "insetnewline.h"
+#include "support/LOstream.h"
+#include "frontends/Painter.h"
+#include "frontends/font_metrics.h"
+
+using std::ostream;
+
+InsetNewline::InsetNewline()
+       : Inset()
+{}
+
+
+int InsetNewline::latex(Buffer const *, ostream & os,
+                     bool /*fragile*/, bool /*fs*/) const
+{
+       /* FIXME */
+       return 0;
+}
+
+
+int InsetNewline::ascii(Buffer const *, ostream & os, int) const
+{
+       os << '\n';
+       return 0;
+}
+
+
+void InsetNewline::read(Buffer const *, LyXLex &)
+{
+       /* Nothing to read */
+}
+
+
+void InsetNewline::write(Buffer const *, ostream & os) const
+{
+       os << "\n\\newline \n";
+}
+
+
+int InsetNewline::ascent(BufferView *, LyXFont const & font) const
+{
+       return font_metrics::maxAscent(font);
+}
+
+
+int InsetNewline::descent(BufferView *, LyXFont const & font) const
+{
+       return font_metrics::maxDescent(font);
+}
+
+
+int InsetNewline::width(BufferView *, LyXFont const & font) const
+{
+       return font_metrics::width('n', font);
+}
+
+
+int InsetNewline::latex(Buffer const *, std::ostream & os, bool, bool) const
+{
+       os << '\n';
+}
+
+
+int InsetNewline::ascii(Buffer const *, std::ostream &, int linelen) const
+{
+       os << '\n';
+}
+
+int InsetNewline::docbook(Buffer const *, std::ostream &, bool) const
+{
+       /* FIXME */
+}
+
+
+void InsetNewline::draw(BufferView * bv, LyXFont const & font,
+                       int baseline, float & x, bool) const
+{
+       Painter & pain(bv->painter());
+
+       int const wid = font_metrics::width('n', font);
+       int const asc = font_metrics::maxAscent(font);
+       int const y = baseline;
+       // FIXME: rtl_pos, or ltr_pos ?
+       bool const rtl_pos = false;
+       
+#warning Dekel, please have a look ...
+#if 0
+       rtl_pos = (text_.bidi_level(pos) % 2 == 0);
+#endif
+
+       int xp[3];
+       int yp[3];
+
+       yp[0] = int(y - 0.875 * asc * 0.75);
+       yp[1] = int(y - 0.500 * asc * 0.75);
+       yp[2] = int(y - 0.125 * asc * 0.75);
+
+       if (rtl_pos) {
+               xp[0] = int(x + wid * 0.375);
+               xp[1] = int(x);
+               xp[2] = int(x + wid * 0.375);
+       } else {
+               xp[0] = int(x + wid * 0.625);
+               xp[1] = int(x + wid);
+               xp[2] = int(x + wid * 0.625);
+       }
+
+       pain_.lines(xp, yp, 3, LColor::eolmarker);
+
+       yp[0] = int(y - 0.500 * asc * 0.75);
+       yp[1] = int(y - 0.500 * asc * 0.75);
+       yp[2] = int(y - asc * 0.75);
+
+       if (rtl_pos) {
+               xp[0] = int(x);
+               xp[1] = int(x + wid);
+               xp[2] = int(x + wid);
+       } else {
+               xp[0] = int(x + wid);
+               xp[1] = int(x);
+               xp[2] = int(x);
+       }
+
+       pain.lines(xp, yp, 3, LColor::eolmarker);
+
+       x += wid;
+}
Index: insets/insetnewline.h
===================================================================
RCS file: insets/insetnewline.h
diff -N insets/insetnewline.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ insets/insetnewline.h       12 Mar 2003 16:13:59 -0000
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+/**
+ * \file insetnewline.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef INSET_NEWLINE_H
+#define INSET_NEWLINE_H
+
+
+#include "insetcommand.h"
+
+class InsetNewline : public InsetCommand {
+public:
+
+       InsetNewline();
+
+       virtual Inset * clone(Buffer const &, bool = false) const {
+               return new InsetNewline();
+       }
+
+       Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
+
+       virtual int ascent(BufferView *, LyXFont const &) const;
+
+       virtual int descent(BufferView *, LyXFont const &) const;
+
+       virtual int width(BufferView *, LyXFont const &) const = 0;
+
+       virtual void draw(BufferView *, LyXFont const &,
+                         int baseline, float & x, bool cleared) const = 0;
+
+       virtual int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) 
const;
+
+       virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
+
+       virtual int docbook(Buffer const *, std::ostream &, bool) const;
+
+       virtual void read(Buffer const *, LyXLex & lex);
+
+       virtual void write(Buffer const * buf, std::ostream & os) const;
+       /// We don't need \begin_inset and \end_inset
+       virtual bool directWrite() const { return true; }
+};
+
+#endif // INSET_NEWLINE_H
Index: insets/insetquotes.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetquotes.C,v
retrieving revision 1.80
diff -u -p -r1.80 insetquotes.C
--- insets/insetquotes.C        11 Mar 2003 15:01:29 -0000      1.80
+++ insets/insetquotes.C        12 Mar 2003 16:14:00 -0000
@@ -86,8 +86,9 @@ InsetQuotes::InsetQuotes(char c, BufferP
        // Decide whether left or right
        switch (c) {
        case ' ': case '(':
+#warning eh ? I am lost here ...
        //case Paragraph::META_HFILL:
-       case Paragraph::META_NEWLINE:
+       // case Paragraph::META_NEWLINE:
                side_ = LeftQ;   // left quote
                break;
        default:
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.354
diff -u -p -r1.354 insettext.C
--- insets/insettext.C  12 Mar 2003 11:52:23 -0000      1.354
+++ insets/insettext.C  12 Mar 2003 16:14:04 -0000
@@ -37,6 +37,7 @@
 #include "paragraph_funcs.h"
 #include "sgml.h"
 #include "rowpainter.h"
+#include "insetnewline.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -1468,7 +1469,7 @@ Inset::RESULT InsetText::localDispatch(F
                setUndo(bv, Undo::INSERT,
                        lt->cursor.par(), lt->cursor.par()->next());
 #endif
-               lt->insertChar(bv, Paragraph::META_NEWLINE);
+               lt->insertInset(bv, new InsetNewline());
                updwhat = CURSOR | CURSOR_PAR;
                updflag = true;
        }
@@ -2442,7 +2443,7 @@ void InsetText::removeNewlines()
        ParagraphList::iterator end = paragraphs.end();
        for (; it != end; ++it) {
                for (int i = 0; i < it->size(); ++i) {
-                       if (it->getChar(i) == Paragraph::META_NEWLINE) {
+                       if (it->isNewline(i)) {
                                changed = true;
                                it->erase(i);
                        }
Index: support/textutils.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/textutils.h,v
retrieving revision 1.21
diff -u -p -r1.21 textutils.h
--- support/textutils.h 11 Mar 2003 15:01:29 -0000      1.21
+++ support/textutils.h 12 Mar 2003 16:14:05 -0000
@@ -15,14 +15,6 @@
 #ifndef TEXTUTILS_H
 #define TEXTUTILS_H
 
-/// return true if the char is a meta-character newline
-inline
-bool IsNewlineChar(char c)
-{
-       return (c == Paragraph::META_NEWLINE);
-}
-
-
 /// return true if the char is a word separator
 inline
 bool IsSeparatorChar(char c)
@@ -74,7 +66,6 @@ bool IsKommaChar(char c)
                || c == '^'
                || c == '/'
                || c == '\\'
-               || c == Paragraph::META_NEWLINE
                );
 }
 

Reply via email to