本文整理匯總了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]