That's only a problem if you're using a line-wrap method which doesn't account for indentation and just blindly wraps (which yes, is awful). If you want to have nice indentation aware plain text line wrapping, your text editor almost certainly supports it.
If you use vim, look into the "breakindent" option.
If you use Emacs, you can use the "adaptive-wrap" package with a configuration like this:
;; Indentation of softwraped code
(use-package adaptive-wrap
:ensure t
:init (defun my-activate-adaptive-wrap-prefix-mode ()
"Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
(adaptive-wrap-prefix-mode (if visual-line-mode 1 -1)))
(add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
If you use vim, look into the "breakindent" option.
If you use Emacs, you can use the "adaptive-wrap" package with a configuration like this: