Compare commits

..

1 Commits

18 changed files with 482 additions and 19 deletions

4
.github/FUNDING.yml vendored
View File

@ -1,4 +1,2 @@
github: kovidgoyal custom: https://my.fsf.org/donate
patreon: kovidgoyal
liberapay: kovidgoyal
custom: https://sw.kovidgoyal.net/kitty/support.html custom: https://sw.kovidgoyal.net/kitty/support.html

View File

@ -31,7 +31,7 @@ Manually installing
If something goes wrong or you simply do not want to run the installer, you can If something goes wrong or you simply do not want to run the installer, you can
manually download and install |kitty| from the `GitHub releases page manually download and install |kitty| from the `GitHub releases page
<https://github.com/kovidgoyal/kitty/releases>`__. If you are on macOS, download <https://gitea.rexy712.xyz/KittyPatch/kitty/releases>`__. If you are on macOS, download
the :file:`.dmg` and install as normal. If you are on Linux, download the the :file:`.dmg` and install as normal. If you are on Linux, download the
tarball and extract it into a directory. The |kitty| executable will be in the tarball and extract it into a directory. The |kitty| executable will be in the
:file:`bin` sub-directory. :file:`bin` sub-directory.

View File

@ -1,9 +1,9 @@
Build from source Build from source
================== ==================
.. image:: https://github.com/kovidgoyal/kitty/workflows/CI/badge.svg .. image:: https://gitea.rexy712.xyz/KittyPatch/kitty/workflows/CI/badge.svg
:alt: Build status :alt: Build status
:target: https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI :target: https://gitea.rexy712.xyz/KittyPatch/kitty/actions?query=workflow%3ACI
.. highlight:: sh .. highlight:: sh
@ -71,7 +71,7 @@ Install and run from source
.. code-block:: sh .. code-block:: sh
git clone https://github.com/kovidgoyal/kitty && cd kitty git clone https://gitea.rexy712.xyz/KittyPatch/kitty && cd kitty
Now build the native code parts of |kitty| with the following command:: Now build the native code parts of |kitty| with the following command::
@ -106,7 +106,7 @@ dependencies you might have to rebuild the app.
.. note:: .. note::
The released :file:`kitty.dmg` includes all dependencies, unlike the The released :file:`kitty.dmg` includes all dependencies, unlike the
:file:`kitty.app` built above and is built automatically by using the :file:`kitty.app` built above and is built automatically by using the
`bypy framework <https://github.com/kovidgoyal/bypy>`__ however, that is `bypy framework <https://gitea.rexy712.xyz/KittyPatch/bypy>`__ however, that is
designed to run on Linux and is not for the faint of heart. designed to run on Linux and is not for the faint of heart.
.. note:: .. note::
@ -155,7 +155,7 @@ Notes for Linux/macOS packagers
---------------------------------- ----------------------------------
The released |kitty| source code is available as a `tarball`_ from The released |kitty| source code is available as a `tarball`_ from
`the GitHub releases page <https://github.com/kovidgoyal/kitty/releases>`__. `the GitHub releases page <https://gitea.rexy712.xyz/KittyPatch/kitty/releases>`__.
While |kitty| does use Python, it is not a traditional Python package, so please While |kitty| does use Python, it is not a traditional Python package, so please
do not install it in site-packages. do not install it in site-packages.

View File

@ -33,8 +33,8 @@ from kitty.constants import str_version, website_url # noqa
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'kitty' project = 'kitty'
copyright = time.strftime('%Y, Kovid Goyal') copyright = time.strftime('%Y, Kovid Goyal, KittyPatch')
author = 'Kovid Goyal' author = 'Kovid Goyal, KittyPatch'
building_man_pages = 'man' in sys.argv building_man_pages = 'man' in sys.argv
# The short X.Y version # The short X.Y version
@ -100,7 +100,7 @@ exclude_patterns = [
rst_prolog = ''' rst_prolog = '''
.. |kitty| replace:: *kitty* .. |kitty| replace:: *kitty*
.. |version| replace:: VERSION .. |version| replace:: VERSION
.. _tarball: https://github.com/kovidgoyal/kitty/releases/download/vVERSION/kitty-VERSION.tar.xz .. _tarball: https://gitea.rexy712.xyz/KittyPatch/kitty/releases/download/vVERSION/kitty-VERSION.tar.xz
.. role:: italic .. role:: italic
'''.replace('VERSION', str_version) '''.replace('VERSION', str_version)
@ -215,7 +215,7 @@ def commit_role(
f'GitHub commit id "{text}" not recognized.', line=lineno) f'GitHub commit id "{text}" not recognized.', line=lineno)
prb = inliner.problematic(rawtext, rawtext, msg) prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg] return [prb], [msg]
url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}' url = f'https://gitea.rexy712.xyz/KittyPatch/kitty/commit/{commit_id}'
set_classes(options) set_classes(options)
short_id = subprocess.check_output( short_id = subprocess.check_output(
f'git rev-list --max-count=1 --abbrev-commit --skip=# {commit_id}'.split()).decode('utf-8').strip() f'git rev-list --max-count=1 --abbrev-commit --skip=# {commit_id}'.split()).decode('utf-8').strip()

