From 07edcecaf706338c886bd6de3ce95f02cf265cf0 Mon Sep 17 00:00:00 2001 From: Eran Ifrah Date: Wed, 11 Jan 2023 23:18:07 +0200 Subject: [PATCH] fixed: git commit list dialog: clicking DOWN/UP arrows jumps two rows at a time --- Plugin/clScrolledPanel.cpp | 9 +++++++++ git/gitCommitListDlg.cpp | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Plugin/clScrolledPanel.cpp b/Plugin/clScrolledPanel.cpp index 4098f87505..e0d9697dc6 100644 --- a/Plugin/clScrolledPanel.cpp +++ b/Plugin/clScrolledPanel.cpp @@ -252,11 +252,14 @@ void clScrolledPanel::OnCharHook(wxKeyEvent& event) wxKeyEvent keyDown = event; keyDown.SetEventType(wxEVT_KEY_DOWN); if(DoKeyDown(keyDown)) { + // event was handled. Stop processing it + event.Skip(false); return; } // Always process the HOME/END buttons // The following can be processed only once + event.Skip(false); if(event.GetEventObject() == this) { if(event.GetKeyCode() == WXK_HOME) { ScrollRows(0, wxUP); @@ -270,7 +273,13 @@ void clScrolledPanel::OnCharHook(wxKeyEvent& event) ScrollRows(GetPageSize(), wxUP); } else if(event.GetKeyCode() == WXK_PAGEDOWN) { ScrollRows(GetPageSize(), wxDOWN); + } else { + // propogate the event (i.e. we did not handle it here) + event.Skip(); } + } else { + // propogate the event (i.e. we did not handle it here) + event.Skip(); } } diff --git a/git/gitCommitListDlg.cpp b/git/gitCommitListDlg.cpp index 27615a0e7c..6b03ee24a5 100644 --- a/git/gitCommitListDlg.cpp +++ b/git/gitCommitListDlg.cpp @@ -50,7 +50,7 @@ GitCommitListDlg::GitCommitListDlg(wxWindow* parent, const wxString& workingDir, { Bind(wxEVT_ASYNC_PROCESS_OUTPUT, &GitCommitListDlg::OnProcessOutput, this); Bind(wxEVT_ASYNC_PROCESS_TERMINATED, &GitCommitListDlg::OnProcessTerminated, this); - Bind(wxEVT_CHAR_HOOK, &GitCommitListDlg::OnCharHook, this); + // Bind(wxEVT_CHAR_HOOK, &GitCommitListDlg::OnCharHook, this); LexerConf::Ptr_t lex = EditorConfigST::Get()->GetLexer("diff"); if(lex) { @@ -182,10 +182,13 @@ void GitCommitListDlg::DoLoadCommits(const wxString& filter) // hash @ subject @ author-name @ date wxArrayString gitList = wxStringTokenize(m_commitList, wxT("\n"), wxTOKEN_STRTOK); wxArrayString filters = wxStringTokenize(filter, " "); + wxVector cols; for(unsigned i = 0; i < gitList.GetCount(); ++i) { wxArrayString gitCommit = ::wxStringTokenize(gitList[i], "@"); if(gitCommit.GetCount() >= 4) { - wxVector cols; + cols.clear(); + cols.reserve(4); + cols.push_back(gitCommit.Item(0)); cols.push_back(gitCommit.Item(1)); cols.push_back(gitCommit.Item(2)); @@ -267,6 +270,7 @@ wxString GitCommitListDlg::GetFilterString() const void GitCommitListDlg::OnNext(wxCommandEvent& event) { + wxUnusedVar(event); m_skip += 100; // Check the cache first if(m_history.count(m_skip)) { @@ -278,6 +282,7 @@ void GitCommitListDlg::OnNext(wxCommandEvent& event) void GitCommitListDlg::OnPrevious(wxCommandEvent& event) { + wxUnusedVar(event); int skip = m_skip - 100; if(m_history.count(skip)) { m_skip -= 100;