From 9f9044b164a140a8af924014e786bf4a407b2a2d Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sun, 22 Mar 2020 11:59:24 +0100 Subject: [PATCH] fixed: selection and backspace are recently broken in CPTokenField this bug was introduced by commit 26aab29 26aab29 was meant to improve iOS experience but makes the tokenfield loose FR status prematurely --- AppKit/CPTokenField.j | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index de0b19c73..a803b1d9c 100644 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -584,6 +584,12 @@ CPTokenFieldDeleteButtonType = 1; // Snap to the token if it's only half visible due to mouse wheel scrolling. _shouldScrollTo = aToken; } + + // this is a hack to compensate for a recent adoption in FR management as introduced by commit #26aab29 + // this PR makes the tokenfield loose FR status prematurely, so we have to regain here in order to make deleteForward: and friends work + setTimeout(function(){ + [[self window] makeFirstResponder:self]; + }, 50); } // =========== @@ -964,8 +970,8 @@ CPTokenFieldDeleteButtonType = 1; [self _selectToken:tokenView byExtendingSelection:NO]; } } - else - [self _removeSelectedTokens:nil]; + // we have to remove unconditionally because the backspace is not propagated anymore starting from commit #26aab29 + [self _removeSelectedTokens:nil]; } else {