mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 11:11:47 +02:00
Cleanup previous PR
This commit is contained in:
@@ -70,7 +70,7 @@ words "HELLO WORLD" display in kitty as "WORLD HELLO", and if you try to select
|
||||
a substring of an RTL-shaped string, you will get the character that would be
|
||||
there had the the string been LTR. For example, assuming the Hebrew word
|
||||
ירושלים, selecting the character that on the screen appears to be ם actually
|
||||
writes into the selection buffer the character י. kitty's default behavior is
|
||||
writes into the selection buffer the character י. kitty's default behavior is
|
||||
useful in conjunction with a filter to reverse the word order, however, if you
|
||||
wish to manipulate RTL glyphs, it can be very challenging to work with, so this
|
||||
option is provided to turn it off. Furthermore, this option can be used with the
|
||||
@@ -269,15 +269,15 @@ Then adjust the second parameter until it looks good. Then switch to a light the
|
||||
and adjust the first parameter until the perceived thickness matches the dark theme.
|
||||
''')
|
||||
|
||||
opt('text_fg_override_threshold', 0,
|
||||
ctype='!text_fg_override_threshold',
|
||||
long_text='''
|
||||
The minimum accepted difference in luminance between the foreground and background
|
||||
color, below which kitty will override the foreground color. It is percentage
|
||||
ranging from :code:`0` to :code:`100`. If the difference in luminance of the
|
||||
foreground and background is below this threshold, the foreground color will be set
|
||||
to white if the background is dark or black if the background is light. The default
|
||||
value is :code:`0`.
|
||||
opt('text_fg_override_threshold', 0, option_type='float', ctype='percent', long_text='''
|
||||
The minimum accepted difference in luminance between the foreground and background
|
||||
color, below which kitty will override the foreground color. It is percentage
|
||||
ranging from :code:`0` to :code:`100`. If the difference in luminance of the
|
||||
foreground and background is below this threshold, the foreground color will be set
|
||||
to white if the background is dark or black if the background is light. The default
|
||||
value is :code:`0`, which means no overriding is performed. Useful when working with applications
|
||||
that use colors that do not contrast well with your preferred color scheme. Changing this option
|
||||
from zero to a non-zero value or vice versa requires a restart of kitty.
|
||||
''')
|
||||
|
||||
egr() # }}}
|
||||
|
||||
2
kitty/options/parse.py
generated
2
kitty/options/parse.py
generated
@@ -1285,7 +1285,7 @@ class Parser:
|
||||
ans['text_composition_strategy'] = str(val)
|
||||
|
||||
def text_fg_override_threshold(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['text_fg_override_threshold'] = str(val)
|
||||
ans['text_fg_override_threshold'] = float(val)
|
||||
|
||||
def touch_scroll_multiplier(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['touch_scroll_multiplier'] = float(val)
|
||||
|
||||
2
kitty/options/to-c-generated.h
generated
2
kitty/options/to-c-generated.h
generated
@@ -72,7 +72,7 @@ convert_from_opts_text_composition_strategy(PyObject *py_opts, Options *opts) {
|
||||
|
||||
static void
|
||||
convert_from_python_text_fg_override_threshold(PyObject *val, Options *opts) {
|
||||
text_fg_override_threshold(val, opts);
|
||||
opts->text_fg_override_threshold = percent(val);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -14,6 +14,13 @@ PyFloat_AsFloat(PyObject *o) {
|
||||
return (float)PyFloat_AsDouble(o);
|
||||
}
|
||||
|
||||
static inline float
|
||||
percent(PyObject *o) {
|
||||
float ans = PyFloat_AsFloat(o);
|
||||
return MAX(0.f, MIN(ans, 100.f)) * 0.01f;
|
||||
}
|
||||
|
||||
|
||||
static inline color_type
|
||||
color_as_int(PyObject *color) {
|
||||
if (!PyObject_TypeCheck(color, &Color_Type)) { PyErr_SetString(PyExc_TypeError, "Not a Color object"); return 0; }
|
||||
@@ -211,18 +218,6 @@ text_composition_strategy(PyObject *val, Options *opts) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
text_fg_override_threshold(PyObject *val, Options *opts) {
|
||||
if (!PyUnicode_Check(val)) { PyErr_SetString(PyExc_TypeError, "text_fg_override_threshold must be a string"); return; }
|
||||
opts->text_fg_override_threshold = 0.f;
|
||||
|
||||
DECREF_AFTER_FUNCTION PyObject *text_fg_override_threshold = PyFloat_FromString(val);
|
||||
if (PyErr_Occurred()) return;
|
||||
opts->text_fg_override_threshold = MAX(0.f, PyFloat_AsFloat(text_fg_override_threshold));
|
||||
opts->text_fg_override_threshold = MIN(100.f, PyFloat_AsFloat(text_fg_override_threshold));
|
||||
|
||||
}
|
||||
|
||||
static char_type*
|
||||
list_of_chars(PyObject *chars) {
|
||||
if (!PyUnicode_Check(chars)) { PyErr_SetString(PyExc_TypeError, "list_of_chars must be a string"); return NULL; }
|
||||
|
||||
2
kitty/options/types.py
generated
2
kitty/options/types.py
generated
@@ -599,7 +599,7 @@ class Options:
|
||||
tab_title_template: str = '{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}'
|
||||
term: str = 'xterm-kitty'
|
||||
text_composition_strategy: str = 'platform'
|
||||
text_fg_override_threshold: str = '0'
|
||||
text_fg_override_threshold: float = 0.0
|
||||
touch_scroll_multiplier: float = 1.0
|
||||
undercurl_style: choices_for_undercurl_style = 'thin-sparse'
|
||||
update_check_interval: float = 24.0
|
||||
|
||||
Reference in New Issue
Block a user