Part of #28238 This PR refactors `FindHyperlink` handling and associated code in `terminal.rs` into its own file for improved testability, and adds tests. Release Notes: - N/A