mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 15:04:50 +02:00
Cleanup previous PR
This commit is contained in:
@@ -22,6 +22,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
|
|
||||||
- Allow setting colors when creating windows using the :doc:`launch <launch>` command.
|
- Allow setting colors when creating windows using the :doc:`launch <launch>` command.
|
||||||
|
|
||||||
|
- A new option :opt:`tab_powerline_style` to control the appearance of the tab
|
||||||
|
bar when using the powerline tab bar style.
|
||||||
|
|
||||||
- diff kitten: Implement recursive diff over SSH (:iss:`3268`)
|
- diff kitten: Implement recursive diff over SSH (:iss:`3268`)
|
||||||
|
|
||||||
- ssh kitten: Allow using python instead of the shell on the server, useful if
|
- ssh kitten: Allow using python instead of the shell on the server, useful if
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from functools import lru_cache
|
|||||||
from typing import Any, Dict, NamedTuple, Optional, Sequence, Tuple
|
from typing import Any, Dict, NamedTuple, Optional, Sequence, Tuple
|
||||||
|
|
||||||
from .config import build_ansi_color_table
|
from .config import build_ansi_color_table
|
||||||
from .types import WindowGeometry
|
|
||||||
from .fast_data_types import (
|
from .fast_data_types import (
|
||||||
DECAWM, Screen, cell_size_for_window, pt_to_px, set_tab_bar_render_data,
|
DECAWM, Screen, cell_size_for_window, pt_to_px, set_tab_bar_render_data,
|
||||||
viewport_for_window
|
viewport_for_window
|
||||||
@@ -14,6 +13,8 @@ from .fast_data_types import (
|
|||||||
from .layout.base import Rect
|
from .layout.base import Rect
|
||||||
from .options_stub import Options
|
from .options_stub import Options
|
||||||
from .rgb import Color, alpha_blend, color_as_sgr, color_from_int, to_color
|
from .rgb import Color, alpha_blend, color_as_sgr, color_from_int, to_color
|
||||||
|
from .types import WindowGeometry
|
||||||
|
from .typing import PowerlineStyle
|
||||||
from .utils import color_as_int, log_error
|
from .utils import color_as_int, log_error
|
||||||
from .window import calculate_gl_geometry
|
from .window import calculate_gl_geometry
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ class DrawData(NamedTuple):
|
|||||||
title_template: str
|
title_template: str
|
||||||
active_title_template: Optional[str]
|
active_title_template: Optional[str]
|
||||||
tab_activity_symbol: Optional[str]
|
tab_activity_symbol: Optional[str]
|
||||||
powerline_style: str
|
powerline_style: PowerlineStyle
|
||||||
|
|
||||||
|
|
||||||
def as_rgb(x: int) -> int:
|
def as_rgb(x: int) -> int:
|
||||||
@@ -181,28 +182,26 @@ def draw_tab_with_fade(draw_data: DrawData, screen: Screen, tab: TabBarData, bef
|
|||||||
return end
|
return end
|
||||||
|
|
||||||
|
|
||||||
|
powerline_symbols: Dict[PowerlineStyle, Tuple[str, str]] = {
|
||||||
|
'slanted': ('', '╱'),
|
||||||
|
'round': ('', '')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData, before: int, max_title_length: int, index: int, is_last: bool) -> int:
|
def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData, before: int, max_title_length: int, index: int, is_last: bool) -> int:
|
||||||
tab_bg = as_rgb(color_as_int(draw_data.active_bg if tab.is_active else draw_data.inactive_bg))
|
tab_bg = as_rgb(color_as_int(draw_data.active_bg if tab.is_active else draw_data.inactive_bg))
|
||||||
tab_fg = as_rgb(color_as_int(draw_data.active_fg if tab.is_active else draw_data.inactive_fg))
|
tab_fg = as_rgb(color_as_int(draw_data.active_fg if tab.is_active else draw_data.inactive_fg))
|
||||||
inactive_bg = as_rgb(color_as_int(draw_data.inactive_bg))
|
inactive_bg = as_rgb(color_as_int(draw_data.inactive_bg))
|
||||||
default_bg = as_rgb(color_as_int(draw_data.default_bg))
|
default_bg = as_rgb(color_as_int(draw_data.default_bg))
|
||||||
|
|
||||||
separator_symbol = ''
|
separator_symbol, separator_alt_symbol = powerline_symbols.get(draw_data.powerline_style, ('', ''))
|
||||||
separator_alt_symbol = ''
|
|
||||||
if draw_data.powerline_style == 'slanted':
|
|
||||||
separator_symbol = ''
|
|
||||||
separator_alt_symbol = '╱'
|
|
||||||
elif draw_data.powerline_style == 'round':
|
|
||||||
separator_symbol = ''
|
|
||||||
separator_alt_symbol = ''
|
|
||||||
|
|
||||||
min_title_length = 1 + 2
|
min_title_length = 1 + 2
|
||||||
|
|
||||||
if screen.cursor.x + min_title_length >= screen.columns:
|
if screen.cursor.x + min_title_length >= screen.columns:
|
||||||
screen.cursor.x -= 2
|
screen.cursor.x -= 2
|
||||||
screen.cursor.bg = default_bg
|
screen.cursor.bg = default_bg
|
||||||
screen.cursor.fg = inactive_bg
|
screen.cursor.fg = inactive_bg
|
||||||
screen.draw('{} '.format(separator_symbol))
|
screen.draw(f'{separator_symbol} ')
|
||||||
return screen.cursor.x
|
return screen.cursor.x
|
||||||
|
|
||||||
start_draw = 2
|
start_draw = 2
|
||||||
@@ -210,7 +209,7 @@ def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData
|
|||||||
screen.cursor.x -= 2
|
screen.cursor.x -= 2
|
||||||
screen.cursor.fg = inactive_bg
|
screen.cursor.fg = inactive_bg
|
||||||
screen.cursor.bg = tab_bg
|
screen.cursor.bg = tab_bg
|
||||||
screen.draw('{} '.format(separator_symbol))
|
screen.draw(f'{separator_symbol} ')
|
||||||
screen.cursor.fg = tab_fg
|
screen.cursor.fg = tab_fg
|
||||||
elif screen.cursor.x == 0:
|
elif screen.cursor.x == 0:
|
||||||
screen.cursor.bg = tab_bg
|
screen.cursor.bg = tab_bg
|
||||||
@@ -236,7 +235,7 @@ def draw_tab_with_powerline(draw_data: DrawData, screen: Screen, tab: TabBarData
|
|||||||
screen.cursor.bg = inactive_bg
|
screen.cursor.bg = inactive_bg
|
||||||
screen.draw(separator_symbol)
|
screen.draw(separator_symbol)
|
||||||
else:
|
else:
|
||||||
screen.draw(' {}'.format(separator_alt_symbol))
|
screen.draw(f' {separator_alt_symbol}')
|
||||||
|
|
||||||
end = screen.cursor.x
|
end = screen.cursor.x
|
||||||
if end < screen.columns:
|
if end < screen.columns:
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ TermManagerType = LoopType = Debug = GraphicsCommandType = None
|
|||||||
CompletedProcess = Tuple
|
CompletedProcess = Tuple
|
||||||
TypedDict = dict
|
TypedDict = dict
|
||||||
EdgeLiteral = str
|
EdgeLiteral = str
|
||||||
|
PowerlineStyle = str
|
||||||
MatchType = str
|
MatchType = str
|
||||||
Protocol = object
|
Protocol = object
|
||||||
|
|||||||
@@ -56,3 +56,4 @@ __all__ = (
|
|||||||
'FontConfigPattern', 'ScreenType', 'StartupCtx', 'KeyEventType', 'LayoutType',
|
'FontConfigPattern', 'ScreenType', 'StartupCtx', 'KeyEventType', 'LayoutType',
|
||||||
'RemoteCommandType', 'SessionType', 'SessionTab', 'SpecialWindowInstance', 'TabType', 'ScreenSize', 'WindowType'
|
'RemoteCommandType', 'SessionType', 'SessionTab', 'SpecialWindowInstance', 'TabType', 'ScreenSize', 'WindowType'
|
||||||
)
|
)
|
||||||
|
PowerlineStyle = Literal['angled', 'slanted', 'round']
|
||||||
|
|||||||
Reference in New Issue
Block a user