From 732212f233644e9501aad37a82ad0f1b0b8532a5 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Thu, 10 Mar 2011 04:05:49 +0000 Subject: [PATCH] Make sure to associate each line of the exported latex code to the id/pos of the first call of TexRow::start(), rather than the last before a newline. This is what was causing some recent grief (bug #7325, for example). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37894 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TexRow.cpp | 5 +++++ src/TexRow.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/TexRow.cpp b/src/TexRow.cpp index a18d84f543..780cd52af0 100644 --- a/src/TexRow.cpp +++ b/src/TexRow.cpp @@ -32,8 +32,12 @@ void TexRow::reset() void TexRow::start(int id, int pos) { + if (started) + return; + lastid = id; lastpos = pos; + started = true; } @@ -42,6 +46,7 @@ void TexRow::newline() int const id = lastid; RowList::value_type tmp(id, lastpos); rowlist.push_back(tmp); + started = false; } void TexRow::newlines(int num_lines) diff --git a/src/TexRow.h b/src/TexRow.h index 55c9c25ff2..a4edc6c544 100644 --- a/src/TexRow.h +++ b/src/TexRow.h @@ -26,7 +26,7 @@ namespace lyx { class TexRow { public: /// - TexRow() : lastid(-1), lastpos(-1) {} + TexRow() : lastid(-1), lastpos(-1), started(false) {} /// Clears structure void reset(); @@ -90,6 +90,8 @@ private: int lastid; /// Last position int lastpos; + /// Is id/pos already registered for current row? + bool started; };