Skip to content

Commit

Permalink
Fixed hitting enter in auth text field not running the primary command
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Jul 24, 2024
1 parent 8b25766 commit 6c22d00
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Simplenote/AuthViewController+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ extension AuthViewController {

@IBAction
func handleNewlineInField(_ field: NSControl) {
if field.isEqual(passwordField.textField) {
if shouldHandleNewLine(in: field) {
guard let primaryActionDescriptor = mode.actions.first(where: { $0.name == .primary }) else {
assertionFailure()
return
Expand All @@ -322,6 +322,10 @@ extension AuthViewController {
}
}

func shouldHandleNewLine(in field: NSControl) -> Bool {
field.isEqual(usernameField.textField) || field.isEqual(passwordField.textField) || field.isEqual(codeTextField.textField)
}

@objc
func updateState(with object: Any) {
guard let field = object as? NSTextField,
Expand Down

0 comments on commit 6c22d00

Please sign in to comment.