Replace ps1/ps2 with the default if the user specified value contains control characters.
(ps, default_ps: str)
| 298 | |
| 299 | |
| 300 | def _process_ps(ps, default_ps: str): |
| 301 | """Replace ps1/ps2 with the default if the user specified value contains control characters.""" |
| 302 | if not isinstance(ps, str): |
| 303 | return ps |
| 304 | |
| 305 | return ps if wcswidth(ps) >= 0 else default_ps |
| 306 | |
| 307 | |
| 308 | class BaseRepl(Repl): |