本文整理汇总了Python中prompt_toolkit.token.Token.ColorColumn方法的典型用法代码示例。如果您正苦于以下问题:Python Token.ColorColumn方法的具体用法?Python Token.ColorColumn怎么用?Python Token.ColorColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prompt_toolkit.token.Token
的用法示例。
在下文中一共展示了Token.ColorColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import ColorColumn [as 别名]
def __init__(self, position, token=Token.ColorColumn):
self.position = position
self.token = token
示例2: _highlight_cursorlines
# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import ColorColumn [as 别名]
def _highlight_cursorlines(self, cli, new_screen, cpos, x, y, width, height):
"""
Highlight cursor row/column.
"""
cursor_line_token = (':', ) + self.cursorline_token
cursor_column_token = (':', ) + self.cursorcolumn_token
data_buffer = new_screen.data_buffer
# Highlight cursor line.
if self.cursorline(cli):
row = data_buffer[cpos.y]
for x in range(x, x + width):
original_char = row[x]
row[x] = _CHAR_CACHE[
original_char.char, original_char.token + cursor_line_token]
# Highlight cursor column.
if self.cursorcolumn(cli):
for y2 in range(y, y + height):
row = data_buffer[y2]
original_char = row[cpos.x]
row[cpos.x] = _CHAR_CACHE[
original_char.char, original_char.token + cursor_column_token]
# Highlight color columns
for cc in self.get_colorcolumns(cli):
assert isinstance(cc, ColorColumn)
color_column_token = (':', ) + cc.token
column = cc.position
for y2 in range(y, y + height):
row = data_buffer[y2]
original_char = row[column]
row[column] = _CHAR_CACHE[
original_char.char, original_char.token + color_column_token]