summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Slenders <jonathan@slenders.be>2016-12-17 21:49:28 +0100
committerJonathan Slenders <jonathan@slenders.be>2016-12-17 21:49:28 +0100
commit53980e1f1fe366fd6baa963084f6da4b53ae0680 (patch)
treecbb03f25555b188f70272e811ca196619f877d0e
parentd743858ea49e42bb9475a626ac3a597291f28c18 (diff)
Renamed load_default_key_bindings_for_prompt to load_key_bindings_for_prompt.
-rwxr-xr-xexamples/autocompletion-like-readline.py4
-rwxr-xr-xexamples/autocorrection.py4
-rwxr-xr-xexamples/custom-key-binding.py4
-rwxr-xr-xexamples/custom-vi-operator-and-text-object.py4
-rwxr-xr-xexamples/full-screen-layout.py4
-rwxr-xr-xexamples/get-password-with-toggle-display-shortcut.py4
-rwxr-xr-xexamples/switch-between-vi-emacs.py4
-rw-r--r--prompt_toolkit/application.py4
-rw-r--r--prompt_toolkit/key_binding/bindings/named_commands.py1
-rw-r--r--prompt_toolkit/key_binding/defaults.py12
-rw-r--r--prompt_toolkit/key_binding/manager.py6
-rw-r--r--prompt_toolkit/shortcuts.py4
12 files changed, 28 insertions, 27 deletions
diff --git a/examples/autocompletion-like-readline.py b/examples/autocompletion-like-readline.py
index babe0e1d..68316a40 100755
--- a/examples/autocompletion-like-readline.py
+++ b/examples/autocompletion-like-readline.py
@@ -8,7 +8,7 @@ from __future__ import unicode_literals
from prompt_toolkit import prompt
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit.key_binding.bindings.completion import display_completions_like_readline
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings
+from prompt_toolkit.key_binding.defaults import load_key_bindings
from prompt_toolkit.keys import Keys
@@ -23,7 +23,7 @@ animal_completer = WordCompleter([
# Create key bindings registry with a custom binding for the Tab key that
# displays completions like GNU readline.
-registry = load_default_key_bindings()
+registry = load_key_bindings()
registry.add_binding(Keys.ControlI)(display_completions_like_readline)
diff --git a/examples/autocorrection.py b/examples/autocorrection.py
index d136ea33..8819eb2f 100755
--- a/examples/autocorrection.py
+++ b/examples/autocorrection.py
@@ -5,7 +5,7 @@ Example of implementing auto correction while typing.
The word "impotr" will be corrected when the user types a space afterwards.
"""
from __future__ import unicode_literals
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings_for_prompt
+from prompt_toolkit.key_binding.defaults import load_key_bindings_for_prompt
from prompt_toolkit import prompt
# Database of words to be replaced by typing.
@@ -17,7 +17,7 @@ corrections = {
def main():
# We start with a `Registry` that contains the default key bindings.
- registry = load_default_key_bindings_for_prompt()
+ registry = load_key_bindings_for_prompt()
# We add a custom key binding to space.
@registry.add_binding(' ')
diff --git a/examples/custom-key-binding.py b/examples/custom-key-binding.py
index c3819cb0..3ddf6de5 100755
--- a/examples/custom-key-binding.py
+++ b/examples/custom-key-binding.py
@@ -4,13 +4,13 @@ Example of adding a custom key binding to a prompt.
"""
from __future__ import unicode_literals
from prompt_toolkit import prompt
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings_for_prompt
+from prompt_toolkit.key_binding.defaults import load_key_bindings_for_prompt
from prompt_toolkit.keys import Keys
def main():
# We start with a `Registry` of default key bindings.
- registry = load_default_key_bindings_for_prompt()
+ registry = load_key_bindings_for_prompt()
# Add our own key binding to the registry of the key bindings manager.
@registry.add_binding(Keys.F4)
diff --git a/examples/custom-vi-operator-and-text-object.py b/examples/custom-vi-operator-and-text-object.py
index dfe3a0ab..a43f4b48 100755
--- a/examples/custom-vi-operator-and-text-object.py
+++ b/examples/custom-vi-operator-and-text-object.py
@@ -5,14 +5,14 @@ Example of adding a custom Vi operator and text object.
"""
from __future__ import unicode_literals
from prompt_toolkit import prompt
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings_for_prompt
+from prompt_toolkit.key_binding.defaults import load_key_bindings_for_prompt
from prompt_toolkit.key_binding.bindings.vi import create_operator_decorator, create_text_object_decorator, TextObject
from prompt_toolkit.enums import EditingMode
def main():
# We start with a `Registry` of default key bindings.
- registry = load_default_key_bindings_for_prompt()
+ registry = load_key_bindings_for_prompt()
# Create the decorators to be used for registering text objects and
# operators in this registry.
diff --git a/examples/full-screen-layout.py b/examples/full-screen-layout.py
index 67ded1fb..d581d883 100755
--- a/examples/full-screen-layout.py
+++ b/examples/full-screen-layout.py
@@ -11,7 +11,7 @@ from prompt_toolkit.application import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.interface import CommandLineInterface
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings
+from prompt_toolkit.key_binding.defaults import load_key_bindings
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout.containers import VSplit, HSplit, Window
from prompt_toolkit.layout.controls import BufferControl, FillControl, TokenListControl
@@ -93,7 +93,7 @@ layout = HSplit([
# `load_default_key_bindings` utility function to create a registry that
# already contains the default key bindings.
-registry = load_default_key_bindings()
+registry = load_key_bindings()
# Now add the Ctrl-Q binding. We have to pass `eager=True` here. The reason is
# that there is another key *sequence* that starts with Ctrl-Q as well. Yes, a
diff --git a/examples/get-password-with-toggle-display-shortcut.py b/examples/get-password-with-toggle-display-shortcut.py
index 756b6c38..403543d5 100755
--- a/examples/get-password-with-toggle-display-shortcut.py
+++ b/examples/get-password-with-toggle-display-shortcut.py
@@ -5,14 +5,14 @@ With the addition of a ControlT shortcut to hide/show the input.
"""
from __future__ import unicode_literals
from prompt_toolkit import prompt
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings_for_prompt
+from prompt_toolkit.key_binding.defaults import load_key_bindings_for_prompt
from prompt_toolkit.keys import Keys
from prompt_toolkit.filters import Condition
def main():
hidden = [True] # Nonlocal
- registry = load_default_key_bindings_for_prompt()
+ registry = load_key_bindings_for_prompt()
@registry.add_binding(Keys.ControlT)
def _(event):
diff --git a/examples/switch-between-vi-emacs.py b/examples/switch-between-vi-emacs.py
index ded3a855..0e216365 100755
--- a/examples/switch-between-vi-emacs.py
+++ b/examples/switch-between-vi-emacs.py
@@ -5,14 +5,14 @@ Example that displays how to switch between Emacs and Vi input mode.
"""
from prompt_toolkit import prompt
from prompt_toolkit.enums import EditingMode
-from prompt_toolkit.key_binding.defaults import load_default_key_bindings_for_prompt
+from prompt_toolkit.key_binding.defaults import load_key_bindings_for_prompt
from prompt_toolkit.keys import Keys
from prompt_toolkit.styles import style_from_dict
from prompt_toolkit.token import Token
def run():
# Create a `Registry` that contains the default key bindings.
- registry = load_default_key_bindings_for_prompt()
+ registry = load_key_bindings_for_prompt()
# Add an additional key binding for toggling this flag.
@registry.add_binding(Keys.F4)
diff --git a/prompt_toolkit/application.py b/prompt_toolkit/application.py
index 7f13171b..2bc4f261 100644
--- a/prompt_toolkit/application.py
+++ b/prompt_toolkit/application.py
@@ -9,7 +9,7 @@ from .key_binding.bindings.basic import load_basic_bindings
from .key_binding.bindings.emacs import load_emacs_bindings
from .key_binding.bindings.vi import load_vi_bindings
from .key_binding.registry import BaseRegistry
-from .key_binding.defaults import load_default_key_bindings
+from .key_binding.defaults import load_key_bindings
from .layout import Window
from .layout.containers import Container
from .layout.controls import BufferControl
@@ -146,7 +146,7 @@ class Application(object):
self.style = style or DEFAULT_STYLE
if key_bindings_registry is None:
- key_bindings_registry = load_default_key_bindings()
+ key_bindings_registry = load_key_bindings()
if get_title is None:
get_title = lambda: None
diff --git a/prompt_toolkit/key_binding/bindings/named_commands.py b/prompt_toolkit/key_binding/bindings/named_commands.py
index 570fc2f4..668477be 100644
--- a/prompt_toolkit/key_binding/bindings/named_commands.py
+++ b/prompt_toolkit/key_binding/bindings/named_commands.py
@@ -169,6 +169,7 @@ def reverse_search_history(event):
event.cli.current_search_state.direction = IncrementalSearchDirection.BACKWARD
event.cli.push_focus(SEARCH_BUFFER)
+
#
# Commands for changing text
#
diff --git a/prompt_toolkit/key_binding/defaults.py b/prompt_toolkit/key_binding/defaults.py
index 7f32f3d5..fb2c1070 100644
--- a/prompt_toolkit/key_binding/defaults.py
+++ b/prompt_toolkit/key_binding/defaults.py
@@ -1,7 +1,7 @@
"""
Default key bindings.::
- registry = load_default_key_bindings()
+ registry = load_key_bindings()
app = Application(key_bindings_registry=registry)
"""
from __future__ import unicode_literals
@@ -12,12 +12,12 @@ from prompt_toolkit.key_binding.bindings.vi import load_vi_bindings, load_vi_sys
from prompt_toolkit.filters import to_cli_filter
__all__ = (
- 'load_default_key_bindings',
- 'load_default_key_bindings_for_prompt',
+ 'load_key_bindings',
+ 'load_key_bindings_for_prompt',
)
-def load_default_key_bindings(
+def load_key_bindings(
get_search_state=None,
enable_abort_and_exit_bindings=False,
enable_system_bindings=False,
@@ -102,7 +102,7 @@ def load_default_key_bindings(
return registry
-def load_default_key_bindings_for_prompt(**kw):
+def load_key_bindings_for_prompt(**kw):
"""
Create a ``Registry`` object with the defaults key bindings for an input
prompt.
@@ -116,4 +116,4 @@ def load_default_key_bindings_for_prompt(**kw):
kw.setdefault('enable_search', True)
kw.setdefault('enable_auto_suggest_bindings', True)
- return load_default_key_bindings(**kw)
+ return load_key_bindings(**kw)
diff --git a/prompt_toolkit/key_binding/manager.py b/prompt_toolkit/key_binding/manager.py
index c2972e8f..83612c2a 100644
--- a/prompt_toolkit/key_binding/manager.py
+++ b/prompt_toolkit/key_binding/manager.py
@@ -1,6 +1,6 @@
"""
DEPRECATED:
-Use `prompt_toolkit.key_binding.defaults.load_default_key_bindings` instead.
+Use `prompt_toolkit.key_binding.defaults.load_key_bindings` instead.
:class:`KeyBindingManager` is a utility (or shortcut) for loading all the key
bindings in a key binding registry, with a logic set of filters to quickly to
@@ -14,7 +14,7 @@ Usage::
app = Application(key_bindings_registry=manager.registry)
"""
from __future__ import unicode_literals
-from .defaults import load_default_key_bindings
+from .defaults import load_key_bindings
from prompt_toolkit.filters import to_cli_filter
from prompt_toolkit.key_binding.registry import Registry, ConditionalRegistry, MergedRegistry
@@ -56,7 +56,7 @@ class KeyBindingManager(object):
assert get_search_state is None or callable(get_search_state)
enable_all = to_cli_filter(enable_all)
- defaults = load_default_key_bindings(
+ defaults = load_key_bindings(
get_search_state=get_search_state,
enable_abort_and_exit_bindings=enable_abort_and_exit_bindings,
enable_system_bindings=enable_system_bindings,
diff --git a/prompt_toolkit/shortcuts.py b/prompt_toolkit/shortcuts.py
index 2fa49600..5586427d 100644
--- a/prompt_toolkit/shortcuts.py
+++ b/prompt_toolkit/shortcuts.py
@@ -27,7 +27,7 @@ from .enums import DEFAULT_BUFFER, SEARCH_BUFFER, EditingMode
from .filters import IsDone, HasFocus, RendererHeightIsKnown, to_simple_filter, to_cli_filter, Condition
from .history import InMemoryHistory
from .interface import CommandLineInterface, Application, AbortAction
-from .key_binding.defaults import load_default_key_bindings_for_prompt
+from .key_binding.defaults import load_key_bindings_for_prompt
from .key_binding.registry import Registry
from .keys import Keys
from .layout import Window, HSplit, FloatContainer, Float
@@ -449,7 +449,7 @@ def create_prompt_application(
be edited by the user.)
"""
if key_bindings_registry is None:
- key_bindings_registry = load_default_key_bindings_for_prompt(
+ key_bindings_registry = load_key_bindings_for_prompt(
enable_system_bindings=enable_system_bindings,
enable_open_in_editor=enable_open_in_editor)