From 71bd7094d14ebd403c2c21b5aa5b4b86543cf8b2 Mon Sep 17 00:00:00 2001 From: Dipanshu Singh Date: Mon, 11 May 2026 21:02:36 +0530 Subject: [PATCH 1/2] Fix Symbol Pane not updating on external file reversion (#1715) Trigger symbol refresh when the document is reloaded externally (e.g., via git reset) or reverted, rather than relying solely on internal buffer changes. --- src/Services/Document.vala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Services/Document.vala b/src/Services/Document.vala index cc32ecf76..7c110ea7f 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -818,6 +818,10 @@ namespace Scratch.Services { public void revert () { this.source_view.set_text (original_content, false); check_undoable_actions (); + + if (outline != null) { + outline.parse_symbols (); + } } // Get text @@ -981,6 +985,10 @@ namespace Scratch.Services { set_saved_status (true); source_view.buffer.set_modified (false); loaded = true; + + if (outline != null) { + outline.parse_symbols (); + } return; } @@ -1102,6 +1110,10 @@ namespace Scratch.Services { last_save_content = source_view.buffer.text; set_saved_status (true); locked = false; + + if (outline != null) { + outline.parse_symbols (); + } break; case 1: // Overwrite // Force save, unlock to allow saving to same location From 91de616726aab8978801439a5125694b42409a05 Mon Sep 17 00:00:00 2001 From: Dipanshu Singh Date: Wed, 20 May 2026 15:40:11 +0530 Subject: [PATCH 2/2] Preferences: Exclude Markdown and YAML from whitespace stripping This fixes the trailing whitespace stripping behavior on save: - Excludes Markdown and YAML files where trailing whitespace can be semantically meaningful. - Adds description/subtext in the settings switch to clarify that it only applies to syntax-highlighted files, except Markdown and YAML. Fixes #1698 --- src/Dialogs/PreferencesDialog.vala | 6 +++++- src/Services/Document.vala | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Dialogs/PreferencesDialog.vala b/src/Dialogs/PreferencesDialog.vala index ca081e591..c30da52d4 100644 --- a/src/Dialogs/PreferencesDialog.vala +++ b/src/Dialogs/PreferencesDialog.vala @@ -22,7 +22,11 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog { var general_box = new Gtk.Box (VERTICAL, 12); general_box.add (new Granite.HeaderLabel (_("General"))); general_box.add (new SettingSwitch (_("Save files when changed"), "autosave")); - general_box.add (new SettingSwitch (_("Strip trailing whitespace on save"), "strip-trailing-on-save")); + general_box.add (new SettingSwitch ( + _("Strip trailing whitespace on save"), + "strip-trailing-on-save", + _("For syntax highlighted files, except Markdown and YAML") + )); general_box.add (new SettingSwitch ( _("Smart cut/copy lines"), "smart-cut-copy", diff --git a/src/Services/Document.vala b/src/Services/Document.vala index 7c110ea7f..0b5ddbe1c 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -1319,6 +1319,11 @@ namespace Scratch.Services { return; } + var lang_id = source_view.language.id; + if (lang_id == "markdown" || lang_id == "yaml") { + return; + } + var source_buffer = (Gtk.SourceBuffer)source_view.buffer; Gtk.TextIter iter;