Skip to content

Commit

Permalink
Bugfix for backspace while text editing and caps lock (key repeat) is on
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitbubsy committed Apr 22, 2024
1 parent 0620714 commit 57d4b21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pt2_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ void keyDownHandler(SDL_Scancode scancode, SDL_Keycode keycode)
&& scancode != SDL_SCANCODE_BACKSPACE;

// these keys should not allow to be repeated in keyrepeat mode (caps lock)
const bool dontRepeatReturnAndBackspace = !ui.editTextFlag && (scancode == SDL_SCANCODE_RETURN || scancode == SDL_SCANCODE_BACKSPACE);
const bool nonRepeatKeys = keyb.leftAmigaPressed || nonRepeatAltKeys || nonRepeatCtrlKeys
|| scancode == SDL_SCANCODE_LEFT || scancode == SDL_SCANCODE_RIGHT
|| scancode == SDL_SCANCODE_UP || scancode == SDL_SCANCODE_DOWN
|| scancode == SDL_SCANCODE_RETURN || scancode == SDL_SCANCODE_BACKSPACE;
|| dontRepeatReturnAndBackspace;
if (editor.repeatKeyFlag && scancode == keyb.lastRepKey && nonRepeatKeys)
return;

Expand Down Expand Up @@ -215,8 +216,10 @@ void keyDownHandler(SDL_Scancode scancode, SDL_Keycode keycode)

keyb.repeatCounter = 0;
keyb.repeatFrac = 0;

keyb.lastRepKey = scancode;
}


// ENTRY JUMPING IN DISK OP. FILELIST
if (ui.diskOpScreenShown && keyb.shiftPressed && !ui.editTextFlag)
Expand Down

0 comments on commit 57d4b21

Please sign in to comment.