When reloading config also reload all GPU data

Fixes some config options such as text_composition_strategy not being
reloaded.
This commit is contained in:
Kovid Goyal 2023-03-01 11:13:12 +05:30
parent 0616f9e077
commit bf79940a13
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 15 additions and 2 deletions

View File

@ -2371,7 +2371,7 @@ class Boss:
# Update colors # Update colors
for w in self.all_windows: for w in self.all_windows:
self.default_bg_changed_for(w.id) self.default_bg_changed_for(w.id)
w.refresh() w.refresh(reload_all_gpu_data=True)
self.prewarm.reload_kitty_config() self.prewarm.reload_kitty_config()
@ac('misc', ''' @ac('misc', '''

View File

@ -1105,6 +1105,9 @@ class Screen:
def mark_as_dirty(self) -> None: def mark_as_dirty(self) -> None:
pass pass
def reload_all_gpu_data(self) -> None:
pass
def resize(self, width: int, height: int) -> None: def resize(self, width: int, height: int) -> None:
pass pass

View File

@ -3789,6 +3789,13 @@ mark_as_dirty(Screen *self, PyObject *a UNUSED) {
Py_RETURN_NONE; Py_RETURN_NONE;
} }
static PyObject*
reload_all_gpu_data(Screen *self, PyObject *a UNUSED) {
self->reload_all_gpu_data = true;
Py_RETURN_NONE;
}
static PyObject* static PyObject*
current_char_width(Screen *self, PyObject *a UNUSED) { current_char_width(Screen *self, PyObject *a UNUSED) {
#define current_char_width_doc "The width of the character under the cursor" #define current_char_width_doc "The width of the character under the cursor"
@ -4154,6 +4161,7 @@ static PyMethodDef methods[] = {
{"clear_selection", (PyCFunction)clear_selection_, METH_NOARGS, ""}, {"clear_selection", (PyCFunction)clear_selection_, METH_NOARGS, ""},
MND(reverse_index, METH_NOARGS) MND(reverse_index, METH_NOARGS)
MND(mark_as_dirty, METH_NOARGS) MND(mark_as_dirty, METH_NOARGS)
MND(reload_all_gpu_data, METH_NOARGS)
MND(resize, METH_VARARGS) MND(resize, METH_VARARGS)
MND(ignore_bells_for, METH_VARARGS) MND(ignore_bells_for, METH_VARARGS)
MND(set_margins, METH_VARARGS) MND(set_margins, METH_VARARGS)

View File

@ -816,8 +816,10 @@ class Window:
if val: if val:
self.refresh() self.refresh()
def refresh(self) -> None: def refresh(self, reload_all_gpu_data: bool = False) -> None:
self.screen.mark_as_dirty() self.screen.mark_as_dirty()
if reload_all_gpu_data:
self.screen.reload_all_gpu_data()
wakeup_io_loop() wakeup_io_loop()
wakeup_main_loop() wakeup_main_loop()