mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
Apply default colors in diff kitten
This commit is contained in:
@@ -14,6 +14,7 @@ class Handler:
|
||||
self.initialize()
|
||||
|
||||
def __exit__(self, *a):
|
||||
del self.write_buf[:]
|
||||
self.finalize()
|
||||
|
||||
def initialize(self):
|
||||
|
||||
@@ -376,8 +376,12 @@ class Loop:
|
||||
self.return_code = 1
|
||||
keep_going = False
|
||||
|
||||
finalize_output = b''.join(handler.write_buf).decode('utf-8')
|
||||
|
||||
if tb is not None:
|
||||
self._report_error_loop(tb, term_manager)
|
||||
self._report_error_loop(finalize_output + tb, term_manager)
|
||||
if tb is None:
|
||||
os.write(self.output_fd, finalize_output.encode('utf-8'))
|
||||
|
||||
def _report_error_loop(self, tb, term_manager):
|
||||
select = self.sel.select
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
|
||||
from kitty.rgb import color_as_sharp, to_color
|
||||
from kitty.rgb import Color, color_as_sharp, to_color
|
||||
from kitty.terminfo import string_capabilities
|
||||
|
||||
S7C1T = '\033 F'
|
||||
@@ -168,9 +168,9 @@ def set_default_colors(fg=None, bg=None):
|
||||
if fg is None:
|
||||
ans += '\x1b]110\x1b\\'
|
||||
else:
|
||||
ans += '\x1b]10;{}\x1b\\'.format(color_as_sharp(to_color(fg)))
|
||||
ans += '\x1b]10;{}\x1b\\'.format(color_as_sharp(fg if isinstance(fg, Color) else to_color(fg)))
|
||||
if bg is None:
|
||||
ans += '\x1b]111\x1b\\'
|
||||
else:
|
||||
ans += '\x1b]11;{}\x1b\\'.format(color_as_sharp(to_color(bg)))
|
||||
ans += '\x1b]11;{}\x1b\\'.format(color_as_sharp(bg if isinstance(bg, Color) else to_color(bg)))
|
||||
return ans
|
||||
|
||||
Reference in New Issue
Block a user