Skip to content

Commit

Permalink
#2971 Scrolling with arrow keys can get stuck
Browse files Browse the repository at this point in the history
(cherry-picked from commit dbffb51)
  • Loading branch information
singalen authored and jyrkive committed Oct 7, 2018
1 parent a040d52 commit 5aecd58
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hotkey/command_executor.cpp
Expand Up @@ -712,11 +712,15 @@ void command_executor_default::set_button_state()
std::vector<command_executor::queued_command> command_executor::filter_command_queue()
{
std::vector<queued_command> filtered_commands;
std::set<const hotkey_command*> seen_commands;

/** A command plus "key released" flag. Otherwise, we will filter out key releases that are preceded by a keypress. */
using command_with_keyrelease = std::pair<const hotkey_command*, bool>;
std::set<command_with_keyrelease> seen_commands;

for(const queued_command& cmd : command_queue_) {
if(seen_commands.find(cmd.command) == seen_commands.end()) {
seen_commands.insert(cmd.command);
command_with_keyrelease command_key(cmd.command, cmd.release);
if(seen_commands.find(command_key) == seen_commands.end()) {
seen_commands.insert(command_key);
filtered_commands.push_back(cmd);
}
}
Expand Down

0 comments on commit 5aecd58

Please sign in to comment.