Skip to content

Conversation

@mjkloeckner
Copy link
Contributor

I noticed that while pressing tab the cursor last keystroke was not being updated:

case SDLK_TAB: {
    for (size_t i = 0; i < 4; ++i) {
        editor_insert_char(&editor, ' ');
    }
}

it should be:

case SDLK_TAB: {
    for (size_t i = 0; i < 4; ++i) {
        editor_insert_char(&editor, ' ');
    }
    editor.last_stroke = SDL_GetTicks();
}

but instead of updating the last keystroke individually in every key press, it's better to update it when a key is pressed regardless if the key being pressed has a dedicated function or not.

This commit removes all the editor.last_stroke = SDL_GetTicks(); from every key case and adds only one after the switch execution.

I noticed that while pressing tab the cursor last keystroke was not
being updated:

```c
for (size_t i = 0; i < 4; ++i) {
    editor_insert_char(&editor, ' ');
}
```

it should be:

```c
for (size_t i = 0; i < 4; ++i) {
    editor_insert_char(&editor, ' ');
}
editor.last_stroke = SDL_GetTicks();
```

but instead of updating the last keystroke individualy in every
keypress, it's better to update it when a key is pressed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant