Extend the Alt+M dialog with a checkbox under Cancel (&Replace lines) that when checked hides two inputs and two labels and shows one label and one multiline text input. Checkbox and input states are saved during session just like for two existing inputs. When the checkbox is checked, focus the input; when it's unchecked, focus the prefix input.
Instead of adding a conditional to line modification algorithm (if checked - replace line, else add prefix and suffix), I suggest replacing it with a single algorithm (replace line) and converting prefix/suffix to prefix$(W)suffix if the replace checkbox was unchecked - this is possible thanks to #462 ($(W)).

Extend the Alt+M dialog with a checkbox under Cancel (
&Replace lines) that when checked hides two inputs and two labels and shows one label and one multiline text input. Checkbox and input states are saved during session just like for two existing inputs. When the checkbox is checked, focus the input; when it's unchecked, focus the prefix input.Instead of adding a conditional to line modification algorithm (if checked - replace line, else add prefix and suffix), I suggest replacing it with a single algorithm (replace line) and converting prefix/suffix to
prefix$(W)suffixif the replace checkbox was unchecked - this is possible thanks to #462 ($(W)).