Show More
@@ -17,7 +17,7 b' from traitlets import Bool, Unicode, Dict, Integer, observe' | |||
|
17 | 17 | |
|
18 | 18 | from prompt_toolkit.completion import Completer, Completion |
|
19 | 19 | from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER, EditingMode |
|
20 | from prompt_toolkit.filters import HasFocus, HasSelection, Condition, ViInsertMode, EmacsInsertMode | |
|
20 | from prompt_toolkit.filters import HasFocus, HasSelection, Condition, ViInsertMode, EmacsInsertMode, IsDone | |
|
21 | 21 | from prompt_toolkit.history import InMemoryHistory |
|
22 | 22 | from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout |
|
23 | 23 | from prompt_toolkit.interface import CommandLineInterface |
@@ -25,6 +25,7 b' from prompt_toolkit.key_binding.manager import KeyBindingManager' | |||
|
25 | 25 | from prompt_toolkit.keys import Keys |
|
26 | 26 | from prompt_toolkit.layout.lexers import Lexer |
|
27 | 27 | from prompt_toolkit.layout.lexers import PygmentsLexer |
|
28 | from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor | |
|
28 | 29 | from prompt_toolkit.styles import PygmentsStyle, DynamicStyle |
|
29 | 30 | |
|
30 | 31 | from pygments.styles import get_style_by_name, get_all_styles |
@@ -145,7 +146,10 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
145 | 146 | help="Display a multi column completion menu.", |
|
146 | 147 | ).tag(config=True) |
|
147 | 148 | |
|
148 | ||
|
149 | highlight_matching_brackets = Bool(False, | |
|
150 | help="Highlight matching brackets .", | |
|
151 | ).tag(config=True) | |
|
152 | ||
|
149 | 153 | @observe('term_title') |
|
150 | 154 | def init_term_title(self, change=None): |
|
151 | 155 | # Enable or disable the terminal title. |
@@ -300,6 +304,13 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
300 | 304 | 'get_continuation_tokens':self.get_continuation_tokens, |
|
301 | 305 | 'multiline':True, |
|
302 | 306 | 'display_completions_in_columns': self.display_completions_in_columns, |
|
307 | ||
|
308 | # Highlight matching brackets, but only when this setting is | |
|
309 | # enabled, and only when the DEFAULT_BUFFER has the focus. | |
|
310 | 'extra_input_processors': [ConditionalProcessor( | |
|
311 | processor=HighlightMatchingBracketProcessor(chars='[](){}'), | |
|
312 | filter=HasFocus(DEFAULT_BUFFER) & ~IsDone() & | |
|
313 | Condition(lambda cli: self.highlight_matching_brackets))], | |
|
303 | 314 | } |
|
304 | 315 | |
|
305 | 316 | def _update_layout(self): |
General Comments 0
You need to be logged in to leave comments.
Login now