lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-03 Thread Kayvan A. Sylvan

Hi everyone,

In the latest lyx-1.1.5cvs:

All protected spaces (created by Ctl-SPC) are getting output as the ~
character.

While this seems to work for straight LaTeX, it does *not* work for noweb
output (for literate programming) and generates bad LaTeX output in that
case too.

My suggestion is that inside Scrap layouts, the protected-space should output
just a space (better yet, allow SPC SPC to work in a Scrap layout, obviating
the need for doing protected-SPC for formatting code).

---Kayvan
-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Lars Gullik Bjønnes

Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| > "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:
| 
| Kayvan> Does an inset have any access to its containing paragraph? If
| Kayvan> so, it would be easy for the InsetSpecialChar::Latex to output
| Kayvan> a space in that case.
| 
| I guess Lars is the best person to answer this question. With the
| recent changes wrt current_view, I do not know what an inset should do
| when it needs to know who owns him (which paragraph, in this case).
| 
| JMarc

No it doesen't but it absolutely should. The best  (less maintence
problems) would be if this  knwledge about the surounding envronment
could be done with arguments.

Lgb



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Kayvan A. Sylvan

> 
> No it doesen't but it absolutely should. The best  (less maintence
> problems) would be if this  knwledge about the surounding envronment
> could be done with arguments.
> 

Do you want to make that change or should I?

I can easily pass the freespacing bool around when the inset->latex() functions
get called.

---Kayvan

-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Lars Gullik Bjønnes

"Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes:

| > > In what way is this different from freespacing?
| > 
| > I assume you mean freespacing? 
| > 
| > It's supposed to do the same thing, but the freespacing hack does not work
| > and I didn't find it till after I'd implemented mine. :-)
| 
| On second thought, don't check in my diffs.
| 
| I'm looking at and fixing your freespacing hack.

I can asure you that it is not mine...

Lgb



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Kayvan A. Sylvan

On Tue, Mar 07, 2000 at 02:21:13AM +0100, Lars Gullik Bjønnes wrote:
> "Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes:
> 
> | On second thought, don't check in my diffs.
> | 
> | I'm looking at and fixing your freespacing hack.
> 
> I can asure you that it is not mine...

*laugh*

-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-08 Thread Jean-Marc Lasgouttes

> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> "Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes: | > | > No it
Lars> doesen't but it absolutely should. The best (less maintence | >
Lars> problems) would be if this knwledge about the surounding
Lars> envronment | > could be done with arguments. | > | | Do you want
Lars> to make that change or should I? | | I can easily pass the
Lars> freespacing bool around when the inset->latex() functions | get
Lars> called.

Lars> Is the freespacing bool enough? Ot should we rather pass a
Lars> pointer to the surrounding paragraph parameters?

I am sure that in other cases other problems will occur... What would
be nice is to have a special output stream (the writer) which would
now among other things the current paragraph (this is needed anyway to
incorporate the texrow stuff in the writer).

If we were to pass the freespacing bool, we might as well pass the
whole layout info.

JMarc



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-07 Thread Lars Gullik Bjønnes

"Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes:

| > 
| > No it doesen't but it absolutely should. The best  (less maintence
| > problems) would be if this  knwledge about the surounding envronment
| > could be done with arguments.
| > 
| 
| Do you want to make that change or should I?
| 
| I can easily pass the freespacing bool around when the inset->latex() functions
| get called.

Is the freespacing bool enough? Ot should we rather pass a pointer to
the surrounding paragraph parameters?

Lgb



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-08 Thread Lars Gullik Bjønnes

Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| > "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:
| 
| Lars> "Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes: | > | > No it
| Lars> doesen't but it absolutely should. The best (less maintence | >
| Lars> problems) would be if this knwledge about the surounding
| Lars> envronment | > could be done with arguments. | > | | Do you want
| Lars> to make that change or should I? | | I can easily pass the
| Lars> freespacing bool around when the inset->latex() functions | get
| Lars> called.
| 
| Lars> Is the freespacing bool enough? Ot should we rather pass a
| Lars> pointer to the surrounding paragraph parameters?
| 
| I am sure that in other cases other problems will occur... What would
| be nice is to have a special output stream (the writer) which would
| now among other things the current paragraph (this is needed anyway to
| incorporate the texrow stuff in the writer).
| 
| If we were to pass the freespacing bool, we might as well pass the
| whole layout info.

