Fix assertion when inserting text strings via clipboard or ascii file; small

dependency tweak in src/Makefile.am


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@327 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-11-19 14:50:33 +00:00
parent 26b3fc9a02
commit d9c0aa8195
3 changed files with 28 additions and 17 deletions

View File

@ -1,3 +1,12 @@
1999-11-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/Makefile.am (lyx_DEPENDENCIES): give the explicit object
file name in insets and mathed directories (otherwise the
dependency is not taken in account under cygwin).
* src/text2.C (InsertString[AB]): make sure that we do not try to
read characters past the string length.
1999-11-18 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/doc/LaTeXConfig.lyx.in,

View File

@ -3,9 +3,8 @@ SUBDIRS = mathed insets support
DISTCLEANFILES = libintl.h config.h
MAINTAINERCLEANFILES = Makefile.in config.h.in
bin_PROGRAMS = lyx
lyx_LDADD = mathed/mathed.o insets/insets.o support/libsupport.a \
@INTLLIBS@ $(LYX_LIBS)
lyx_DEPENDENCIES = mathed insets support/libsupport.a
lyx_DEPENDENCIES = mathed/mathed.o insets/insets.o support/libsupport.a
lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS)
EXTRA_DIST = config.h.in stamp-h.in cheaders
ETAGS_ARGS = --c++
LYX_DIR = $(datadir)/$(PACKAGE)

View File

@ -2433,8 +2433,9 @@ void LyXText::InsertStringA(LyXParagraph::TextContainer const & text)
/* needed to insert the selection */
void LyXText::InsertStringA(char const * str)
void LyXText::InsertStringA(char const * s)
{
string str(s);
LyXParagraph * par = cursor.par;
LyXParagraph::size_type pos = cursor.pos;
LyXParagraph::size_type a = 0;
@ -2449,10 +2450,11 @@ void LyXText::InsertStringA(char const * str)
ClearSelection();
/* insert the string, don't insert doublespace */
int i = 0;
while (str[i]) {
if (str[i]!= '\n') {
if (str[i] == ' ' && (str[i+1]!= ' ')
string::size_type i = 0;
while (i < str.length()) {
if (str[i] != '\n') {
if (str[i] == ' '
&& i+1<str.length() && str[i+1]!= ' '
&& pos && par->GetChar(pos-1)!= ' ') {
par->InsertChar(pos,' ');
pos++;
@ -2490,7 +2492,7 @@ void LyXText::InsertStringA(char const * str)
}
} else {
if (par->table) {
if (!str[i+1]) {
if (i+1>=str.length()) {
pos++;
break;
}
@ -2550,23 +2552,24 @@ void LyXText::InsertStringB(char const * s)
{
string str(s);
LyXParagraph * par = cursor.par;
int i = 1;
while (str[i]) {
string::size_type i = 1;
while (i < str.length()) {
if (str[i] == '\t' && !par->table)
str[i] = ' ';
if (str[i] == ' ' && str[i + 1] == ' ')
if (str[i] == ' ' && i+1 < str.length() && str[i + 1] == ' ')
str[i] = 13;
if (str[i] == '\n' && str[i + 1] && !par->table){
if (str[i] == '\n' && i+1 < str.length() && !par->table){
if (str[i + 1] != '\n') {
if (str[i - 1] != ' ')
str[i] = ' ';
else
str[i] = 13;
}
while (str[i + 1] && (str[i + 1] == ' '
|| str[i + 1] == '\t'
|| str[i + 1] == '\n'
|| str[i + 1] == 13)) {
while (i+1 < str.length()
&& (str[i + 1] == ' '
|| str[i + 1] == '\t'
|| str[i + 1] == '\n'
|| str[i + 1] == 13)) {
str[i + 1] = 13;
++i;
}