mirror of https://github.com/dbcli/pgcli
fixed unknown symbol REPLACE_SINGLE in prompt_toolkit < 3.0.6 (#1246)
* fixed unknown symbol REPLACE_SINGLE in prompt_toolkit < 3.0.6 * changelog
This commit is contained in:
parent
9ca545d880
commit
30212c6fc6
|
@ -11,6 +11,7 @@ Bug fixes:
|
|||
----------
|
||||
|
||||
* Fix issue where `syntax_style` config value would not have any effect. (#1212)
|
||||
* Fix crash because of not found `InputMode.REPLACE_SINGLE` with prompt-toolkit < 3.0.6
|
||||
|
||||
3.1.0
|
||||
=====
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
from packaging.version import parse as parse_version
|
||||
|
||||
import prompt_toolkit
|
||||
from prompt_toolkit.key_binding.vi_state import InputMode
|
||||
from prompt_toolkit.application import get_app
|
||||
|
||||
|
||||
def _get_vi_mode():
|
||||
return {
|
||||
modes = {
|
||||
InputMode.INSERT: "I",
|
||||
InputMode.NAVIGATION: "N",
|
||||
InputMode.REPLACE: "R",
|
||||
InputMode.REPLACE_SINGLE: "R",
|
||||
InputMode.INSERT_MULTIPLE: "M",
|
||||
}[get_app().vi_state.input_mode]
|
||||
}
|
||||
if parse_version(prompt_toolkit.__version__) >= parse_version("3.0.6"):
|
||||
modes[InputMode.REPLACE_SINGLE] = "R"
|
||||
return modes[get_app().vi_state.input_mode]
|
||||
|
||||
|
||||
def create_toolbar_tokens_func(pgcli):
|
||||
|
|
Loading…
Reference in New Issue