Opened 8 years ago

Last modified 8 years ago

#4110 closed defect

OMEdit introduces wrong newline if annotation starts on new line — at Version 2

Reported by: Rüdiger Franke Owned by: Martin Sjölund
Priority: high Milestone: 1.9.x
Component: Interactive Environment Version:
Keywords: Cc:

Description (last modified by Rüdiger Franke)

Many models place the annotation of a component declaration on a new line. OMEdit will introduce an additional newline between the component name and the modifiers.

See the following example. Open the parameter dialog for IconWithValues.Test.component1, change the value of x and press OK.

package IconWithValues
  model Test
    Component component1(x = 5)
      annotation(Placement(visible = true,
        transformation(origin = {0, 0}, extent = {{-45, -45}, {45, 45}})));
  end Test;
  model Component
    parameter Real x;
    Real y = sin(x);
    Boolean neg = y < 0;
    Boolean pos = not neg;
    annotation(Icon(graphics = {
      Rectangle(origin = {0, 0}, extent = {{-95, 95}, {95, -95}},
        visible = DynamicSelect(false, neg)),
      Text(origin = {-55, 35}, extent = {{-35, 15}, {50, -30}},
        textString = "x = "),
      Text(origin = {-55, 35}, extent = {{50, 15}, {150, -30}},
        textString = DynamicSelect("x", String(x))),
      Text(origin = {-55, -30}, extent = {{-35, 15}, {150, -30}},
        textString = DynamicSelect("%y",  String(y, significantDigits = 3)),
        visible = DynamicSelect(true, pos)),
      Text(origin = {-55, -30}, extent = {{-35, 15}, {150, -30}},
        textString = DynamicSelect("%y",  String(y, significantDigits = 3)),
        visible = DynamicSelect(false, neg), lineColor = {255, 0, 0})},
      coordinateSystem(initialScale = 0.1)));
  end Component;
end IconWithValues;

This will result in the following model text with wrong newline before the modifier:

model Test
  Component component1
(x = 6)      annotation(Placement(visible = true, ...);
end Test;

Change History (2)

comment:1 by Adeel Asghar, 8 years ago

Component: OMEditInteractive Environment
Owner: changed from Adeel Asghar to Martin Sjölund
Status: newassigned

comment:2 by Rüdiger Franke, 8 years ago

Description: modified (diff)
Summary: OMEdit introduces additional newline if annotation starts on new lineOMEdit introduces wrong newline if annotation starts on new line
Note: See TracTickets for help on using tickets.