some important changes to FIX_DOUBLE_SPCE still not completely correct (please help out.) Some external functions called from wrappers. use MODERN_STL_STREAMS in lyxsum.C

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@423 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-01-17 21:01:30 +00:00
parent 722d679779
commit c36aa67f7b
21 changed files with 288 additions and 142 deletions

View File

@ -1,3 +1,26 @@
2000-01-14 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/date.C: new file
* src/support/chdir.C: new file
* src/support/getUserName.C: new file
* src/support/getcwd.C: new file
* src/support/abort.C: new file
* src/support/kill.C: new file
* src/support/lyxlib.h: moved all the functions in this file
insede struct lyx. Added also kill and abort to this struct. This
is a way to avoid the "kill is not defined in <csignal>", we make
C++ wrappers for functions that are not ANSI C or ANSI C++.
* src/support/lyxsum.C (sum): use #ifdef MODERN_STL_STREAMS
instead of #if __GLIBCPP__. Since lyxsum is now put inside struct
lyx it has been renamed to sum.
2000-01-14 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/text.C: add using directives for std::min and std::max.

View File

@ -35,7 +35,7 @@ void DepTable::insert(string const & fi,
if (deplist.find(f) == deplist.end()) {
if (upd) {
one = two;
two = lyxsum(f.c_str());
two = lyx::sum(f.c_str());
}
deplist[f] = make_pair(one, two);
}
@ -48,7 +48,7 @@ void DepTable::update()
itr != deplist.end();
++itr) {
unsigned long one = (*itr).second.second;
unsigned long two = lyxsum((*itr).first.c_str());
unsigned long two = lyx::sum((*itr).first.c_str());
(*itr).second = make_pair(one, two);
if (lyxerr.debugging()) {
lyxerr << "update: " << (*itr).first << " "

View File

@ -1588,7 +1588,7 @@ void Buffer::makeLaTeXFile(string const & fname,
// first paragraph of the document. (Asger)
texrow.start(paragraph, 0);
string userName(getUserName());
string userName(lyx::getUserName());
string LFile;
if (!only_body && nice) {
@ -2146,9 +2146,9 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
<< params.preamble << " \n]>\n\n";
}
string userName(getUserName());
string userName(lyx::getUserName());
ofs << "<!-- LinuxDoc file was created by LyX 1.0 (C) 1995-1999 "
<< "by <" << userName << "> " << date() << " -->\n";
<< "by <" << userName << "> " << lyx::date() << " -->\n";
if(params.options.empty())
sgmlOpenTag(ofs, 0, top_element);

View File

@ -57,6 +57,7 @@ using std::ifstream;
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "support/FileInfo.h"
#include "support/lyxlib.h"
extern BufferView * current_view;
#if 0
@ -260,7 +261,7 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
lyxerr << "Killing gs "
<< p->gspid << endl;
}
kill(p->gspid, SIGHUP);
lyx::kill(p->gspid, SIGHUP);
sprintf(tmp, "%s/~lyxgs%d.ps",
system_tempdir.c_str(),
@ -275,7 +276,7 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
lyxerr << "Killing gs "
<< p->gspid << endl;
}
kill(p->gspid, SIGHUP);
lyx::kill(p->gspid, SIGHUP);
sprintf(tmp, "%s/~lyxgs%d.ps",
system_tempdir.c_str(),
@ -472,7 +473,7 @@ static void freefigdata(figdata * tmpdata)
chpixmap(tmpdata->bitmap, tmpdata->wid, tmpdata->hgh);
// kill ghostscript and unlink it's files
tmpdata->gspid = -1;
kill(pid, SIGKILL);
lyx::kill(pid, SIGKILL);
sprintf(buf, "%s/~lyxgs%d.ps", system_tempdir.c_str(), pid);
unlink(buf);
}

View File

@ -156,7 +156,7 @@ extern "C" int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
XGetErrorText(display, xeev->error_code, etxt, 512);
lyxerr << etxt << endl;
// By doing an abort we get a nice backtrace. (hopefully)
abort();
lyx::abort();
return 0; // Solaris CC wants us to return something
}

View File

@ -615,6 +615,6 @@ void error_handler(int err_sig)
lyxerr << "Bye." << endl;
if(err_sig!= SIGHUP && (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
abort();
lyx::abort();
exit(0);
}

View File

@ -2,6 +2,8 @@
#ifndef LASSERT_H
#define LASSERT_H
#include "support/lyxlib.h"
//namespace LyX {
#ifdef ENABLE_ASSERTIONS
@ -11,7 +13,7 @@ template<class A> inline void Assert(A assertion)
{
//if (!assertion) throw X();
if (!assertion) {
abort();
lyx::abort();
}
}
@ -24,7 +26,7 @@ template<class A> inline void Assert(A * ptr)
template<> inline void Assert(void const * ptr)
{
if (!ptr) {
abort();
lyx::abort();
}
}
#endif /* HAVE_PARTIAL_SPECIALIZATION */

View File

@ -23,9 +23,15 @@ libsupport_la_SOURCES = \
LRegex.h \
LSubstring.C \
LSubstring.h \
abort.C \
block.h \
chdir.C \
date.C \
filetools.C \
filetools.h \
getUserName.C \
getcwd.C \
kill.C \
lstrings.C \
lstrings.h \
lyxlib.h \

10
src/support/abort.C Normal file
View File

@ -0,0 +1,10 @@
#include <config.h>
#include <stdlib.h>
#include "support/lyxlib.h"
void lyx::abort()
{
::abort();
}

14
src/support/chdir.C Normal file
View File

@ -0,0 +1,14 @@
#include <config.h>
#include <unistd.h>
#include "support/lyxlib.h"
int lyx::chdir(char const * name)
{
#ifndef __EMX__
return ::chdir(name);
#else
return ::_chdir2(name);
#endif
}

14
src/support/date.C Normal file
View File

@ -0,0 +1,14 @@
#include <config.h>
#include <time.h>
#include "support/lyxlib.h"
char * lyx::date()
{
time_t tid;
if ((tid = ::time(0)) == static_cast<time_t>(-1))
return 0;
else
return ::ctime(&tid);
}

15
src/support/getUserName.C Normal file
View File

@ -0,0 +1,15 @@
#include <config.h>
#include "support/lyxlib.h"
#include "support/filetools.h"
#include "gettext.h"
string lyx::getUserName()
{
string userName(GetEnv("LOGNAME"));
if (userName.empty())
userName = GetEnv("USER");
if (userName.empty())
userName = _("unknown");
return userName;
}

14
src/support/getcwd.C Normal file
View File

@ -0,0 +1,14 @@
#include <config.h>
#include <unistd.h>
#include "support/lyxlib.h"
char * lyx::getcwd(char * buffer, size_t size)
{
#ifndef __EMX__
return ::getcwd(buffer, size);
#else
return ::_getcwd2(buffer, size);
#endif
}

11
src/support/kill.C Normal file
View File

@ -0,0 +1,11 @@
#include <config.h>
#include <sys/types.h>
#include <signal.h>
#include "lyxlib.h"
int lyx::kill(pid_t pid, int sig)
{
return ::kill(pid, sig);
}

View File

@ -10,36 +10,36 @@
#include <cstring>
#include "LAssert.h"
//#include "LAssert.h"
//#warning verify this please. Lgb
///
template<class T>
size_t lstrlen(T const * t)
{
Assert(t); // we don't want null pointers
size_t count = 0;
T const * r = t;
while(*r != 0) ++r, ++count;
return count;
}
//template<class T>
//size_t lstrlen(T const * t)
//{
// Assert(t); // we don't want null pointers
// size_t count = 0;
// T const * r = t;
// while(*r != 0) ++r, ++count;
// return count;
//}
//#warning verify this please. Lgb
//#Warning verify this please. Lgb
///
template<class T>
T * lstrchr(T const * t, int c)
{
Assert(t); // we don't want null pointers
T * r = const_cast<T*>(t);
while(*r != 0) {
if (*r == c)
return r;
else
++r;
}
return 0;
}
//template<class T>
//T * lstrchr(T const * t, int c)
//{
// Assert(t); // we don't want null pointers
// T * r = const_cast<T*>(t);
// while(*r != 0) {
// if (*r == c)
// return r;
// else
// ++r;
// }
// return 0;
//}
#include <cctype>
#include "LString.h"

View File

@ -12,56 +12,27 @@
#ifndef LYX_LIB_H
#define LYX_LIB_H
#include <ctime>
#include <unistd.h>
#include "LString.h"
#include "gettext.h"
#include "support/filetools.h"
/// generates an checksum
unsigned long lyxsum(char const * file);
/// returns a date string
inline char * date()
{
time_t tid;
if ((tid= time(0)) == static_cast<time_t>(-1))
return 0;
else
return ctime(&tid);
}
// Where can I put this? I found the occurence of the same code
// three/four times. Don't you think it better to use a macro definition
// (an inlined member of some class)?
///
inline string getUserName()
{
string userName(GetEnv("LOGNAME"));
if (userName.empty())
userName = GetEnv("USER");
if (userName.empty())
userName = _("unknown");
return userName;
}
// This should have been a namespace
struct lyx {
static char * getcwd(char * buffer, size_t size) {
#ifndef __EMX__
return ::getcwd(buffer, size);
#else
return ::_getcwd2(buffer, size);
#endif
};
static int chdir(char const * name) {
#ifndef __EMX__
return ::chdir(name);
#else
return ::_chdir2(name);
#endif
};
///
static char * getcwd(char * buffer, size_t size);
///
static int chdir(char const * name);
/// generates an checksum
static unsigned long sum(char const * file);
/// returns a date string
static char * date();
///
static string getUserName();
///
static int kill(int pid, int sig);
///
static void abort();
};
#endif

View File

@ -3,7 +3,7 @@
*
* LyX, The Document Processor
*
* The function lyxsum is taken from GNU textutill-1.22
* The function lyx::sum is taken from GNU textutill-1.22
* and is there part of the program chsum. The chsum program
* is written by Q. Frank Xia, qx@math.columbia.edu.
*
@ -14,12 +14,14 @@
#include <config.h>
#ifdef __GLIBCPP__
#ifdef MODERN_STL_STREAMS
#include <fstream>
#else
#include <cstdio>
#endif
#include "support/lyxlib.h"
/* Number of bytes to read at once. */
#define BUFLEN (1 << 16)
@ -84,12 +86,12 @@ static unsigned long const crctab[256] =
Return crc if successful, 0 if an error occurs. */
unsigned long
lyxsum (char const * file)
lyx::sum (char const * file)
{
unsigned long crc = 0;
long length = 0;
long bytes_read;
#if __GLIBCPP__
#ifdef MODERN_STL_STREAMS
char buf[BUFLEN];
ifstream ifs(file);
if (!ifs) {
@ -98,7 +100,6 @@ lyxsum (char const * file)
while ((bytes_read = ifs.readsome(buf, BUFLEN)) > 0) {
unsigned char * cp = reinterpret_cast<unsigned char*>(buf);
length += bytes_read;
while (bytes_read--)
crc = (crc << 8) ^ crctab[((crc >> 24) ^ *(cp++)) & 0xFF];

View File

@ -14,6 +14,7 @@
#include "syscall.h"
#include "syscontr.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
Systemcalls::Systemcalls() {
pid = 0; // No child yet
@ -33,7 +34,7 @@ Systemcalls::~Systemcalls() {
#if 0
// If the child is alive, we have to brutally kill it
if (getpid() != 0) {
::kill(getpid(), SIGKILL);
lyx::kill(getpid(), SIGKILL);
}
#endif
}
@ -77,7 +78,7 @@ void Systemcalls::kill(int /*tolerance*/) {
lyxerr << "LyX: Can't kill non-existing process." << endl;
return;
}
int ret = ::kill(getpid(), SIGHUP);
int ret = lyx::kill(getpid(), SIGHUP);
bool wait_for_death = true;
if (ret != 0) {
if (errno == ESRCH) {

View File

@ -4,7 +4,7 @@
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team.
* Copyright (C) 1995-2000 The LyX Team.
*
* ====================================================== */

View File

@ -5,7 +5,7 @@
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1998 The LyX Team
* Copyright 1995-2000 The LyX Team
*
* ====================================================== */

View File

@ -1746,7 +1746,7 @@ void LyXText::InsertInset(Inset *inset)
}
/* this is for the simple cut and paste mechanism */
// this is for the simple cut and paste mechanism
static LyXParagraph * simple_cut_buffer = 0;
static char simple_cut_buffer_textclass = 0;
@ -1754,7 +1754,7 @@ void DeleteSimpleCutBuffer()
{
if (!simple_cut_buffer)
return;
LyXParagraph *tmppar;
LyXParagraph * tmppar;
while (simple_cut_buffer) {
tmppar = simple_cut_buffer;
@ -1789,7 +1789,7 @@ void LyXText::CutSelection(bool doclear)
// Check whether there are half footnotes in the selection
if (sel_start_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE
|| sel_end_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE){
|| sel_end_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
tmppar = sel_start_cursor.par;
while (tmppar != sel_end_cursor.par){
if (tmppar->footnoteflag != sel_end_cursor.par->footnoteflag) {
@ -1832,7 +1832,7 @@ void LyXText::CutSelection(bool doclear)
.par->ParFromPos(sel_start_cursor.pos)->previous,
undoendpar);
// delete the simple_cut_buffer
// clear the simple_cut_buffer
DeleteSimpleCutBuffer();
// set the textclass
@ -1867,7 +1867,18 @@ void LyXText::CutSelection(bool doclear)
- cut across footnotes and paragraph
My simplistic tests show that the idea are basically sound but
there are some items to fix up...we only need to find them
first. (Lgb)
first.
As do redo Asger's example above (with | beeing the cursor in the
result after cutting.):
Example: "This is our text."
Using " our " as selection, cutting will give "This is|text.".
Using "our" as selection, cutting will give "This is | text.".
Using " our" as selection, cutting will give "This is| text.".
Using "our " as selection, cutting will give "This is |text.".
(Lgb)
*/
#ifndef FIX_DOUBLE_SPACE
@ -1898,7 +1909,7 @@ void LyXText::CutSelection(bool doclear)
for (; i < sel_end_cursor.pos; ++i) {
/* table stuff -- begin */
if (sel_start_cursor.par->table
&& sel_start_cursor.par->IsNewline(sel_start_cursor.pos)){
&& sel_start_cursor.par->IsNewline(sel_start_cursor.pos)) {
sel_start_cursor.par->CopyIntoMinibuffer(sel_start_cursor.pos);
sel_start_cursor.pos++;
} else {
@ -1908,27 +1919,31 @@ void LyXText::CutSelection(bool doclear)
}
simple_cut_buffer->InsertFromMinibuffer(simple_cut_buffer->Last());
}
#ifdef FIX_DOUBLE_SPACES
#ifndef FIX_DOUBLE_SPACE
// check for double spaces
if (sel_start_cursor.pos &&
sel_start_cursor.par->Last() > sel_start_cursor.pos &&
sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos - 1) &&
sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos)) {
sel_start_cursor.par->Last() > sel_start_cursor.pos
&& sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos - 1)
&& sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos)) {
sel_start_cursor.par->Erase(sel_start_cursor.pos);
}
if (space_wrapped)
simple_cut_buffer->InsertChar(i - sel_start_cursor.pos, ' ');
simple_cut_buffer->InsertChar(i - sel_start_cursor.pos,
' ');
#endif
endpar = sel_end_cursor.par->Next();
}
else {
} else {
// cut more than one paragraph
sel_end_cursor.par->BreakParagraphConservative(sel_end_cursor.pos);
sel_end_cursor.par
->BreakParagraphConservative(sel_end_cursor.pos);
#ifndef FIX_DOUBLE_SPACE
// insert a space at the end if there was one
if (space_wrapped)
sel_end_cursor.par->InsertChar(sel_end_cursor.par->Last(), ' ');
sel_end_cursor.par
->InsertChar(sel_end_cursor.par->Last(), ' ');
#endif
sel_end_cursor.par = sel_end_cursor.par->Next();
sel_end_cursor.pos = 0;
@ -1938,22 +1953,26 @@ void LyXText::CutSelection(bool doclear)
#ifndef FIX_DOUBLE_SPACE
// please break behind a space, if there is one.
// The space should be copied too
if (sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos))
if (sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos))
sel_start_cursor.pos++;
#endif
sel_start_cursor.par
->BreakParagraphConservative(sel_start_cursor.pos);
#ifndef FIX_DOUBLE_SPACE
if (!sel_start_cursor.pos
|| sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos - 1)
|| sel_start_cursor.par->IsNewline(sel_start_cursor.pos - 1)) {
|| sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos - 1)
|| sel_start_cursor.par
->IsNewline(sel_start_cursor.pos - 1)) {
sel_start_cursor.par->Next()->InsertChar(0, ' ');
}
#endif
// store the endparagraph for redoing later
endpar = sel_end_cursor.par->Next(); /* needed because
the sel_end_
cursor.par
will be pasted! */
endpar = sel_end_cursor.par->Next(); /* needed because
the sel_end_
cursor.par
will be pasted! */
// store the selection
simple_cut_buffer = sel_start_cursor.par
@ -1970,7 +1989,7 @@ void LyXText::CutSelection(bool doclear)
// care about footnotes
if (simple_cut_buffer->footnoteflag) {
LyXParagraph *tmppar = simple_cut_buffer;
LyXParagraph * tmppar = simple_cut_buffer;
while (tmppar){
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
tmppar = tmppar->next;
@ -1988,15 +2007,17 @@ void LyXText::CutSelection(bool doclear)
!sel_start_cursor.par->Next()->Last())
sel_start_cursor.par->ParFromPos(sel_start_cursor.pos)->PasteParagraph();
#ifdef FIX_DOUBLE_SPACE
#ifndef FIX_DOUBLE_SPACE
// maybe a forgotten blank
if (sel_start_cursor.pos
&& sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos)
&& sel_start_cursor.par->IsLineSeparator(sel_start_cursor.pos - 1)) {
&& sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos)
&& sel_start_cursor.par
->IsLineSeparator(sel_start_cursor.pos - 1)) {
sel_start_cursor.par->Erase(sel_start_cursor.pos);
}
#endif
}
}
// sometimes necessary
if (doclear)
@ -2024,12 +2045,14 @@ void LyXText::CopySelection()
/* check wether there are half footnotes in the selection */
if (sel_start_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE
|| sel_end_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE){
|| sel_end_cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
tmppar = sel_start_cursor.par;
while (tmppar != sel_end_cursor.par){
if (tmppar->footnoteflag != sel_end_cursor.par->footnoteflag){
while (tmppar != sel_end_cursor.par) {
if (tmppar->footnoteflag !=
sel_end_cursor.par->footnoteflag) {
WriteAlert(_("Impossible operation"),
_("Don't know what to do with half floats."),
_("Don't know what to do"
" with half floats."),
_("sorry."));
return;
}
@ -2099,13 +2122,13 @@ void LyXText::CopySelection()
tmppar = tmppar->next;
}
}
// the simple_cut_buffer paragraph is too big
LyXParagraph::size_type tmpi2 =
sel_start_cursor.par->PositionInParFromPos(sel_start_cursor.pos);
for (; tmpi2; --tmpi2)
simple_cut_buffer->Erase(0);
// now tmppar 2 is too big, delete all after sel_end_cursor.pos
tmpi2 = sel_end_cursor.par->PositionInParFromPos(sel_end_cursor.pos);
@ -2145,8 +2168,8 @@ void LyXText::PasteSelection()
}
/* table stuff -- begin */
if (cursor.par->table){
if (simple_cut_buffer->next){
if (cursor.par->table) {
if (simple_cut_buffer->next) {
WriteAlert(_("Impossible operation"),
_("Table cell cannot include more than one paragraph!"),
_("Sorry."));
@ -2186,24 +2209,55 @@ void LyXText::PasteSelection()
else
table_too_small = true;
} else {
#ifdef FIX_DOUBLE_SPACE
// This is an attempt to fix the
// "never insert a space at the
// beginning of a paragraph" problem.
if (tmpcursor.pos == 0
&& simple_cut_buffer->IsLineSeparator(0)) {
simple_cut_buffer->Erase(0);
} else {
simple_cut_buffer->CutIntoMinibuffer(0);
simple_cut_buffer->Erase(0);
tmpcursor.par->InsertFromMinibuffer(tmpcursor.pos);
tmpcursor.pos++;
}
#else
simple_cut_buffer->CutIntoMinibuffer(0);
simple_cut_buffer->Erase(0);
tmpcursor.par->InsertFromMinibuffer(tmpcursor.pos);
tmpcursor.pos++;
#endif
}
}
} else {
/* table stuff -- end */
// Some provisions should be done here for checking
// if we are inserting at the beginning of a
// paragraph. If there are a space at the beginning
// of the text to insert and we are inserting at
// the beginning of the paragraph the space should
// be removed.
while (simple_cut_buffer->text.size()) {
#ifdef FIX_DOUBLE_SPACE
// This is an attempt to fix the
// "never insert a space at the
// beginning of a paragraph" problem.
if (tmpcursor.pos == 0
&& simple_cut_buffer->IsLineSeparator(0)) {
simple_cut_buffer->Erase(0);
} else {
simple_cut_buffer->CutIntoMinibuffer(0);
simple_cut_buffer->Erase(0);
tmpcursor.par->InsertFromMinibuffer(tmpcursor.pos);
tmpcursor.pos++;
}
}
} else {
/* table stuff -- end */
// Some provisions should be done here for checking if we
// are inserting at the beginning of a paragraph. If there
// are a space at the beginning of the text to insert and we are
// inserting at the beginning of the paragraph the space should
// be removed.
while (simple_cut_buffer->text.size()) {
#else
simple_cut_buffer->CutIntoMinibuffer(0);
simple_cut_buffer->Erase(0);
tmpcursor.par->InsertFromMinibuffer(tmpcursor.pos);
tmpcursor.pos++;
#endif
}
}
delete simple_cut_buffer;
@ -2241,16 +2295,22 @@ void LyXText::PasteSelection()
simple_cut_buffer->MakeSameLayout(cursor.par);
// find the end of the buffer
LyXParagraph *lastbuffer = simple_cut_buffer;
LyXParagraph * lastbuffer = simple_cut_buffer;
while (lastbuffer->Next())
lastbuffer = lastbuffer->Next();
// find the physical end of the buffer
#ifdef WITH_WARNINGS
#warning Explain this please.
#endif
#if 0
// Can someone explain to be why this is done a second time?
// (Lgb)
lastbuffer = simple_cut_buffer;
while (lastbuffer->Next())
lastbuffer = lastbuffer->Next();
#ifndef FIX_DOUBLE_SPACE
#endif
#ifndef FIX_DOUBLE_SPACE
// Please break behind a space, if there is one. The space
// should be copied too.
if (cursor.par->Last() > cursor.pos
@ -2279,11 +2339,14 @@ void LyXText::PasteSelection()
endpar = cursor.par->ParFromPos(cursor.pos)->next->Next();
// paste it!
lastbuffer->ParFromPos(lastbuffer->Last())->next = cursor.par->ParFromPos(cursor.pos)->next;
cursor.par->ParFromPos(cursor.pos)->next->previous = lastbuffer->ParFromPos(lastbuffer->Last());
lastbuffer->ParFromPos(lastbuffer->Last())->next =
cursor.par->ParFromPos(cursor.pos)->next;
cursor.par->ParFromPos(cursor.pos)->next->previous =
lastbuffer->ParFromPos(lastbuffer->Last());
cursor.par->ParFromPos(cursor.pos)->next = simple_cut_buffer;
simple_cut_buffer->previous = cursor.par->ParFromPos(cursor.pos);
simple_cut_buffer->previous =
cursor.par->ParFromPos(cursor.pos);
if (cursor.par->ParFromPos(cursor.pos)->Next() == lastbuffer)
lastbuffer = cursor.par;
@ -2310,7 +2373,7 @@ void LyXText::PasteSelection()
} else if (!lastbuffer->Next()->Last()) {
lastbuffer->Next()->MakeSameLayout(lastbuffer);
#ifndef FIX_DOUBLE_SPACE
#ifndef FIX_DOUBLE_SPACE
// be careful witth double spaces
if ((!lastbuffer->Last()
|| lastbuffer->IsLineSeparator(lastbuffer->Last() - 1)
@ -2334,8 +2397,8 @@ void LyXText::PasteSelection()
#endif
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph();
}
else lastbuffer->Next()->ClearParagraph();
} else
lastbuffer->Next()->ClearParagraph();
}
// restore the simple cut buffer