View File

@ -1,5 +1,21 @@
A message from us at KittyPatch
===============================
KittyPatch was created as a home for useful features that are unavailable
in the kitty main branch. To this end, we do not accept donations directly.
If you wish to support KittyPatch: share your ideas and spread the word.
If you still wish to donate, please `support the Free Software Foundation
<https://my.fsf.org/donate>`.
A message from the maintainer of Kitty
======================================
Support kitty development ❤️ Support kitty development ❤️
============================== ==============================
>>>>>>> upstream/master
My goal with |kitty| is to move the stagnant terminal ecosystem forward. To that My goal with |kitty| is to move the stagnant terminal ecosystem forward. To that
end kitty has many foundational features, such as: :doc:`image support end kitty has many foundational features, such as: :doc:`image support

View File

@ -3,6 +3,7 @@
#define {WHICH_PROGRAM} #define {WHICH_PROGRAM}
#define NOT_TRANSPARENT #define NOT_TRANSPARENT
#define BOLD_SHIFT {BOLD_SHIFT}
#define DECORATION_SHIFT {DECORATION_SHIFT} #define DECORATION_SHIFT {DECORATION_SHIFT}
#define REVERSE_SHIFT {REVERSE_SHIFT} #define REVERSE_SHIFT {REVERSE_SHIFT}
#define STRIKE_SHIFT {STRIKE_SHIFT} #define STRIKE_SHIFT {STRIKE_SHIFT}
@ -17,6 +18,7 @@ layout(std140) uniform CellRenderData {
float xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_fg, use_cell_for_selection_bg; float xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_fg, use_cell_for_selection_bg;
uint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted; uint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted;
uint bold_is_bright;
uint xnum, ynum, cursor_fg_sprite_idx; uint xnum, ynum, cursor_fg_sprite_idx;
float cursor_x, cursor_y, cursor_w; float cursor_x, cursor_y, cursor_w;
@ -93,6 +95,22 @@ vec3 color_to_vec(uint c) {
return vec3(gamma_lut[r], gamma_lut[g], gamma_lut[b]); return vec3(gamma_lut[r], gamma_lut[g], gamma_lut[b]);
} }
uint byte_to_bool(uint n) {
uint n1 = (n >> 1) | n;
uint n2 = (n1 >> 2) | n1;
uint n3 = (n2 >> 4) | n2;
return n3 & 1u;
}
uint brighten_color(uint c, uint is_bold) {
uint table_idx = (c >> 8) & 0xFFu;
uint is_table_color = c & 1u;
uint is_rgb_color = byte_to_bool(c & 0xFEu);
uint is_8bit_color = byte_to_bool(table_idx & 0xF8u);
uint should_brighten = bold_is_bright * is_bold * (1u >> (is_rgb_color + is_8bit_color)) * is_table_color;
return c | (0x800u * should_brighten);
}
uint resolve_color(uint c, uint defval) { uint resolve_color(uint c, uint defval) {
// Convert a cell color to an actual color based on the color table // Convert a cell color to an actual color based on the color table
int t = int(c & BYTE_MASK); int t = int(c & BYTE_MASK);
@ -161,6 +179,7 @@ void main() {
// set cell color indices {{{ // set cell color indices {{{
uvec2 default_colors = uvec2(default_fg, default_bg); uvec2 default_colors = uvec2(default_fg, default_bg);
uint text_attrs = sprite_coords[3]; uint text_attrs = sprite_coords[3];
uint is_bold = ((text_attrs >> BOLD_SHIFT) & ONE);
uint is_reversed = ((text_attrs >> REVERSE_SHIFT) & ONE); uint is_reversed = ((text_attrs >> REVERSE_SHIFT) & ONE);
uint is_inverted = is_reversed + inverted; uint is_inverted = is_reversed + inverted;
int fg_index = fg_index_map[is_inverted]; int fg_index = fg_index_map[is_inverted];
@ -170,10 +189,10 @@ void main() {
float cell_has_block_cursor = cell_has_cursor * is_block_cursor; float cell_has_block_cursor = cell_has_cursor * is_block_cursor;
int mark = int(text_attrs >> MARK_SHIFT) & MARK_MASK; int mark = int(text_attrs >> MARK_SHIFT) & MARK_MASK;
uint has_mark = uint(step(1, float(mark))); uint has_mark = uint(step(1, float(mark)));
uint bg_as_uint = resolve_color(colors[bg_index], default_colors[bg_index]); uint bg_as_uint = resolve_color(brighten_color(colors[bg_index], is_bold), default_colors[bg_index]);
bg_as_uint = has_mark * color_table[NUM_COLORS + mark] + (ONE - has_mark) * bg_as_uint; bg_as_uint = has_mark * color_table[NUM_COLORS + mark] + (ONE - has_mark) * bg_as_uint;
vec3 bg = color_to_vec(bg_as_uint); vec3 bg = color_to_vec(bg_as_uint);
uint fg_as_uint = resolve_color(colors[fg_index], default_colors[fg_index]); uint fg_as_uint = resolve_color(brighten_color(colors[fg_index], is_bold), default_colors[fg_index]);
// }}} // }}}
// Foreground {{{ // Foreground {{{

View File

@ -265,6 +265,7 @@ CELL_FG_PROGRAM: int
CELL_PROGRAM: int CELL_PROGRAM: int
CELL_SPECIAL_PROGRAM: int CELL_SPECIAL_PROGRAM: int
CSI: int CSI: int
BOLD: int
DCS: int DCS: int
DECORATION: int DECORATION: int
DIM: int DIM: int

View File

@ -1328,6 +1328,10 @@ color is chosen to match the background color of the neighboring tab.
) )
egr() # }}} egr() # }}}
opt('bold_is_bright', 'no',
option_type='to_bool', ctype='bool',
long_text='Display bold text with bright colors'
)
# colors {{{ # colors {{{
agr('colors', 'Color scheme') agr('colors', 'Color scheme')

View File

@ -100,6 +100,9 @@ class Parser:
def bold_font(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: def bold_font(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['bold_font'] = str(val) ans['bold_font'] = str(val)
def bold_is_bright(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['bold_is_bright'] = to_bool(val)
def bold_italic_font(self, val: str, ans: typing.Dict[str, typing.Any]) -> None: def bold_italic_font(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
ans['bold_italic_font'] = str(val) ans['bold_italic_font'] = str(val)

View File

@ -837,6 +837,19 @@ convert_from_opts_dim_opacity(PyObject *py_opts, Options *opts) {
Py_DECREF(ret); Py_DECREF(ret);
} }
static void
convert_from_python_bold_is_bright(PyObject *val, Options *opts) {
opts->bold_is_bright = PyObject_IsTrue(val);
}
static void
convert_from_opts_bold_is_bright(PyObject *py_opts, Options *opts) {
PyObject *ret = PyObject_GetAttrString(py_opts, "bold_is_bright");
if (ret == NULL) return;
convert_from_python_bold_is_bright(ret, opts);
Py_DECREF(ret);
}
static void static void
convert_from_python_mark1_foreground(PyObject *val, Options *opts) { convert_from_python_mark1_foreground(PyObject *val, Options *opts) {
opts->mark1_foreground = color_as_int(val); opts->mark1_foreground = color_as_int(val);
@ -1188,6 +1201,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_dim_opacity(py_opts, opts); convert_from_opts_dim_opacity(py_opts, opts);
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_bold_is_bright(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_mark1_foreground(py_opts, opts); convert_from_opts_mark1_foreground(py_opts, opts);
if (PyErr_Occurred()) return false; if (PyErr_Occurred()) return false;
convert_from_opts_mark1_background(py_opts, opts); convert_from_opts_mark1_background(py_opts, opts);

View File

@ -71,6 +71,7 @@ option_names = ( # {{{
'bell_on_tab', 'bell_on_tab',
'bell_path', 'bell_path',
'bold_font', 'bold_font',
'bold_is_bright',
'bold_italic_font', 'bold_italic_font',
'box_drawing_scale', 'box_drawing_scale',
'clear_all_mouse_actions', 'clear_all_mouse_actions',
@ -490,6 +491,7 @@ class Options:
bell_on_tab: str = '🔔 ' bell_on_tab: str = '🔔 '
bell_path: typing.Optional[str] = None bell_path: typing.Optional[str] = None
bold_font: str = 'auto' bold_font: str = 'auto'
bold_is_bright: bool = False
bold_italic_font: str = 'auto' bold_italic_font: str = 'auto'
box_drawing_scale: typing.Tuple[float, float, float, float] = (0.001, 1.0, 1.5, 2.0) box_drawing_scale: typing.Tuple[float, float, float, float] = (0.001, 1.0, 1.5, 2.0)
clear_all_mouse_actions: bool = False clear_all_mouse_actions: bool = False

View File

@ -303,6 +303,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_color, use_cell_for_selection_bg; GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_color, use_cell_for_selection_bg;
GLuint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted; GLuint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted;
GLuint bold_is_bright;
GLuint xnum, ynum, cursor_fg_sprite_idx; GLuint xnum, ynum, cursor_fg_sprite_idx;
GLfloat cursor_x, cursor_y, cursor_w; GLfloat cursor_x, cursor_y, cursor_w;
@ -374,6 +375,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
rd->sprite_dx = 1.0f / (float)x; rd->sprite_dy = 1.0f / (float)y; rd->sprite_dx = 1.0f / (float)x; rd->sprite_dy = 1.0f / (float)y;
rd->inverted = inverted ? 1 : 0; rd->inverted = inverted ? 1 : 0;
rd->background_opacity = os_window->is_semi_transparent ? os_window->background_opacity : 1.0f; rd->background_opacity = os_window->is_semi_transparent ? os_window->background_opacity : 1.0f;
rd->bold_is_bright = OPT(bold_is_bright) ? 1 : 0;
#undef COLOR #undef COLOR
rd->url_color = OPT(url_color); rd->url_style = OPT(url_style); rd->url_color = OPT(url_color); rd->url_style = OPT(url_style);

View File

@ -1130,6 +1130,7 @@ PYWRAP1(patch_global_colors) {
P(background); P(url_color); P(background); P(url_color);
P(mark1_background); P(mark1_foreground); P(mark2_background); P(mark2_foreground); P(mark1_background); P(mark1_foreground); P(mark2_background); P(mark2_foreground);
P(mark3_background); P(mark3_foreground); P(mark3_background); P(mark3_foreground);
P(bold_is_bright);
} }
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@ -39,6 +39,7 @@ typedef struct {
char_type *select_by_word_characters_forward; char_type *select_by_word_characters_forward;
color_type url_color, background, foreground, active_border_color, inactive_border_color, bell_border_color, tab_bar_background, tab_bar_margin_color; color_type url_color, background, foreground, active_border_color, inactive_border_color, bell_border_color, tab_bar_background, tab_bar_margin_color;
color_type mark1_foreground, mark1_background, mark2_foreground, mark2_background, mark3_foreground, mark3_background; color_type mark1_foreground, mark1_background, mark2_foreground, mark2_background, mark3_foreground, mark3_background;
bool bold_is_bright;
monotonic_t repaint_delay, input_delay; monotonic_t repaint_delay, input_delay;
bool focus_follows_mouse; bool focus_follows_mouse;
unsigned int hide_window_decorations; unsigned int hide_window_decorations;

View File

@ -49,6 +49,7 @@ from .fast_data_types import (
CELL_PROGRAM, CELL_PROGRAM,
CELL_SPECIAL_PROGRAM, CELL_SPECIAL_PROGRAM,
CURSOR_BEAM, CURSOR_BEAM,
BOLD,
CURSOR_BLOCK, CURSOR_BLOCK,
CURSOR_UNDERLINE, CURSOR_UNDERLINE,
DCS, DCS,
@ -392,6 +393,7 @@ class LoadShaderPrograms:
STRIKE_SHIFT=STRIKETHROUGH, STRIKE_SHIFT=STRIKETHROUGH,
DIM_SHIFT=DIM, DIM_SHIFT=DIM,
DECORATION_SHIFT=DECORATION, DECORATION_SHIFT=DECORATION,
BOLD_SHIFT=BOLD,
MARK_SHIFT=MARK, MARK_SHIFT=MARK,
MARK_MASK=MARK_MASK, MARK_MASK=MARK_MASK,
DECORATION_MASK=DECORATION_MASK, DECORATION_MASK=DECORATION_MASK,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -25,7 +25,7 @@ from urllib.parse import urlencode, urlparse
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
docs_dir = os.path.abspath('docs') docs_dir = os.path.abspath('docs')
publish_dir = os.path.abspath(os.path.join('..', 'kovidgoyal.github.io', 'kitty')) publish_dir = os.path.abspath(os.path.join('..', 'kittypatch.github.io', 'kitty'))
building_nightly = False building_nightly = False
with open('kitty/constants.py') as f: with open('kitty/constants.py') as f:
raw = f.read() raw = f.read()
@ -101,7 +101,7 @@ def run_man(args: Any) -> None:
def run_html(args: Any) -> None: def run_html(args: Any) -> None:
call('make FAIL_WARN=1 "OPTS=-D analytics_id=G-XTJK3R7GF2" dirhtml', cwd=docs_dir) call('make FAIL_WARN=1 "OPTS=-D analytics_id=G-XXXXXXXXXX" dirhtml', cwd=docs_dir)
add_old_redirects('docs/_build/dirhtml') add_old_redirects('docs/_build/dirhtml')