Menu

#90 'Add manual diff alignment' scrolls to the first block

v1.0_(example)
open
nobody
5
2012-09-23
2008-01-24
Timbojones
No

Repro steps:

1) Open a two-file diff
2) Select some text in A
3) Ctrl-Y
4) Select some text in B
5) Ctrl-Y
6) Scroll down
7) Select some text in A
8) Ctrl-Y

Expected result:
Vertical scrollbar stays where it is, or moves the new alignment block to the top of the view.

Actual result:
Vertical scrollbar moves the first alignment block to the top of the view. Depending on file length, the new alignment block may be far far away, and difficult to find.

Discussion

  • Timbojones

    Timbojones - 2008-01-24

    Logged In: YES
    user_id=1889288
    Originator: YES

    Also:
    The horizontal scroll position gets reset to 0. I expect it to stay at the position I scrolled to.

    These issues make it difficult to diff e.g. a verbose directory listing where files have been added.

     
  • Wesley J. Landaker

    Here is a quick hack I did on my own copy because this was so incredibly annoying. This isn't perfect, but it's the right idea:

    === modified file 'src-QT4/pdiff.cpp'
    --- src-QT4/pdiff.cpp 2009-03-03 22:39:13 +0000
    +++ src-QT4/pdiff.cpp 2009-03-03 22:46:27 +0000
    @@ -2241,10 +2241,14 @@
    m_manualDiffHelpList.push_back( mdhe );
    */

    • int saved_vscroll_value = m_pDiffVScrollBar->value();
      +
      insertManualDiffHelp( &m_manualDiffHelpList, winIdx, firstLine, lastLine );

      init( false, 0, false ); // Init without reload
      slotRefresh();
      +
      + m_pDiffVScrollBar->setValue(saved_vscroll_value);
      }
      }