Having funsubs in PS2 seems to cause input tokens that are split across lines to be partially replaced with the last token of the last funsub to be parsed while expanding the prompt string.
$ PS2='${ : XXXX; }> ' $ printf '[%s]\n' ab\ > cd [XXcd]
Having funsubs in PS2 seems to cause input tokens that are split across lines to be partially replaced with the last token of the last funsub to be parsed while expanding the prompt string.
$ PS2='${ : XXXX; }> ' $ printf '[%s]\n' ab\ > cd [XXcd]