]> git.lyx.org Git - lyx.git/commitdiff
Fix wrong parsing of \framebox[3in][s]{...}
authorGeorg Baum <baum@lyx.org>
Sat, 6 Oct 2012 13:23:36 +0000 (15:23 +0200)
committerGeorg Baum <baum@lyx.org>
Sat, 6 Oct 2012 13:23:36 +0000 (15:23 +0200)
s is a valid horizontal position for framebox (as well as for makebox, which
was already parsed correctly). There was even a test case, but with a wrong
reference.

src/tex2lyx/test/test.lyx.lyx
src/tex2lyx/text.cpp

index a0ddb99cb487c052ec1132fb3b7be918e8f6c6bc..81b5ee0b483b7ae229bc5006b8cefffa63b85cac 100644 (file)
@@ -131,7 +131,7 @@ status collapsed
 
 \begin_inset Box Boxed
 position "c"
-hor_pos "c"
+hor_pos "s"
 has_inner_box 0
 inner_pos "c"
 use_parbox 0
index 71379fdee3f2b191c93ebe84f37923f3013dc4cd..7f7603c198b244057a8495edc381fd763e47db23 100644 (file)
@@ -814,8 +814,18 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                        if (inner_type != "makebox") {
                                latex_height = p.getArg('[', ']');
                                translate_box_len(latex_height, height_value, height_unit, height_special);
-                       } else
-                               hor_pos = p.getArg('[', ']');
+                       } else {
+                               string const opt = p.getArg('[', ']');
+                               if (!opt.empty()) {
+                                       hor_pos = opt;
+                                       if (hor_pos != "l" && hor_pos != "c" &&
+                                           hor_pos != "r" && hor_pos != "s") {
+                                               cerr << "invalid hor_pos " << hor_pos
+                                                    << " for " << inner_type << endl;
+                                               hor_pos = "c";
+                                       }
+                               }
+                       }
 
                        if (p.hasOpt()) {
                                inner_pos = p.getArg('[', ']');
@@ -839,7 +849,7 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                        if (!opt.empty()) {
                                hor_pos = opt;
                                if (hor_pos != "l" && hor_pos != "c" &&
-                                   hor_pos != "r") {
+                                   hor_pos != "r" && hor_pos != "s") {
                                        cerr << "invalid hor_pos " << hor_pos
                                             << " for " << outer_type << endl;
                                        hor_pos = "c";