* Bug 16191 fixed: now mode(0) and mode(1) are really compact. 93/21093/6
St├ęphane MOTTELET [Wed, 18 Sep 2019 17:18:03 +0000 (19:18 +0200)]
https://bugzilla.scilab.org/show_bug.cgi?id=16191

Change-Id: Ib69a6d17d2da00c64be28fa0ca79b6ba319c0efe

scilab/modules/ast/src/cpp/ast/run_AssignExp.hpp
scilab/modules/ast/src/cpp/ast/run_SeqExp.hpp
scilab/modules/ast/src/cpp/ast/runvisitor.cpp
scilab/modules/ast/src/cpp/types/tostring_common.cpp
scilab/modules/ast/src/cpp/types/types_tools.cpp

index c278e2d..b139878 100644 (file)
@@ -137,7 +137,11 @@ void RunVisitorT<T>::visitprivate(const AssignExp  &e)
             {
                 std::wstring wstrName = pVar->getSymbol().getName();
                 std::wostringstream ostr;
-                ostr << L" " << wstrName << L"  = " << std::endl << std::endl;
+                ostr << L" " << wstrName << L"  = " << std::endl;
+                if (ConfigVariable::isPrintCompact() == false)
+                {
+                    ostr << std::endl;                
+                }
                 scilabWriteW(ostr.str().c_str());
                 std::wostringstream ostrName;
                 ostrName << wstrName;
index 1af4664..b04f4bf 100644 (file)
@@ -191,7 +191,11 @@ void RunVisitorT<T>::visitprivate(const SeqExp  &e)
                     if ((*it)->isVerbose() && ConfigVariable::isPrintOutput())
                     {
                         //TODO manage multiple returns
-                        scilabWriteW(L" ans  =\n\n");
+                        scilabWriteW(L" ans  =\n");
+                        if (ConfigVariable::isPrintCompact() == false)
+                        {
+                            scilabWriteW(L"\n");
+                        }
                         std::wostringstream ostrName;
                         ostrName << L"ans";
                         VariableToString(pITAns, ostrName.str().c_str());
index 24ec1f7..dc7d63d 100644 (file)
@@ -126,7 +126,10 @@ void RunVisitorT<T>::visitprivate(const SimpleVar & e)
             ostr << L"(" << pI->getRef() << L")";
 #endif
             ostr << std::endl;
-            ostr << std::endl;
+            if (ConfigVariable::isPrintCompact() == false)
+            {
+                ostr << std::endl;                
+            }
             scilabWriteW(ostr.str().c_str());
             std::wostringstream ostrName;
             ostrName << e.getSymbol().getName();
index 38361d1..1084e74 100644 (file)
@@ -473,13 +473,21 @@ void configureStream(std::wostringstream * _postr, int _iWidth, int _iPrec, char
 
 void addColumnString(std::wostringstream& ostr, int _iFrom, int _iTo)
 {
+    if (ConfigVariable::isPrintCompact() == false)
+    {
+        ostr << std::endl;
+    }
     if (_iFrom == _iTo)
     {
-        ostr << std::endl << L"         column " << _iFrom << std::endl << std::endl;
+        ostr << L"         column " << _iFrom << std::endl;
     }
     else
     {
-        ostr << std::endl << L"         column " << _iFrom << L" to " << _iTo << std::endl << std::endl;
+        ostr << L"         column " << _iFrom << L" to " << _iTo << std::endl;
+    }
+    if (ConfigVariable::isPrintCompact() == false)
+    {
+        ostr << std::endl;
     }
 }
 
index 023cce5..c98fb9e 100644 (file)
@@ -988,11 +988,6 @@ types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wc
                 bFinish = linesmore() == 1;
             }
 
-            if (ConfigVariable::isPrintCompact() == false && ConfigVariable::isPrintInput() == false)
-            {
-                ostr << std::endl;
-            }
-
             scilabForcedWriteW(ostr.str().c_str());
             ostr.str(L"");
         }