+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,
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)
/* 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;
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++;
}
} else {
if (par->table) {
- if (!str[i+1]) {
+ if (i+1>=str.length()) {
pos++;
break;
}
{
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;
}