Will more thatn the buffer parameters be needed then?

Lgb



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-04 Thread Lars Gullik Bjønnes

"Kayvan A. Sylvan" <[EMAIL PROTECTED]> writes:

| Hi everyone,
| 
| In the latest lyx-1.1.5cvs:
| 
| All protected spaces (created by Ctl-SPC) are getting output as the ~
| character.
| 
| While this seems to work for straight LaTeX, it does *not* work for noweb
| output (for literate programming) and generates bad LaTeX output in that
| case too.
| 

So this is the free spacing hack...
My suggestion is that someone help me get this right in cvs with the
new InsetSpecialchar for protected spaces.


| My suggestion is that inside Scrap layouts, the protected-space should output
| just a space (better yet, allow SPC SPC to work in a Scrap layout, obviating
| the need for doing protected-SPC for formatting code)

Hardcoding anything for Scrap layout is not an option unless it is in
the layout file. This is also a more general problem.

Lgb

| 
|   ---Kayvan
| -- 
| Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
| Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
| http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-04 Thread Kayvan A. Sylvan

> So this is the free spacing hack...
> My suggestion is that someone help me get this right in cvs with the
> new InsetSpecialchar for protected spaces.

Hmmm... What would be involved here?

> | My suggestion is that inside Scrap layouts, the protected-space should output
> | just a space (better yet, allow SPC SPC to work in a Scrap layout, obviating
> | the need for doing protected-SPC for formatting code)
> 
> Hardcoding anything for Scrap layout is not an option unless it is in
> the layout file. This is also a more general problem.

I'm working on it. I've added a new boolean AllowMultipleSpaces to the
layout file and am making the corresponding changes to make it work right.

---Kayvan
-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-05 Thread Kayvan A. Sylvan

On Sat, Mar 04, 2000 at 03:08:38PM -0800, Kayvan A. Sylvan wrote:
>
> > Hardcoding anything for Scrap layout is not an option unless it is in
> > the layout file. This is also a more general problem.
> 
> I'm working on it. I've added a new boolean AllowMultipleSpaces to the
> layout file and am making the corresponding changes to make it work right.

Here is the completed patch. I included the ChangeLog entries and changed
the examples/noweb2lyx.lyx and examples/Literate.lyx, along with adding
some docs to the Customiaztion.lyx and fixing Extended.lyx in view of
this fix.

After I figured out where to put the fix, it was easy.

This works fine for me. Please apply LYXDIFFS to lyx-devel and DOCDIFFS
to lyxdoc.

Thanks!

---Kayvan
-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory


Index: ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v
retrieving revision 1.226
diff -u -r1.226 ChangeLog
--- ChangeLog   2000/03/02 18:30:01 1.226
+++ ChangeLog   2000/03/05 09:08:38
@@ -1,3 +1,17 @@
+2000-03-05  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * lib/layouts/literate-scrap.inc: Fixed the Scrap layout to
+ include the AllowMultipleSpaces flag.
+
+2000-03-05  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * src/layout.C, src/layout.h: add the new paragraph
+ layout attribute "AllowMultipleSpaces". This essentially
+ disables the double-space cleanup code.
+
+   * Corresponding fixes to src/text.C and src/text2.C to implement
+ the AllowMultipleSpaces fix.
+
 2000-03-03  Juergen Vigna  <[EMAIL PROTECTED]>
 
* src/insets/insetert.C (InsetERT): Now ERT-insets break row
Index: lib/examples/Literate.lyx
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/examples/Literate.lyx,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Literate.lyx
--- lib/examples/Literate.lyx   1999/09/27 18:44:32 1.1.1.1
+++ lib/examples/Literate.lyx   2000/03/05 09:08:46
@@ -1,5 +1,4 @@
-#This file was created by  Tue Feb 23 22:25:52 1999
-#LyX 1.0 (C) 1995-1999 Matthias Ettrich and the LyX Team
+#LyX 1.1 created this file. For more info see http://www.lyx.org/
 \lyxformat 2.15
 \textclass literate-article
 \language default
@@ -43,7 +42,7 @@
 \layout Standard
 
 
