notepad2 컴파일 삽질기 5 : 스크롤 시 캐럿 출력 버그 수정

가급적 notepad2 3.x의 수정은 그만할 생각이었지만, 버그라서 수정했다. ㅠ.ㅠ


이 패치는 엄밀히는 삽질기 2 : IME 메시지를 처리하도록 수정과 함께 적용되어야 한다.
패치를 적용한 뒤에 notepad2를 사용해보면 스크롤 시에 캐럿이 늦게 반응하며, 잠깐씩 엉뚱한 위치게 가는 현상이 있다.
패치를 적용하게 되면 커서를 자체적으로 그리는데, 이게 스크롤 시에 좀 늦게 반응하기 때문이다.

수정 대상 파일은 ScintillaWin.cxx 하나이다.

void ScintillaWin::ScrollText(int linesToMove) 함수를 찾는다.
이 함수는 아래와 같은 내용이다.

void ScintillaWin::ScrollText(int linesToMove) {
    //Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove);
    ::ScrollWindow(MainHWND(), 0,
        vs.lineHeight * linesToMove, 0, 0);
    ::UpdateWindow(MainHWND());
}

이것을 아래와 같이 수정한다.
캐럿을 삭제했다 다시 그리는 두 줄이 추가된 것이다.

void ScintillaWin::ScrollText(int linesToMove) {
    //Platform::DebugPrintf("ScintillaWin::ScrollText %d\n", linesToMove);
    DestroySystemCaret();
    ::ScrollWindow(MainHWND(), 0,
        vs.lineHeight * linesToMove, 0, 0);
    ::UpdateWindow(MainHWND());
    CreateSystemCaret();
}

잘 쓰기 바란다.

덧. 수정을 강요(?)하신 구차니 님께 감사드립니다. ^^;