on main help sign in
fix(oauth): fix copy to clipboard on terminals that don't support osc52 (#2642)
e74253eAndrey Nering
internal/ui/dialog/oauth.go+4−7
@@ -350,25 +350,22 @@ func (d *OAuth) copyCode() tea.Cmd {
350 if d.State != OAuthStateDisplay {
350 if d.State != OAuthStateDisplay {
351 return nil
351 return nil
352 }
352 }
353− return tea.Sequence(
354− tea.SetClipboard(d.userCode),
355− util.ReportInfo("Code copied to clipboard"),
353+ return common.CopyToClipboard(d.userCode, "Code copied to clipboard")
356− )
357}
354}
358
355
359func (d *OAuth) copyCodeAndOpenURL() tea.Cmd {
356func (d *OAuth) copyCodeAndOpenURL() tea.Cmd {
360 if d.State != OAuthStateDisplay {
357 if d.State != OAuthStateDisplay {
361 return nil
358 return nil
362 }
359 }
363− return tea.Sequence(
360+ return common.CopyToClipboardWithCallback(
364− tea.SetClipboard(d.userCode),
361+ d.userCode,
362+ "Code copied and URL opened",
365 func() tea.Msg {
363 func() tea.Msg {
366 if err := browser.OpenURL(d.verificationURL); err != nil {
364 if err := browser.OpenURL(d.verificationURL); err != nil {
367 return ActionOAuthErrored{fmt.Errorf("failed to open browser: %w", err)}
365 return ActionOAuthErrored{fmt.Errorf("failed to open browser: %w", err)}
368 }
366 }
369 return nil
367 return nil
370 },
368 },
371− util.ReportInfo("Code copied and URL opened"),
372 )
369 )
373}
370}
374
371