-\begin_inset LatexCommand \tableofcontents
+\begin_inset LatexCommand \tableofcontents{}
 
 \end_inset 
 
@@ -70,12 +69,12 @@
 
 The filter is required to read from standard input, parse for error messages
  and copy the error messages to the standard output.
- During the output process, the filter must present the error messages in a
- format that LyX can interpret, currently, the LaTeX error message format.
- Of course, nothing will prevent future LyX releases from being able to read
- other formats as well (like gcc error messages for example).
- This mechanism is necessary to fully explore the literate programming
- tool's capabilities.
+ During the output process, the filter must present the error messages in
+ a format that LyX can interpret, currently, the LaTeX error message format.
+ Of course, nothing will prevent future LyX releases from being able to
+ read other formats as well (like gcc error messages for example).
+ This mechanism is necessary to fully explore the literate programming tool's
+ capabilities.
 \layout Section
 
 Algorithm
@@ -89,219 +88,51 @@
 \newline 
 {
 \newline 
-
-\protected_separator 
- if (argc == 2) {
+  if (argc == 2) {
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- switch (argv[1][0]) {
+switch (argv[1][0]) {
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- case 'n':
+case 'n':
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- <>
+  <>
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- break;
+  break;
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- case 'x':
+case 'x':
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- <>
+  <>
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- break;
+  break;
 \newline 
-
-\protected_separator 
-
-\protected_separator 
-
-\protected_separator 
- case 'a':

Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Kayvan A. Sylvan

> > In what way is this different from freespacing?
> 
> I assume you mean freespacing? 
> 
> It's supposed to do the same thing, but the freespacing hack does not work
> and I didn't find it till after I'd implemented mine. :-)

On second thought, don't check in my diffs.

I'm looking at and fixing your freespacing hack.

---Kayvan
-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Kayvan A. Sylvan

On Sun, Mar 05, 2000 at 06:10:36PM -0800, Kayvan A. Sylvan wrote:
> > In what way is this different from preespacing?
> 
> I assume you mean freespacing? 
> 
> It's supposed to do the same thing, but the freespacing hack does not work
> and I didn't find it till after I'd implemented mine. :-)

After shooting my mouth off before, now I have a correct fix. This one
basically does a few things right (as opposed to my previous fix):

1) It continues to work with old Literate Lyx files, thus making the updates
   to Literate.lyx and noweb2lyx.lyx unnecessary.

2) It fixes the already existing free_spacing feature instead of adding
   a redundant attribute.

3) Patch the input routine in lyxfunc.C so that the user's attempt to enter
   a protected-space while in a free_spacing layout is thwarted.

I don't really think that protected space (or any of the other special char
insets) make a whole lot of sense in the layouts that enable free_spacing.

Anyways, here is the patch. Check it over carefully.

-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory


Index: lib/layouts/literate-scrap.inc
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/literate-scrap.inc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 literate-scrap.inc
--- lib/layouts/literate-scrap.inc  1999/09/27 18:44:33 1.1.1.1
+++ lib/layouts/literate-scrap.inc  2000/03/06 11:32:54
@@ -2,8 +2,7 @@
 # Suggested style to write your code:
 # Within same scrap, lines are separated by new-lines (Ctrl-return), use:
 #  ItemSep   0.4
-# . disavantage: lyx doesn't allow space on first column, use proteced space
-#must type ctrl-return every single line
+# . disavantage: must type ctrl-return every single line
 # . advantage:   looks better (IMHO)
 #resembles more closelly the produced paper doc. (more WYSIWYG)
 #
