Skip to content

Commit

Permalink
lapiz-window: Fix 'Use Spaces' CtkCheckMenuItem behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0w committed Aug 17, 2024
1 parent 5a35c6f commit 5f88ea8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lapiz/lapiz-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1863,13 +1863,24 @@ use_spaces_toggled (CtkCheckMenuItem *item,
LapizWindow *window)
{
LapizView *view;
static use_spaces_toggled_init = TRUE;

view = lapiz_window_get_active_view (window);

g_signal_handler_block (view, window->priv->spaces_instead_of_tabs_id);
ctk_source_view_set_insert_spaces_instead_of_tabs (
CTK_SOURCE_VIEW (view),
ctk_check_menu_item_get_active (item));

if (use_spaces_toggled_init) {
ctk_source_view_set_insert_spaces_instead_of_tabs (CTK_SOURCE_VIEW (view),
lapiz_prefs_manager_get_insert_spaces ());
ctk_check_menu_item_set_active (item, lapiz_prefs_manager_get_insert_spaces ());
use_spaces_toggled_init = FALSE;
}
else
{
ctk_source_view_set_insert_spaces_instead_of_tabs (CTK_SOURCE_VIEW (view),
ctk_check_menu_item_get_active (item));
}

g_signal_handler_unblock (view, window->priv->spaces_instead_of_tabs_id);
}

Expand Down

0 comments on commit 5f88ea8

Please sign in to comment.