Skip to content

Commit 18bb8ba

Browse files
Dipanshusinghhjeremypwzeebok
authored
Fix 1698 (#1720)
* 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. * 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 * Preferences: Simplify whitespace stripping setting subtext --------- Co-authored-by: Jeremy Wootten <jeremywootten@gmail.com> Co-authored-by: Ryan Kornheisl <ryan@skarva.tech>
1 parent c65fc64 commit 18bb8ba

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Dialogs/PreferencesDialog.vala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog {
2222
var general_box = new Gtk.Box (VERTICAL, 12);
2323
general_box.add (new Granite.HeaderLabel (_("General")));
2424
general_box.add (new SettingSwitch (_("Save files when changed"), "autosave"));
25-
general_box.add (new SettingSwitch (_("Strip trailing whitespace on save"), "strip-trailing-on-save"));
25+
general_box.add (new SettingSwitch (
26+
_("Strip trailing whitespace on save"),
27+
"strip-trailing-on-save",
28+
_("Except Plain Text, Markdown and YAML")
29+
));
2630
general_box.add (new SettingSwitch (
2731
_("Smart cut/copy lines"),
2832
"smart-cut-copy",

src/Services/Document.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,11 @@ namespace Scratch.Services {
13191319
return;
13201320
}
13211321

1322+
var lang_id = source_view.language.id;
1323+
if (lang_id == "markdown" || lang_id == "yaml") {
1324+
return;
1325+
}
1326+
13221327
var source_buffer = (Gtk.SourceBuffer)source_view.buffer;
13231328
Gtk.TextIter iter;
13241329

0 commit comments

Comments
 (0)