Merge "Show Line Length Indicator at 72 Characters for Commit Messages"
diff --git a/web/element/codemirror-element.ts b/web/element/codemirror-element.ts
index 98dd811..206d7fd 100644
--- a/web/element/codemirror-element.ts
+++ b/web/element/codemirror-element.ts
@@ -113,13 +113,17 @@
this.darkMode
),
EditorView.updateListener.of(update => {
- if (this.prefs?.line_length) {
+ // Set ruler width to 72 for commit messages,
+ // as this is the recommended line length for git commit messages.
+ if (this.fileType?.includes('x-gerrit-commit-message')) {
+ updateRulerWidth(72, update.view.defaultCharacterWidth, true);
+ } else if (this.prefs?.line_length) {
// This is required to be in the setTimeout() to ensure the
// line is set as correctly as possible.
updateRulerWidth(
- this.prefs.line_length,
- update.view.defaultCharacterWidth,
- true
+ this.prefs.line_length,
+ update.view.defaultCharacterWidth,
+ true
);
}