On Wed, Oct 24, 2007 at 12:51:00AM +0200, Dov Feldstern wrote:
> Martin Vermeer wrote:
> >On Mon, 22 Oct 2007 23:33:32 +0200
> >Dov Feldstern <[EMAIL PROTECTED]> wrote:
> >
> >>This thread is about a separate problem, which is due to Martin's change 
> >>in r21121. I have described above what the problem is, and provided a 
> >>sample file with both the incorrect output, and correct output (after 
> >>reverting the change).
> >>
> >>This problem still exists as of latest trunk (r21127) --- it's a totally 
> >>separate issue from Abdel's changes.
> >>
> >>Dov
> >
> >
> >Thanks Dov... attached a patch that produces the proper LaTeX code for
> >your test file (though I cannot compile it, not having Hebrew fonts
> >installed). Please test it with this and other docs.
> >
> 
> Martin, this (together with the encoding, as done in r21153) fixes the 
> problems I was having, thanks!
> 
> However, I'm still not sure this is really what we want to be doing: 
> should verbatim really mean that we want the contents to be output to 
> *LaTeX* verbatim? Or should it mean that we want the contents to be 
> output in a \verbatim (or \verbatim-like) environment, to allow multiple 
> spaces or special characters, for example? These are two different 
> things, and I think that what we really want as a generalized 
> environment is the latter behavior, not the former. r21153 goes a little 
> more in the direction of the former. However, is there any other place 
> besides CERT where that kind of verbatim is really needed?

ERT should produce literal LaTeX output. Including multiple blanks,
including true newlines. As for URL (the only other verbatim-type inset
atm), I'm not even sure we want single blanks... this is a bit up in
the air still for me.
 
> I see that it's used in the URL custom inset. However, there are some 
> problems with this inset, I find: for example, you can't type two 
> consecutive spaces in this inset (in true verbatim I think you should be 
> able to, in ERT you are); secondly, try to mark some of the text of the 
> url as emph (using plain ctrl-e, not a charstyle), or insert a footnote 
> within the url (or change the language, which is how I discovered this 
> problem in the first place). Is the result what the user expects? I 
> don't think so. And it's certainly not what he sees on the screen... One 
> possible solution might be to disable most LFUNs inside a "verbatim" 
> inset, similarly to how it's done in ERT --- but how do you know exactly 
> which LFUNs to disable? For example, in the Listings inset (which has 
> many of its own problems),  we *do* want to allow the insertion of a 
> caption, but not other kinds of insets. Maybe "verbatim" is just not the 
> kind of thing which should be happening at the layout level, but rather 
> in the actual code...? Maybe there should be a InsetVerbatim class which 
> gives the basic verbatim behavior, and then insets can override it at will.

Hmmm. Yes, this is easy. I moved over the disabling code and made it
generic for verbatim insets. See attached.

About InsetVerbatim, effectively this is what we have: it's Collapsable
with the insetlayout stuff added. ERT overrides this.

> But anyhow, IMO both r21153 and r21121 should be reverted. I think it's 
> best that we leave ERT out of this, at least for now. I don't really see 
> what we gain by making it use the "verbatim" layout --- the code being 
> replaced in r21121 is well encapsulated, I don't think that making it 
> use a more general mechanism gives us anything. And besides, ERT is a 
> very special case, and I think that involving it in something more 
> generalized is just asking for trouble...

Well, yes. But the code simplification is worth it I think. Fact of the
matter is that this part of the code is so complex now that _any_ change
will produce surprises. Not good. I am happy that Abdel is looking into
this.
 
> Beyond that, it seems like the "verbatim" layout itself --- or its use 
> in custom insets --- requires more thought and/or work. Perhaps 
> collecting a few examples of where it would be useful (URL, Listings, 
> ...) can help figuring out how it should work...

Haven't looked at Listings yet... should I?

> >I _hope_ the encoding problem was the only one remaining... can you say
> >'spaghetti'?
> It wasn't so bad in the end, was it? ;)

I circumvented the spaghetti rather than addressing it ;-/ "Not good"
again. This is often what happens: a new layer of code is piled on top,
and the "wart" gets encapsulated.

- Martin

Index: InsetERT.cpp
===================================================================
--- InsetERT.cpp	(revision 21141)
+++ InsetERT.cpp	(working copy)
@@ -251,101 +251,6 @@
 	FuncStatus & status) const
 {
 	switch (cmd.action) {
-		// suppress these
-		case LFUN_ACCENT_ACUTE:
-		case LFUN_ACCENT_BREVE:
-		case LFUN_ACCENT_CARON:
-		case LFUN_ACCENT_CEDILLA:
-		case LFUN_ACCENT_CIRCLE:
-		case LFUN_ACCENT_CIRCUMFLEX:
-		case LFUN_ACCENT_DOT:
-		case LFUN_ACCENT_GRAVE:
-		case LFUN_ACCENT_HUNGARIAN_UMLAUT:
-		case LFUN_ACCENT_MACRON:
-		case LFUN_ACCENT_OGONEK:
-		case LFUN_ACCENT_SPECIAL_CARON:
-		case LFUN_ACCENT_TIE:
-		case LFUN_ACCENT_TILDE:
-		case LFUN_ACCENT_UMLAUT:
-		case LFUN_ACCENT_UNDERBAR:
-		case LFUN_ACCENT_UNDERDOT:
-		case LFUN_APPENDIX:
-		case LFUN_BIBITEM_INSERT:
-		case LFUN_BOX_INSERT:
-		case LFUN_BRANCH_INSERT:
-		case LFUN_BREAK_LINE:
-		case LFUN_CAPTION_INSERT:
-		case LFUN_CLEARPAGE_INSERT:
-		case LFUN_CLEARDOUBLEPAGE_INSERT:
-		case LFUN_DEPTH_DECREMENT:
-		case LFUN_DEPTH_INCREMENT:
-		case LFUN_DOTS_INSERT:
-		case LFUN_END_OF_SENTENCE_PERIOD_INSERT:
-		case LFUN_ENVIRONMENT_INSERT:
-		case LFUN_ERT_INSERT:
-		case LFUN_FILE_INSERT:
-		case LFUN_FLEX_INSERT:
-		case LFUN_FLOAT_INSERT:
-		case LFUN_FLOAT_LIST:
-		case LFUN_FLOAT_WIDE_INSERT:
-		case LFUN_FONT_BOLD:
-		case LFUN_FONT_TYPEWRITER:
-		case LFUN_FONT_DEFAULT:
-		case LFUN_FONT_EMPH:
-		case LFUN_FONT_FREE_APPLY:
-		case LFUN_FONT_FREE_UPDATE:
-		case LFUN_FONT_NOUN:
-		case LFUN_FONT_ROMAN:
-		case LFUN_FONT_SANS:
-		case LFUN_FONT_FRAK:
-		case LFUN_FONT_ITAL:
-		case LFUN_FONT_SIZE:
-		case LFUN_FONT_STATE:
-		case LFUN_FONT_UNDERLINE:
-		case LFUN_FOOTNOTE_INSERT:
-		case LFUN_HFILL_INSERT:
-		case LFUN_HYPERLINK_INSERT:
-		case LFUN_HYPHENATION_POINT_INSERT:
-		case LFUN_INDEX_INSERT:
-		case LFUN_INDEX_PRINT:
-		case LFUN_INSET_INSERT:
-		case LFUN_LABEL_GOTO:
-		case LFUN_LABEL_INSERT:
-		case LFUN_LIGATURE_BREAK_INSERT:
-		case LFUN_LINE_INSERT:
-		case LFUN_PAGEBREAK_INSERT:
-		case LFUN_LANGUAGE:
-		case LFUN_LAYOUT:
-		case LFUN_LAYOUT_PARAGRAPH:
-		case LFUN_LAYOUT_TABULAR:
-		case LFUN_MARGINALNOTE_INSERT:
-		case LFUN_MATH_DISPLAY:
-		case LFUN_MATH_INSERT:
-		case LFUN_MATH_MATRIX:
-		case LFUN_MATH_MODE:
-		case LFUN_MENU_OPEN:
-		case LFUN_MENU_SEPARATOR_INSERT:
-		case LFUN_NOACTION:
-		case LFUN_NOMENCL_INSERT:
-		case LFUN_NOMENCL_PRINT:
-		case LFUN_NOTE_INSERT:
-		case LFUN_NOTE_NEXT:
-		case LFUN_OPTIONAL_INSERT:
-		case LFUN_PARAGRAPH_PARAMS:
-		case LFUN_PARAGRAPH_PARAMS_APPLY:
-		case LFUN_PARAGRAPH_SPACING:
-		case LFUN_PARAGRAPH_UPDATE:
-		case LFUN_REFERENCE_NEXT:
-		case LFUN_SERVER_GOTO_FILE_ROW:
-		case LFUN_SERVER_NOTIFY:
-		case LFUN_SERVER_SET_XY:
-		case LFUN_SPACE_INSERT:
-		case LFUN_TABULAR_INSERT:
-		case LFUN_TOC_INSERT:
-		case LFUN_WRAP_INSERT:
-			status.enabled(false);
-			return true;
-
 		case LFUN_CLIPBOARD_PASTE:
 		case LFUN_INSET_MODIFY:
 		case LFUN_PASTE:
Index: InsetCollapsable.cpp
===================================================================
--- InsetCollapsable.cpp	(revision 21141)
+++ InsetCollapsable.cpp	(working copy)
@@ -556,6 +556,103 @@
 		FuncStatus & flag) const
 {
 	switch (cmd.action) {
+		// suppress these
+		case LFUN_ACCENT_ACUTE:
+		case LFUN_ACCENT_BREVE:
+		case LFUN_ACCENT_CARON:
+		case LFUN_ACCENT_CEDILLA:
+		case LFUN_ACCENT_CIRCLE:
+		case LFUN_ACCENT_CIRCUMFLEX:
+		case LFUN_ACCENT_DOT:
+		case LFUN_ACCENT_GRAVE:
+		case LFUN_ACCENT_HUNGARIAN_UMLAUT:
+		case LFUN_ACCENT_MACRON:
+		case LFUN_ACCENT_OGONEK:
+		case LFUN_ACCENT_SPECIAL_CARON:
+		case LFUN_ACCENT_TIE:
+		case LFUN_ACCENT_TILDE:
+		case LFUN_ACCENT_UMLAUT:
+		case LFUN_ACCENT_UNDERBAR:
+		case LFUN_ACCENT_UNDERDOT:
+		case LFUN_APPENDIX:
+		case LFUN_BIBITEM_INSERT:
+		case LFUN_BOX_INSERT:
+		case LFUN_BRANCH_INSERT:
+		case LFUN_BREAK_LINE:
+		case LFUN_CAPTION_INSERT:
+		case LFUN_CLEARPAGE_INSERT:
+		case LFUN_CLEARDOUBLEPAGE_INSERT:
+		case LFUN_DEPTH_DECREMENT:
+		case LFUN_DEPTH_INCREMENT:
+		case LFUN_DOTS_INSERT:
+		case LFUN_END_OF_SENTENCE_PERIOD_INSERT:
+		case LFUN_ENVIRONMENT_INSERT:
+		case LFUN_ERT_INSERT:
+		case LFUN_FILE_INSERT:
+		case LFUN_FLEX_INSERT:
+		case LFUN_FLOAT_INSERT:
+		case LFUN_FLOAT_LIST:
+		case LFUN_FLOAT_WIDE_INSERT:
+		case LFUN_FONT_BOLD:
+		case LFUN_FONT_TYPEWRITER:
+		case LFUN_FONT_DEFAULT:
+		case LFUN_FONT_EMPH:
+		case LFUN_FONT_FREE_APPLY:
+		case LFUN_FONT_FREE_UPDATE:
+		case LFUN_FONT_NOUN:
+		case LFUN_FONT_ROMAN:
+		case LFUN_FONT_SANS:
+		case LFUN_FONT_FRAK:
+		case LFUN_FONT_ITAL:
+		case LFUN_FONT_SIZE:
+		case LFUN_FONT_STATE:
+		case LFUN_FONT_UNDERLINE:
+		case LFUN_FOOTNOTE_INSERT:
+		case LFUN_HFILL_INSERT:
+		case LFUN_HYPERLINK_INSERT:
+		case LFUN_HYPHENATION_POINT_INSERT:
+		case LFUN_INDEX_INSERT:
+		case LFUN_INDEX_PRINT:
+		case LFUN_INSET_INSERT:
+		case LFUN_LABEL_GOTO:
+		case LFUN_LABEL_INSERT:
+		case LFUN_LIGATURE_BREAK_INSERT:
+		case LFUN_LINE_INSERT:
+		case LFUN_PAGEBREAK_INSERT:
+		case LFUN_LANGUAGE:
+		case LFUN_LAYOUT:
+		case LFUN_LAYOUT_PARAGRAPH:
+		case LFUN_LAYOUT_TABULAR:
+		case LFUN_MARGINALNOTE_INSERT:
+		case LFUN_MATH_DISPLAY:
+		case LFUN_MATH_INSERT:
+		case LFUN_MATH_MATRIX:
+		case LFUN_MATH_MODE:
+		case LFUN_MENU_OPEN:
+		case LFUN_MENU_SEPARATOR_INSERT:
+		case LFUN_NOACTION:
+		case LFUN_NOMENCL_INSERT:
+		case LFUN_NOMENCL_PRINT:
+		case LFUN_NOTE_INSERT:
+		case LFUN_NOTE_NEXT:
+		case LFUN_OPTIONAL_INSERT:
+		case LFUN_PARAGRAPH_PARAMS:
+		case LFUN_PARAGRAPH_PARAMS_APPLY:
+		case LFUN_PARAGRAPH_SPACING:
+		case LFUN_PARAGRAPH_UPDATE:
+		case LFUN_REFERENCE_NEXT:
+		case LFUN_SERVER_GOTO_FILE_ROW:
+		case LFUN_SERVER_NOTIFY:
+		case LFUN_SERVER_SET_XY:
+		case LFUN_SPACE_INSERT:
+		case LFUN_TABULAR_INSERT:
+		case LFUN_TOC_INSERT:
+		case LFUN_WRAP_INSERT:
+		if (layout_.verbatim) {
+			flag.enabled(false);
+			return true;
+		} else
+			return InsetText::getStatus(cur, cmd, flag);
 
 	case LFUN_INSET_TOGGLE:
 		if (cmd.argument() == "open" || cmd.argument() == "close" ||

Reply via email to