microsoft / calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows
MIT License
29.74k stars 5.39k forks source link

Function won't Show after Pressing Enter if IME is Open in Graphing Mode #1433

Open xuhongxu96 opened 4 years ago

xuhongxu96 commented 4 years ago

Describe the bug

Function won't show after pressing Enter if IME is open in Graphing Mode. Also, some strange expressions may be filled in next editbox.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Go to Graphing Mode
  2. Enable the IME (I'm using Chinese IME)
  3. Input an expression and press Enter
  4. Nothing will show on graph
  5. Input more expressions, and sometimes strange expressions are auto filled in next editbox after pressing Enter
  6. Still not works if go back to previous editbox and hit Enter again even with IME disabled.

Expected behavior

Screenshots

I never input the 4th function x+3 and 5th function x but they're filled in next editbox automatically.

1

Device and Application Information

Requested Assignment

I'm just reporting this problem. I don't want to fix it for now.

MicrosoftIssueBot commented 4 years ago

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.

tian-lt commented 3 years ago

It looks like ITextDocument4::GetMath() method fetched a null result when user types letters with IME.

String ^ MathRichEditBox::GetMathTextProperty()
{
    // TODO when Windows 10 version 2004 SDK is adopted, replace with:
    // String ^ text;
    // this->TextDocument->GetMath(&text);
    // return text;

    ComPtr<Windows_2004_Prerelease::ITextDocument4> textDocument4;
    reinterpret_cast<IInspectable*>(this->TextDocument)->QueryInterface(IID_PPV_ARGS(&textDocument4));
    HSTRING math;
    auto hr = textDocument4->GetMath(&math);  <------------- Line 89 in file MathRichEditBox.cpp
    if (FAILED(hr))
    {
        throw Exception::CreateException(hr);
    }
    return reinterpret_cast<String ^>(math);
}

An interesting thing is if you try to type numbers before letters while enabling IME, the RichEditBox control can handle it properly. calculator_issue1433_comment1

rohitkrsoni commented 6 months ago

Hi, I would like to investigate and work on this issue. Can I get this issue assigned and a bit of help on where to start, thanks