X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy%2Fmisc.py;h=dce3ea6c84c7b0ccdc1782a4d5d7601414ef3b6b;hp=0e7e561298d9551af13789c94fb30ed3cdf01514;hb=da204426401f781b90121eac018166bcde5ee211;hpb=b7a0d21774ff74bcf66315a4d14b788263f41dea diff --git a/mudpy/misc.py b/mudpy/misc.py index 0e7e561..dce3ea6 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -661,6 +661,20 @@ class User: self.error = False self.adjust_echoing() + def prompt(self): + """"Generate and return an input prompt.""" + + # Start with the user's preference, if one was provided + prompt = self.account.get("prompt") + + # If the user has not set a prompt, then immediately return the default + # provided for the current state + if not prompt: + return get_menu_prompt(self.state) + + # Return the cooked prompt + return "%s " % prompt + def adjust_echoing(self): """Adjust echoing to match state menu requirements.""" if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_ECHO, @@ -723,7 +737,7 @@ class User: if not just_prompt: output += "$(eol)" if add_prompt: - output += self.account.get("prompt", ">") + " " + output += self.prompt() mode = self.avatar.get("mode") if mode: output += "(" + mode + ") "