mirror of
https://github.com/dbcli/pgcli.git
synced 2024-11-09 16:34:32 +03:00
Switch the shorted prompt when prompt length is too long. Connect #587
This commit is contained in:
parent
4ad7c0f11b
commit
0559c5119e
@ -85,6 +85,7 @@ class NullHandler(logging.Handler):
|
||||
class PGCli(object):
|
||||
|
||||
default_prompt = '\\u@\\h:\\d> '
|
||||
max_len_prompt = 30
|
||||
|
||||
def set_default_pager(self, config):
|
||||
configured_pager = config['main'].get('pager')
|
||||
@ -494,7 +495,11 @@ class PGCli(object):
|
||||
set_vi_mode_enabled=set_vi_mode)
|
||||
|
||||
def prompt_tokens(_):
|
||||
return [(Token.Prompt, self.get_prompt(self.prompt_format))]
|
||||
prompt = self.get_prompt(self.prompt_format)
|
||||
if (self.prompt_format == self.default_prompt and
|
||||
len(prompt) > self.max_len_prompt):
|
||||
prompt = self.get_prompt('\\d> ')
|
||||
return [(Token.Prompt, prompt)]
|
||||
|
||||
def get_continuation_tokens(cli, width):
|
||||
return [(Token.Continuation, '.' * (width - 1) + ' ')]
|
||||
|
Loading…
Reference in New Issue
Block a user