From: Jean-Marc Lasgouttes Date: Mon, 31 Jan 2005 17:21:17 +0000 (+0000) Subject: fix inserting text file into a text inset X-Git-Tag: 1.6.10~14592 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3f74d3dc9b5589aeb28c63b798d7801ce272c7c4;p=features.git fix inserting text file into a text inset git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9560 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 23bc6e0a97..56fe22748f 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -809,7 +809,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm) owner_->message(bformat(_("Inserting document %1$s..."), disp_fn)); bv_->cursor().clearSelection(); - bv_->text()->breakParagraph(bv_->cursor()); + bv_->getLyXText()->breakParagraph(bv_->cursor()); BOOST_ASSERT(bv_->cursor().inTexted()); diff --git a/src/ChangeLog b/src/ChangeLog index 302cba77df..9231149145 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2005-01-27 Jean-Marc Lasgouttes + + * BufferView_pimpl.C (MenuInsertLyXFile): do breakParagraph on the + LyXText containing the cursor, not the top-level one. + + * buffer.C (Impl): make sure the toplevel insettext has AutoBreak_ + true. + (insertStringAsLines): rename par to pit; use temporary variable + par to hold a Paragraph; do not store par.layout() in a variable, + since the pointer may die when breaking paragraphs; pass pars to + breakParagraph() instead of Buffer::paragraphs(). + 2005-01-31 Asger Ottar Alstrup * lyxlex_pimpl.h: #include . @@ -39,7 +51,7 @@ * vc-backend.C (find_file): rewrite to use boost.filesystem (scanMaster): ditto - * main.C (main): sett default name check for boost.filesystem to + * main.C (main): set default name check for boost.filesystem to no check * lyxfunc.C (menuNew): rewrite to use boost.filesystem @@ -88,7 +100,7 @@ 2005-01-24 Jürgen Spitzmüller * LaTeXFeatures.[Ch]: Add a static list packages_ that - holds the contens of packages.lst. New functions getAvailable + holds the contents of packages.lst. New functions getAvailable and isAvailable to parse and check that list, resp. * LyXAction.C: diff --git a/src/buffer.C b/src/buffer.C index 86a39eafcf..72322b07a4 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -198,6 +198,7 @@ Buffer::Impl::Impl(Buffer & parent, string const & file, bool readonly_) filename(file), filepath(OnlyPath(file)), file_fully_loaded(false), inset(params) { + inset.setAutoBreakRows(true); lyxvc.buffer(&parent); temppath = createBufferTmpDir(); // FIXME: And now do something if temppath == string(), because we @@ -472,23 +473,22 @@ bool Buffer::readDocument(LyXLex & lex) // needed to insert the selection void Buffer::insertStringAsLines(ParagraphList & pars, - pit_type & par, pos_type & pos, + pit_type & pit, pos_type & pos, LyXFont const & fn, string const & str, bool autobreakrows) { - LyXLayout_ptr const & layout = pars[par].layout(); - LyXFont font = fn; - pars[par].checkInsertChar(font); + pars[pit].checkInsertChar(font); // insert the string, don't insert doublespace bool space_inserted = true; for (string::const_iterator cit = str.begin(); - cit != str.end(); ++cit) { + cit != str.end(); ++cit) { + Paragraph & par = pars[pit]; if (*cit == '\n') { - if (autobreakrows && (!pars[par].empty() || pars[par].allowEmpty())) { - breakParagraph(params(), paragraphs(), par, pos, - layout->isEnvironment()); - ++par; + if (autobreakrows && (!par.empty() || par.allowEmpty())) { + breakParagraph(params(), pars, pit, pos, + par.layout()->isEnvironment()); + ++pit; pos = 0; space_inserted = true; } else { @@ -496,18 +496,18 @@ void Buffer::insertStringAsLines(ParagraphList & pars, } // do not insert consecutive spaces if !free_spacing } else if ((*cit == ' ' || *cit == '\t') && - space_inserted && !pars[par].isFreeSpacing()) { + space_inserted && !par.isFreeSpacing()) { continue; } else if (*cit == '\t') { - if (!pars[par].isFreeSpacing()) { + if (!par.isFreeSpacing()) { // tabs are like spaces here - pars[par].insertChar(pos, ' ', font); + par.insertChar(pos, ' ', font); ++pos; space_inserted = true; } else { const pos_type n = 8 - pos % 8; for (pos_type i = 0; i < n; ++i) { - pars[par].insertChar(pos, ' ', font); + par.insertChar(pos, ' ', font); ++pos; } space_inserted = true; @@ -517,7 +517,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars, continue; } else { // just insert the character - pars[par].insertChar(pos, *cit, font); + par.insertChar(pos, *cit, font); ++pos; space_inserted = (*cit == ' '); }