[gnome-builder] plugins/retab: handle no-selection in buffer



commit 27b83c5820c46f2e8a960f54c2b64f4739e8bea6
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 15 14:20:34 2022 -0700

    plugins/retab: handle no-selection in buffer
    
    This just defaults to the entire buffer if there is no selection.

 src/plugins/retab/gbp-retab-editor-page-addin.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/retab/gbp-retab-editor-page-addin.c b/src/plugins/retab/gbp-retab-editor-page-addin.c
index 61c07e171..45a01e559 100644
--- a/src/plugins/retab/gbp-retab-editor-page-addin.c
+++ b/src/plugins/retab/gbp-retab-editor-page-addin.c
@@ -147,7 +147,9 @@ gbp_retab_editor_page_addin_action (GSimpleAction *action,
   if (!editable)
     return;
 
-  gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
+  if (!gtk_text_buffer_get_selection_bounds (buffer, &begin, &end))
+    gtk_text_buffer_get_bounds (buffer, &begin, &end);
+
   gtk_text_iter_order (&begin, &end);
 
   if (!gtk_text_iter_equal (&begin, &end) && gtk_text_iter_starts_line (&end))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]