[gnome-text-editor] printoperation: disable syntax highlighting



commit 34dde11e5010115a836f33f30020d7775d607d91
Author: Christian Hergert <chergert redhat com>
Date:   Sun Dec 19 17:09:29 2021 -0800

    printoperation: disable syntax highlighting
    
    Until we have a way to ensure this will look good printed, we need to
    disable syntax highlighting. We might want to look into creating a
    style scheme just for print that we can use instead of the EditorDocument
    buffer.

 src/editor-print-operation.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-print-operation.c b/src/editor-print-operation.c
index 2588622..d7c1a73 100644
--- a/src/editor-print-operation.c
+++ b/src/editor-print-operation.c
@@ -117,9 +117,19 @@ editor_print_operation_begin_print (GtkPrintOperation *operation,
   buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->view)));
 
   tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (self->view));
-  syntax_hl = gtk_source_buffer_get_highlight_syntax (buffer);
   show_line_numbers = gtk_source_view_get_show_line_numbers (self->view);
 
+#if 0
+  syntax_hl = gtk_source_buffer_get_highlight_syntax (buffer);
+#else
+  /* Currently, we don't have a way to ensure that the syntax will look
+   * good when printing, so we always turn it off. To do that, we might
+   * want to add a new style scheme that is print-focused and create a
+   * duplicate buffer with the same content.
+   */
+  syntax_hl = FALSE;
+#endif
+
   self->compositor = g_object_new (GTK_SOURCE_TYPE_PRINT_COMPOSITOR,
                                    "buffer", buffer,
                                    "tab-width", tab_width,


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