Index: src/buffer.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.50
diff -u -r1.50 buffer.C
--- src/buffer.C2000/03/06 02:42:37 1.50
+++ src/buffer.C2000/03/06 11:33:04
@@ -911,11 +911,39 @@
par->SetFont(pos, font);
++pos;
} else if (token == "\\SpecialChar") {
-   inset = new InsetSpecialChar;
-   inset->Read(lex);
-   par->InsertChar(pos, LyXParagraph::META_INSET); 
-   par->InsertInset(pos, inset);
-   par->SetFont(pos, font);
+   LyXLayout const & layout =
+   textclasslist.Style(params.textclass, 
+   par->GetLayout());
+
+   // Insets don't make sense in a free-spacing context! ---Kayvan
+   if (layout.free_spacing)
+   {
+   if (lex.IsOK()) {
+   string next_token;
+   lex.next();
+   next_token = lex.GetString();
+   if (next_token == "\\-") {
+   par->InsertChar(pos, '-');
+   par->SetFont(pos, font);
+   } else if (next_token == "\\protected_separator") {
+   par->InsertChar(pos, ' ');
+   par->SetFont(pos, font);
+   } else {
+   lex.printError("Token `$$Token' "
+  "is in free space "
+  "paragraph layout!");
+   pos--;
+   }
+   }
+   }
+   else
+   {
+   inset = new InsetSpecialChar;
+   inset->Read(lex);
+   par->InsertChar(pos, LyXParagraph::META_INSET); 
+   par->InsertInset(pos, inset);
+   par->SetFont(pos, font);
+   }
++pos;
} else if (token == "\\Figure") {
inset = new InsetFig(100, 100, this);
@@ -943,10 +971,19 @@
++pos;
} else if (token == "\\protected_separator") { // obsolete
 #if 1
-   inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
-   par->InsertChar(pos, LyXParagraph::META_INSET);
-   par->InsertInset(pos, inset);
-   par->SetFont(pos, font);
+   LyXLayout con

Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Jean-Marc Lasgouttes

> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> After shooting my mouth off before, now I have a correct fix.
Kayvan> This one basically does a few things right (as opposed to my
Kayvan> previous fix):

Kayvan> 1) It continues to work with old Literate Lyx files, thus
Kayvan> making the updates to Literate.lyx and noweb2lyx.lyx
Kayvan> unnecessary.

Kayvan> 2) It fixes the already existing free_spacing feature instead
Kayvan> of adding a redundant attribute.

That's good.

Kayvan> 3) Patch the input routine in lyxfunc.C so that the user's
Kayvan> attempt to enter a protected-space while in a free_spacing
Kayvan> layout is thwarted.

And what if a normal paragraph containing a protected space is changed
to a freespaced paragraph? You'll have to handle those hard spaces
anyway... What would be the problem of having the inset output a
normal space in this case? After all the intelligence is supposed to
be inside the insets.

Kayvan> I don't really think that protected space (or any of the other
Kayvan> special char insets) make a whole lot of sense in the layouts
Kayvan> that enable free_spacing.

Yes, but we can't avoid having them there in some cases. 

JMarc



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Kayvan A. Sylvan

> 
> Kayvan> 3) Patch the input routine in lyxfunc.C so that the user's
> Kayvan> attempt to enter a protected-space while in a free_spacing
> Kayvan> layout is thwarted.
> 
> And what if a normal paragraph containing a protected space is changed
> to a freespaced paragraph?

Hmmm... Good point.

> You'll have to handle those hard spaces
> anyway... What would be the problem of having the inset output a
> normal space in this case? After all the intelligence is supposed to
> be inside the insets.

That would be perfect.

Does an inset have any access to its containing paragraph? If so, it would
be easy for the InsetSpecialChar::Latex to output a space in that case.

Note also that the way it is right now, the next time that the document
is loaded and parsed, the hard spaces get changed to normal spaces.

> Kayvan> I don't really think that protected space (or any of the other
> Kayvan> special char insets) make a whole lot of sense in the layouts
> Kayvan> that enable free_spacing.
> 
> Yes, but we can't avoid having them there in some cases. 

Very good point. Can you suggest the right way to get access to the
paragraph layout from inside the inset member functions?

-- 
Kayvan A. Sylvan   | Proud husband of  | Father to my kids:
Sylvan Associates, Inc.| Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-06 Thread Jean-Marc Lasgouttes

> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> Does an inset have any access to its containing paragraph? If
Kayvan> so, it would be easy for the InsetSpecialChar::Latex to output
Kayvan> a space in that case.

I guess Lars is the best person to answer this question. With the
recent changes wrt current_view, I do not know what an inset should do
when it needs to know who owns him (which paragraph, in this case).

JMarc



Re: lyx-1.1.5cvs bug: All protected spaces export as ~

2000-03-09 Thread Jean-Marc Lasgouttes

> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> Will more thatn the buffer parameters be needed then?

We may need info at the buffer level, but also at the paragraph level
(maybe the current layout is enough).

JMarc