Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

#1575 "An invalid argument was encountered" error message

Trunk
closed-fixed
GUI (515)
5
2007-11-06
2007-10-26
No

Version: WinMerge 2.7.5.3

Please merge the attached files and scroll all the way down.
You will encounter the "An invalid argument was encountered" error message.

Tomer

Discussion

  • Tomer Shalev

    Tomer Shalev - 2007-10-26

    Input files which produces the error

     
  • Kimmo Varis

    Kimmo Varis - 2007-10-26
    • milestone: --> Trunk
     
  • Kimmo Varis

    Kimmo Varis - 2007-10-26

    Logged In: YES
    user_id=631874
    Originator: NO

    Unfortunately with my settings, I cannot see any messages. Can you attach your configuration log (from menu Help/Configuration...) as a file, so I can try same settings?

     
  • Tomer Shalev

    Tomer Shalev - 2007-10-26

    My settings

     
  • Tomer Shalev

    Tomer Shalev - 2007-10-26

    Logged In: YES
    user_id=298505
    Originator: YES

    OK. Attached my settings.
    I have Windows XP with Hebrew interface.
    File Added: WinMerge.txt

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    I can reproduce a similar bug.

    To reproduce:

    ------------------------
    1. Compare attached files.

    2. Check [View]/[Wrap Lines] menu item if the menu item is not checked.

    3. Press Ctrl+End.

    4. Press PgUp.
    ------------------------

    I noticed that the line "m_ptCursorPos.y = m_nTopSubLine" in CCrystalTextView::MovePgUp() is incorrect.
    Because m_ptCursorPos.y is not sublineindex but lineindex. (m_nTopLine rather than m_nTopSubLine)
    And the m_ptCursorPos.y is calculated near the line.
    So I think that the line "m_ptCursorPos.y = m_nTopSubLine" should be deleted.

    I also noticed that the cursor position is always top of the screen whenever pressing PgUp.
    I would like to keep the relative position of the cursor constant as much as possible.

    Here is the fix:

    Index: ccrystaltextview2.cpp

    --- ccrystaltextview2.cpp (revision 4664)
    +++ ccrystaltextview2.cpp (working copy)
    @@ -380,13 +380,12 @@
    ScrollToSubLine(nNewTopSubLine);
    UpdateSiblingScrollPos(FALSE);
    }
    - m_ptCursorPos.y = m_nTopSubLine;

    // setting cursor
    CPoint subLinePos;
    CharPosToPoint( m_ptCursorPos.y, m_ptCursorPos.x, subLinePos );

    - int nSubLine = GetSubLineIndex( m_ptCursorPos.y ) + subLinePos.y;
    + int nSubLine = GetSubLineIndex( m_ptCursorPos.y ) + subLinePos.y - GetScreenLines() + 1;

    if ( nSubLine < 0 )
    nSubLine = 0;
    @@ -418,7 +417,6 @@
    int nDummy;
    int nNewTopLine;
    GetLineBySubLine(nNewTopSubLine, nNewTopLine, nDummy);
    - m_ptCursorPos.y = nNewTopLine;
    ScrollToSubLine(nNewTopSubLine);
    UpdateSiblingScrollPos(FALSE);
    }

     
  • Kimmo Varis

    Kimmo Varis - 2007-11-05

    Logged In: YES
    user_id=631874
    Originator: NO

    Your description sounds good, but I'm a bit worried about the patch. Can you make sure you don't reintroduce bug:
    BUG: [ 1795680 ] MergeEditView: PgUp key behaves odd near beginning of file
    which I fixed in revision 4550, and probably caused the PgUp key behavior bug in middle of files.

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    I've tested it. It seems that this patch doesn't cause the bug.

     
  • Kimmo Varis

    Kimmo Varis - 2007-11-06

    Logged In: YES
    user_id=631874
    Originator: NO

    Thanks for testing it. Please apply the patch.

     
  • Kimmo Varis

    Kimmo Varis - 2007-11-06
    • assigned_to: nobody --> sdottaka
     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    Oops! I remembered about the following bug and my patch reintroduces the bug.

    [BUG: [ 1403536 ] scrollwheel and pageup/down not continuous]
    http://sourceforge.net/tracker/index.php?func=detail&aid=1403536&group_id=13216&atid=113216

    I've already committed the fix to SVN trunk as revision 4714.

    The fix works fine on my machine. But could you confirm it?

    Here is the patch that I committed:

    Index: ccrystaltextview2.cpp

    --- ccrystaltextview2.cpp (revision 4713)
    +++ ccrystaltextview2.cpp (working copy)
    @@ -374,20 +374,19 @@
    nNewTopSubLine = 0;
    if (m_nTopSubLine != nNewTopSubLine)
    {
    - int nDummy;
    - int nNewTopLine;
    - GetLineBySubLine(nNewTopSubLine, nNewTopLine, nDummy);
    ScrollToSubLine(nNewTopSubLine);
    UpdateSiblingScrollPos(FALSE);
    }
    - m_ptCursorPos.y = m_nTopSubLine;

    // setting cursor
    CPoint subLinePos;
    CharPosToPoint( m_ptCursorPos.y, m_ptCursorPos.x, subLinePos );

    - int nSubLine = GetSubLineIndex( m_ptCursorPos.y ) + subLinePos.y;
    + int nSubLine = GetSubLineIndex( m_ptCursorPos.y ) + subLinePos.y - GetScreenLines() + 1;

    + if (nSubLine < nNewTopSubLine || nSubLine >= nNewTopSubLine + GetScreenLines())
    + nSubLine = nNewTopSubLine;
    +
    if ( nSubLine < 0 )
    nSubLine = 0;

    @@ -415,10 +414,6 @@
    nNewTopSubLine = nSubLineCount - 1;
    if (m_nTopSubLine != nNewTopSubLine)
    {
    - int nDummy;
    - int nNewTopLine;
    - GetLineBySubLine(nNewTopSubLine, nNewTopLine, nDummy);
    - m_ptCursorPos.y = nNewTopLine;
    ScrollToSubLine(nNewTopSubLine);
    UpdateSiblingScrollPos(FALSE);
    }
    @@ -429,6 +424,9 @@

    int nSubLine = GetSubLineIndex\( m\_ptCursorPos.y \) + subLinePos.y + GetScreenLines\(\) - 1;
    

    + if (nSubLine < nNewTopSubLine || nSubLine >= nNewTopSubLine + GetScreenLines())
    + nSubLine = nNewTopSubLine + GetScreenLines() - 1;
    +
    if( nSubLine > nSubLineCount - 1 )
    nSubLine = nSubLineCount - 1;

     
  • Kimmo Varis

    Kimmo Varis - 2007-11-06

    Logged In: YES
    user_id=631874
    Originator: NO

    Your patch works for me too.

     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: NO

    Thank you for confirming!

     
  • Takashi Sawanaka

    • status: open --> closed-fixed
     

Log in to post a comment.