Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CellML Text view: improve Unicode support #1926

Closed
agarny opened this issue Dec 19, 2018 · 0 comments
Closed

CellML Text view: improve Unicode support #1926

agarny opened this issue Dec 19, 2018 · 0 comments
Assignees
Milestone

Comments

@agarny
Copy link
Contributor

agarny commented Dec 19, 2018

Whenever the position of the editor's caret changes (e.g. when editing a CellML file), we extract the statement that corresponds to an equation, so we can render it. However, there are cases where we might be editing a comment that is just before an equation, and which will return the wrong statement (because of the way the comment is being edited):

untitled

There are also cases where things will go wrong if we have certain Unicode characters. For example, say that we have the following CellML file:

def model my_model as
    def unit ms as
        unit second {pref: milli};
    enddef;

    // フランス人

    def unit mV as
        unit volt {pref: milli};
    enddef;

    def unit mV_per_ms as
        unit mV {expo: 1};
        unit ms {expo: -1};
    enddef;

    def comp main as
        var time: ms;
        var v: mV {init: 1};

        // dv/dt = 1
        // v(0) = 1

        ode(v, time) = 1{mV_per_ms};
    enddef;
enddef;

フランス人 will render our update viewer completely wrong (because of those characters taking 3 bytes rather than 1). Then, we also have to be careful about some Unicode characters being used in our partial statement. For example, if we were to copy/paste フランス人 in the dv/dt comment, then this would mess up or check in CellmlTextViewWidget::statement().

@agarny agarny added this to the 0.7 milestone Dec 19, 2018
@agarny agarny self-assigned this Dec 19, 2018
agarny added a commit to agarny/opencor that referenced this issue Dec 20, 2018
agarny added a commit to agarny/opencor that referenced this issue Dec 20, 2018
@agarny agarny changed the title CellML Text view: the wrong statement may be retrieved when editing a comment CellML Text view: the viewer doesn't get updated properly in some cases Dec 20, 2018
@agarny agarny changed the title CellML Text view: the viewer doesn't get updated properly in some cases CellML Text view: improve Unicode support Dec 20, 2018
agarny added a commit to agarny/opencor that referenced this issue Dec 21, 2018
@agarny agarny closed this as completed in 3ca47ac Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant