mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
Cleanup previous PR
This commit is contained in:
parent
5babab18a0
commit
68649d78df
8 changed files with 38 additions and 39 deletions
|
|
@ -55,6 +55,8 @@ Detailed list of changes
|
|||
|
||||
- A new option, :opt:`window_logo_scale` to specify how window logo are scaled with respect to the size of the window containing the logo (:pull:`7534`)
|
||||
|
||||
- A new option, :opt:`cursor_shape_unfocused` to specify the shape of the text cursor in unfocused OS windows (:pull:`7544`)
|
||||
|
||||
0.35.1 [2024-05-31]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -330,6 +330,12 @@ cursor shape to :code:`beam` at shell prompts. You can avoid this by setting
|
|||
'''
|
||||
)
|
||||
|
||||
opt('cursor_shape_unfocused', 'hollow', option_type='to_cursor_unfocused_shape', ctype='int', long_text='''
|
||||
Defines the text cursor shape when the OS window is not focused. The unfocused
|
||||
cursor shape can be one of :code:`block`, :code:`beam`, :code:`underline`,
|
||||
:code:`hollow`.
|
||||
''')
|
||||
|
||||
opt('cursor_beam_thickness', '1.5',
|
||||
option_type='positive_float', ctype='float',
|
||||
long_text='The thickness of the beam cursor (in pts).'
|
||||
|
|
@ -357,14 +363,6 @@ inactivity. Set to zero to never stop blinking.
|
|||
'''
|
||||
)
|
||||
|
||||
opt('cursor_unfocused_shape', 'hollow',
|
||||
option_type='to_cursor_unfocused_shape', ctype='int',
|
||||
long_text='''
|
||||
Defines the cursor shape when the terminal window is not focused. The unfocused
|
||||
cursor shape can be one of :code:`block`, :code:`beam`, :code:`underline`,
|
||||
:code:`hollow`.
|
||||
'''
|
||||
)
|
||||
egr() # }}}
|
||||
|
||||
|
||||
|
|
|
|||
6
kitty/options/parse.py
generated
6
kitty/options/parse.py
generated
|
|
@ -920,6 +920,9 @@ class Parser:
|
|||
def cursor_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['cursor_shape'] = to_cursor_shape(val)
|
||||
|
||||
def cursor_shape_unfocused(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['cursor_shape_unfocused'] = to_cursor_unfocused_shape(val)
|
||||
|
||||
def cursor_stop_blinking_after(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['cursor_stop_blinking_after'] = positive_float(val)
|
||||
|
||||
|
|
@ -929,9 +932,6 @@ class Parser:
|
|||
def cursor_underline_thickness(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['cursor_underline_thickness'] = positive_float(val)
|
||||
|
||||
def cursor_unfocused_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['cursor_unfocused_shape'] = to_cursor_unfocused_shape(val)
|
||||
|
||||
def default_pointer_shape(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
val = val.lower()
|
||||
if val not in self.choices_for_default_pointer_shape:
|
||||
|
|
|
|||
30
kitty/options/to-c-generated.h
generated
30
kitty/options/to-c-generated.h
generated
|
|
@ -83,6 +83,19 @@ convert_from_opts_cursor_shape(PyObject *py_opts, Options *opts) {
|
|||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_cursor_shape_unfocused(PyObject *val, Options *opts) {
|
||||
opts->cursor_shape_unfocused = PyLong_AsLong(val);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_opts_cursor_shape_unfocused(PyObject *py_opts, Options *opts) {
|
||||
PyObject *ret = PyObject_GetAttrString(py_opts, "cursor_shape_unfocused");
|
||||
if (ret == NULL) return;
|
||||
convert_from_python_cursor_shape_unfocused(ret, opts);
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_cursor_beam_thickness(PyObject *val, Options *opts) {
|
||||
opts->cursor_beam_thickness = PyFloat_AsFloat(val);
|
||||
|
|
@ -135,19 +148,6 @@ convert_from_opts_cursor_stop_blinking_after(PyObject *py_opts, Options *opts) {
|
|||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_cursor_unfocused_shape(PyObject *val, Options *opts) {
|
||||
opts->cursor_unfocused_shape = PyLong_AsLong(val);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_opts_cursor_unfocused_shape(PyObject *py_opts, Options *opts) {
|
||||
PyObject *ret = PyObject_GetAttrString(py_opts, "cursor_unfocused_shape");
|
||||
if (ret == NULL) return;
|
||||
convert_from_python_cursor_unfocused_shape(ret, opts);
|
||||
Py_DECREF(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_from_python_scrollback_indicator_opacity(PyObject *val, Options *opts) {
|
||||
opts->scrollback_indicator_opacity = PyFloat_AsFloat(val);
|
||||
|
|
@ -1176,6 +1176,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_shape(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_shape_unfocused(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_beam_thickness(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_underline_thickness(py_opts, opts);
|
||||
|
|
@ -1184,8 +1186,6 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_stop_blinking_after(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_cursor_unfocused_shape(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_scrollback_indicator_opacity(py_opts, opts);
|
||||
if (PyErr_Occurred()) return false;
|
||||
convert_from_opts_scrollback_pager_history_size(py_opts, opts);
|
||||
|
|
|
|||
4
kitty/options/types.py
generated
4
kitty/options/types.py
generated
|
|
@ -330,10 +330,10 @@ option_names = ( # {{{
|
|||
'cursor_beam_thickness',
|
||||
'cursor_blink_interval',
|
||||
'cursor_shape',
|
||||
'cursor_shape_unfocused',
|
||||
'cursor_stop_blinking_after',
|
||||
'cursor_text_color',
|
||||
'cursor_underline_thickness',
|
||||
'cursor_unfocused_shape',
|
||||
'default_pointer_shape',
|
||||
'detect_urls',
|
||||
'dim_opacity',
|
||||
|
|
@ -504,10 +504,10 @@ class Options:
|
|||
cursor_beam_thickness: float = 1.5
|
||||
cursor_blink_interval: float = -1.0
|
||||
cursor_shape: int = 1
|
||||
cursor_shape_unfocused: int = 0
|
||||
cursor_stop_blinking_after: float = 15.0
|
||||
cursor_text_color: typing.Optional[kitty.fast_data_types.Color] = Color(17, 17, 17)
|
||||
cursor_underline_thickness: float = 2.0
|
||||
cursor_unfocused_shape: int = 0
|
||||
default_pointer_shape: choices_for_default_pointer_shape = 'beam'
|
||||
detect_urls: bool = True
|
||||
dim_opacity: float = 0.4
|
||||
|
|
|
|||
|
|
@ -524,6 +524,13 @@ cshapes = {
|
|||
'beam': CURSOR_BEAM,
|
||||
'underline': CURSOR_UNDERLINE
|
||||
}
|
||||
cshapes_unfocused = {
|
||||
'block': CURSOR_BLOCK,
|
||||
'beam': CURSOR_BEAM,
|
||||
'underline': CURSOR_UNDERLINE,
|
||||
'hollow': NO_CURSOR_SHAPE
|
||||
}
|
||||
|
||||
|
||||
def to_cursor_shape(x: str) -> int:
|
||||
try:
|
||||
|
|
@ -536,19 +543,12 @@ def to_cursor_shape(x: str) -> int:
|
|||
)
|
||||
|
||||
|
||||
cshapes_unfocused = {
|
||||
'block': CURSOR_BLOCK,
|
||||
'beam': CURSOR_BEAM,
|
||||
'underline': CURSOR_UNDERLINE,
|
||||
'hollow': NO_CURSOR_SHAPE
|
||||
}
|
||||
|
||||
def to_cursor_unfocused_shape(x: str) -> int:
|
||||
try:
|
||||
return cshapes_unfocused[x.lower()]
|
||||
except KeyError:
|
||||
raise ValueError(
|
||||
'Invalid inactive cursor shape: {} allowed values are {}'.format(
|
||||
'Invalid unfocused cursor shape: {} allowed values are {}'.format(
|
||||
x, ', '.join(cshapes_unfocused)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
|
|||
rd->cursor_fg_sprite_idx = UNDERLINE_IDX; break;
|
||||
}
|
||||
} else {
|
||||
switch(OPT(cursor_unfocused_shape)) {
|
||||
switch(OPT(cursor_shape_unfocused)) {
|
||||
default:
|
||||
rd->cursor_fg_sprite_idx = UNFOCUSED_IDX; break;
|
||||
case CURSOR_BEAM:
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ typedef struct {
|
|||
double wheel_scroll_multiplier, touch_scroll_multiplier;
|
||||
int wheel_scroll_min_lines;
|
||||
bool enable_audio_bell;
|
||||
CursorShape cursor_shape;
|
||||
CursorShape cursor_unfocused_shape;
|
||||
CursorShape cursor_shape, cursor_shape_unfocused;
|
||||
float cursor_beam_thickness;
|
||||
float cursor_underline_thickness;
|
||||
unsigned int url_style;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue