diff --git a/.eslintignore b/.eslintignore index 7e8d61e..c98486f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ install/ flatpak/ node_modules/ repo/ +src/wordwrap.js diff --git a/.prettierignore b/.prettierignore index 7e8d61e..c98486f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,4 @@ install/ flatpak/ node_modules/ repo/ +src/wordwrap.js diff --git a/README.md b/README.md index 6ba41db..18a4084 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Thank you for your help! ```sh cd Commit -./re.sonny.Commit test/with-body/COMMIT_EDITMSG +./re.sonny.Commit --readonly test/with-body/COMMIT_EDITMSG ``` Make changes and hit `Ctrl+Shift+Q` on the Commit window to restart it. diff --git a/TODO.md b/TODO.md index 9d92bfd..1039795 100644 --- a/TODO.md +++ b/TODO.md @@ -15,3 +15,7 @@ 14. [ ] detect non imperative mood https://tekin.co.uk/2020/03/git-commit-verbose-mode +https://robertcooper.me/post/git-commit-messages +https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/ +https://wiki.gnome.org/Git/CommitMessages +https://cbea.ms/git-commit/ diff --git a/data/re.sonny.Commit.gschema.xml b/data/re.sonny.Commit.gschema.xml index f4d5d6b..0faa350 100644 --- a/data/re.sonny.Commit.gschema.xml +++ b/data/re.sonny.Commit.gschema.xml @@ -3,9 +3,16 @@ 50 - + Message title length hint + + + 75 + + Message body length wrap + + false Use dark mode diff --git a/data/re.sonny.Commit.metainfo.xml b/data/re.sonny.Commit.metainfo.xml index 5e43661..94ad5d2 100644 --- a/data/re.sonny.Commit.metainfo.xml +++ b/data/re.sonny.Commit.metainfo.xml @@ -25,16 +25,13 @@

Features:

diff --git a/po/re.sonny.Commit.pot b/po/re.sonny.Commit.pot index 8fcb68f..c0e1ad9 100644 --- a/po/re.sonny.Commit.pot +++ b/po/re.sonny.Commit.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: re.sonny.Commit\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-16 13:44+0100\n" +"POT-Creation-Date: 2022-03-17 21:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,11 +32,15 @@ msgstr "" msgid "git;mercurial;hg;scm;gnomit;komet;comet;" msgstr "" -#: data/re.sonny.Commit.gschema.xml:7 src/welcome.ui:33 +#: data/re.sonny.Commit.gschema.xml:7 msgid "Message title length hint" msgstr "" -#: data/re.sonny.Commit.gschema.xml:11 src/welcome.ui:52 +#: data/re.sonny.Commit.gschema.xml:13 +msgid "Message body length wrap" +msgstr "" + +#: data/re.sonny.Commit.gschema.xml:18 src/welcome.ui:69 msgid "Use dark mode" msgstr "" @@ -55,8 +59,8 @@ msgstr "" #: data/re.sonny.Commit.metainfo.xml:21 msgid "" "Commit will pop up automatically when you make a commit in one of your " -"projects. To save your commit message, press the Commit button or the _Ctrl" -"+Return_ key combination. To abort and dismiss Commit, press the Cancel " +"projects. To save your commit message, press the Commit button or the " +"_Ctrl+Return_ key combination. To abort and dismiss Commit, press the Cancel " "button or the _Escape_ key." msgstr "" @@ -65,196 +69,199 @@ msgid "Features:" msgstr "" #: data/re.sonny.Commit.metainfo.xml:28 -msgid "" -"Highlights overflow of title when it exceeds 50 characters (customizable)" +msgid "Highlights overflow of the commit title" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:32 -msgid "Inserts blank line between title and description" +#: data/re.sonny.Commit.metainfo.xml:29 +msgid "Automatically wraps the commit body" +msgstr "" + +#: data/re.sonny.Commit.metainfo.xml:30 +msgid "Inserts a blank line between title and body" msgstr "" #.
  • Spell checking
  • -#: data/re.sonny.Commit.metainfo.xml:34 +#: data/re.sonny.Commit.metainfo.xml:32 msgid "Comments are readonly and excluded from \"Select All\"" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:35 +#: data/re.sonny.Commit.metainfo.xml:33 msgid "Displays project folder and branch in window header" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:36 +#: data/re.sonny.Commit.metainfo.xml:34 msgid "Dark mode support" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:37 -msgid "Custom theme support" -msgstr "" - -#: data/re.sonny.Commit.metainfo.xml:38 +#: data/re.sonny.Commit.metainfo.xml:35 msgid "Keyboard navigation and shortcuts" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:39 +#: data/re.sonny.Commit.metainfo.xml:36 msgid "Undo and redo support" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:40 +#: data/re.sonny.Commit.metainfo.xml:37 msgid "Emoji picker" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:41 +#: data/re.sonny.Commit.metainfo.xml:38 msgid "" "Supports git commit messages, merge messages, tag messages, add -p messages, " "and rebase -i messages" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:45 data/re.sonny.Commit.metainfo.xml:101 +#: data/re.sonny.Commit.metainfo.xml:42 data/re.sonny.Commit.metainfo.xml:98 msgid "Auto capitalize the commit title" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:46 +#: data/re.sonny.Commit.metainfo.xml:43 msgid "Supports Mercurial commit messages" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:47 +#: data/re.sonny.Commit.metainfo.xml:44 msgid "Welcome window with settings and instructions" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:48 data/re.sonny.Commit.metainfo.xml:98 +#: data/re.sonny.Commit.metainfo.xml:45 data/re.sonny.Commit.metainfo.xml:95 msgid "Highlight syntax for Git, Mercurial and diffs" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:59 +#: data/re.sonny.Commit.metainfo.xml:56 msgid "Main window" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:65 +#: data/re.sonny.Commit.metainfo.xml:62 msgid "Main window - dark mode" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:71 +#: data/re.sonny.Commit.metainfo.xml:68 msgid "Emoji selector" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:77 +#: data/re.sonny.Commit.metainfo.xml:74 msgid "Shortcuts" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:83 +#: data/re.sonny.Commit.metainfo.xml:80 msgid "Welcome window" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:89 +#: data/re.sonny.Commit.metainfo.xml:86 msgid "Welcome window - dark mode" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:97 +#: data/re.sonny.Commit.metainfo.xml:94 msgid "Add keyboard shortcuts for moving lines up and down" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:99 +#: data/re.sonny.Commit.metainfo.xml:96 msgid "Add a shortcuts window" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:100 -msgid "Support for multiple comments" +#: data/re.sonny.Commit.metainfo.xml:97 +msgid "Support multiple comments" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:102 +#: data/re.sonny.Commit.metainfo.xml:99 +msgid "Automatically wrap commit message body" +msgstr "" + +#: data/re.sonny.Commit.metainfo.xml:100 msgid "Various fixes" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:109 +#: data/re.sonny.Commit.metainfo.xml:107 msgid "Remove spell check temporarily" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:110 +#: data/re.sonny.Commit.metainfo.xml:108 msgid "Support undo and redo" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:111 +#: data/re.sonny.Commit.metainfo.xml:109 msgid "Add symbolic icon" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:112 +#: data/re.sonny.Commit.metainfo.xml:110 msgid "Add dark mode setting" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:113 +#: data/re.sonny.Commit.metainfo.xml:111 msgid "Focus the text editor" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:114 +#: data/re.sonny.Commit.metainfo.xml:112 msgid "Port to GTK 4 and libadwaita" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:121 +#: data/re.sonny.Commit.metainfo.xml:119 msgid "Move preferences to welcome window" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:122 +#: data/re.sonny.Commit.metainfo.xml:120 msgid "Only highlight text overflow on commits" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:123 +#: data/re.sonny.Commit.metainfo.xml:121 msgid "New app icon" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:124 +#: data/re.sonny.Commit.metainfo.xml:122 msgid "Remove double border" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:131 +#: data/re.sonny.Commit.metainfo.xml:129 msgid "Add a Preferences window" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:132 +#: data/re.sonny.Commit.metainfo.xml:130 msgid "Set default title length hint to 50 characters" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:133 +#: data/re.sonny.Commit.metainfo.xml:131 msgid "Fix reading commits with special characters" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:134 +#: data/re.sonny.Commit.metainfo.xml:132 msgid "Fix git rebase not recognized" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:135 +#: data/re.sonny.Commit.metainfo.xml:133 msgid "Make windows bottom corners rounded" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:136 +#: data/re.sonny.Commit.metainfo.xml:134 msgid "Add 6px margin to editor" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:142 +#: data/re.sonny.Commit.metainfo.xml:140 msgid "" "⚠️ Action required. After updating, please launch the application and follow " "the instructions." msgstr "" -#: data/re.sonny.Commit.metainfo.xml:147 +#: data/re.sonny.Commit.metainfo.xml:145 msgid "Show a welcome window when launched from desktop" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:148 +#: data/re.sonny.Commit.metainfo.xml:146 msgid "Add support for Mercurial" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:149 +#: data/re.sonny.Commit.metainfo.xml:147 msgid "Remove filesystem permission" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:155 +#: data/re.sonny.Commit.metainfo.xml:153 msgid "Initial release. Forked from Gnomit 2.0." msgstr "" -#: data/re.sonny.Commit.metainfo.xml:157 +#: data/re.sonny.Commit.metainfo.xml:155 msgid "Support \"#\" in commit message" msgstr "" -#: data/re.sonny.Commit.metainfo.xml:158 +#: data/re.sonny.Commit.metainfo.xml:156 msgid "Properly recognize executable path" msgstr "" @@ -295,7 +302,7 @@ msgstr "" msgid "General" msgstr "" -#: src/ShortcutsWindow.ui:75 src/welcome.ui:192 +#: src/ShortcutsWindow.ui:75 src/welcome.ui:209 msgid "Keyboard Shortcuts" msgstr "" @@ -307,43 +314,51 @@ msgstr "" msgid "Abort" msgstr "" -#: src/welcome.ui:67 +#: src/welcome.ui:33 +msgid "Commit title max length" +msgstr "" + +#: src/welcome.ui:51 +msgid "Message body max length" +msgstr "" + +#: src/welcome.ui:84 msgid "Git" msgstr "" -#: src/welcome.ui:71 +#: src/welcome.ui:88 msgid "" "To set Commit as default editor for Git run the following command in Terminal" msgstr "" -#: src/welcome.ui:102 src/welcome.ui:160 +#: src/welcome.ui:119 src/welcome.ui:177 msgid "Copy to Clipboard" msgstr "" -#: src/welcome.ui:110 src/welcome.ui:168 +#: src/welcome.ui:127 src/welcome.ui:185 msgid "Documentation" msgstr "" -#: src/welcome.ui:114 +#: src/welcome.ui:131 msgid "" "https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_editor" msgstr "" -#: src/welcome.ui:125 +#: src/welcome.ui:142 msgid "Mercurial" msgstr "" #. TRANSLATORS: Don't translate hgrc -#: src/welcome.ui:130 +#: src/welcome.ui:147 msgid "" "To set Commit as default editor for Mercurial, set the following in your " "hgrc" msgstr "" -#: src/welcome.ui:172 +#: src/welcome.ui:189 msgid "https://www.mercurial-scm.org/wiki/editor" msgstr "" -#: src/welcome.ui:196 +#: src/welcome.ui:213 msgid "About Commit" msgstr "" diff --git a/re.sonny.Commit.json b/re.sonny.Commit.json index 951d60c..87e1d39 100644 --- a/re.sonny.Commit.json +++ b/re.sonny.Commit.json @@ -87,7 +87,7 @@ "sources": [ { "type": "dir", - "path": "./" + "path": "." } ] } diff --git a/src/Editor.js b/src/CommitEditor.js similarity index 89% rename from src/Editor.js rename to src/CommitEditor.js index 1f69811..9e8ecef 100644 --- a/src/Editor.js +++ b/src/CommitEditor.js @@ -6,7 +6,7 @@ import Adw from "gi://Adw"; import { relativePath } from "./util.js"; -const file = Gio.File.new_for_path(relativePath("./Editor.ui")); +const file = Gio.File.new_for_path(relativePath("./CommitEditor.ui")); const [, template] = file.load_contents(null); const scheme_manager = GtkSource.StyleSchemeManager.get_default(); @@ -19,7 +19,7 @@ language_manager.set_search_path([ export default GObject.registerClass( { - GTypeName: "Editor", + GTypeName: "CommitEditor", Properties: { language: GObject.ParamSpec.string( "language", @@ -35,7 +35,7 @@ export default GObject.registerClass( "style-updated": {}, }, }, - class Editor extends Gtk.ScrolledWindow { + class CommitEditor extends Gtk.ScrolledWindow { _init(params = {}) { super._init(params); diff --git a/src/CommitEditor.ui b/src/CommitEditor.ui new file mode 100644 index 0000000..9d2a9b0 --- /dev/null +++ b/src/CommitEditor.ui @@ -0,0 +1,24 @@ + + + + diff --git a/src/Editor.ui b/src/Editor.ui deleted file mode 100644 index e75ed21..0000000 --- a/src/Editor.ui +++ /dev/null @@ -1,41 +0,0 @@ - - - - diff --git a/src/application.js b/src/application.js index 3ef7103..9db3b7b 100644 --- a/src/application.js +++ b/src/application.js @@ -111,7 +111,7 @@ function openEditor({ file, application, readonly }) { try { [, commitMessage] = GLib.file_get_contents(filePath); } catch (err) { - printerr(err); + logError(err); application.quit(); return; } diff --git a/src/editor.js b/src/editor.js index acec278..2e41dfd 100644 --- a/src/editor.js +++ b/src/editor.js @@ -2,10 +2,10 @@ import Gtk from "gi://Gtk"; import GLib from "gi://GLib"; import GtkSource from "gi://GtkSource"; -import Editor from "./Editor.js"; +import CommitEditor from "./CommitEditor.js"; import { settings } from "./util.js"; -import { parse, hasCommitMessage } from "./scm.js"; +import { hasCommitMessage } from "./scm.js"; const HIGHLIGHT_BACKGROUND_TAG_NAME = "highlightBackground"; @@ -13,19 +13,9 @@ export default function editor({ builder, commitButton, type, - commitMessage, window, + parsed, }) { - let parsed = {}; - - try { - parsed = parse(commitMessage, type); - } catch (err) { - if (__DEV__) { - logError(err); - } - } - const { body, comment, @@ -51,7 +41,7 @@ export default function editor({ let previousNumberOfLinesInCommitMessage = 1; const main = builder.get_object("main"); - const widget = new Editor({ language }); + const widget = new CommitEditor({ language }); main.append(widget); const source_view = widget.view; diff --git a/src/language-specs/git.lang b/src/language-specs/git.lang index 575493c..8ad3f3f 100644 --- a/src/language-specs/git.lang +++ b/src/language-specs/git.lang @@ -42,7 +42,6 @@ - - + diff --git a/src/scm.js b/src/scm.js index f2f7d6d..900e579 100644 --- a/src/scm.js +++ b/src/scm.js @@ -78,6 +78,13 @@ export function parse(commit, type) { read_only_index, language, capitalize, + wrap: [ + "hg", + "commit", + "git-merge-squash", + "git-rebase-squash", + "merge", + ].includes(type), }; } diff --git a/src/welcome.js b/src/welcome.js index 65ccebd..da779d0 100644 --- a/src/welcome.js +++ b/src/welcome.js @@ -12,15 +12,26 @@ export default function Welcome({ application }) { loadStyleSheet(relativePath("./style.css")); - const spinButton = builder.get_object("spinButton"); - spinButton.set_range(50, 200); - spinButton.set_increments(1, 10); + const button_hint = builder.get_object("button_hint"); + button_hint.set_range(50, 200); + button_hint.set_increments(1, 10); settings.bind( "title-length-hint", - spinButton, + button_hint, "value", Gio.SettingsBindFlags.DEFAULT, ); + + const button_wrap = builder.get_object("button_wrap"); + button_wrap.set_range(72, 200); + button_wrap.set_increments(1, 10); + settings.bind( + "body-length-wrap", + button_wrap, + "value", + Gio.SettingsBindFlags.DEFAULT, + ); + const darkSwitch = builder.get_object("darkSwitch"); Adw.StyleManager.get_default().bind_property( "dark", diff --git a/src/welcome.ui b/src/welcome.ui index 9837954..6f49e07 100644 --- a/src/welcome.ui +++ b/src/welcome.ui @@ -30,11 +30,28 @@ Message title length hint + >Commit title max length - - 50 - True + + true + center + + + + + + + + + + + Message body max length + + + true center diff --git a/src/window.js b/src/window.js index 381f000..798e5ad 100644 --- a/src/window.js +++ b/src/window.js @@ -5,6 +5,8 @@ import Gio from "gi://Gio"; import Editor from "./editor.js"; import { relativePath } from "./util.js"; +import { parse } from "./scm.js"; +import wordwrap from "./wordwrap.js"; export default function Window({ application, @@ -13,12 +15,28 @@ export default function Window({ type, readonly, }) { - const builder = Gtk.Builder.new_from_file(relativePath("./window.ui")); + let parsed = {}; + try { + parsed = parse(commitMessage, type); + } catch (err) { + if (__DEV__) { + logError(err); + } + } + const builder = Gtk.Builder.new_from_file(relativePath("./window.ui")); const window = builder.get_object("window"); const cancelButton = builder.get_object("cancelButton"); const commitButton = builder.get_object("commitButton"); + const { buffer, source_view } = Editor({ + builder, + commitButton, + type, + window, + parsed, + }); + window.set_application(application); const cancelAction = new Gio.SimpleAction({ @@ -26,7 +44,7 @@ export default function Window({ parameter_type: null, }); cancelAction.connect("activate", () => { - save({ file, application, value: "", readonly }); + save({ file, window, value: "", readonly }); }); window.add_action(cancelAction); @@ -35,33 +53,31 @@ export default function Window({ parameter_type: null, }); commitAction.connect("activate", () => { - const value = buffer.text; - save({ file, application, value, readonly }); + const { text } = buffer; + const value = parsed.wrap ? wordwrap(0, 75, { mode: "hard" })(text) : text; + save({ + file, + window, + value, + readonly, + }); }); window.add_action(commitAction); - const { buffer, source_view } = Editor({ - builder, - commitButton, - type, - commitMessage, - window, - }); - // https://github.com/sonnyp/Commit/issues/33 window.set_focus(source_view); return { window, cancelButton, commitButton, buffer }; } -function save({ file, value, application, readonly }) { +function save({ file, value, window, readonly }) { if (!readonly) { try { GLib.file_set_contents(file.get_path(), value); } catch (err) { - printerr(err); + logError(err); } } - application.quit(); + window.close(); } diff --git a/src/wordwrap.js b/src/wordwrap.js new file mode 100644 index 0000000..65f1821 --- /dev/null +++ b/src/wordwrap.js @@ -0,0 +1,89 @@ +// This software is released under the MIT license: + +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +export default function wordwrap (start, stop, params) { + if (typeof start === 'object') { + params = start; + start = params.start; + stop = params.stop; + } + + if (typeof stop === 'object') { + params = stop; + start = start || params.start; + stop = undefined; + } + + if (!stop) { + stop = start; + start = 0; + } + + if (!params) params = {}; + var mode = params.mode || 'soft'; + var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; + + return function (text) { + var chunks = text.toString() + .split(re) + .reduce(function (acc, x) { + if (mode === 'hard') { + for (var i = 0; i < x.length; i += stop - start) { + acc.push(x.slice(i, i + stop - start)); + } + } + else acc.push(x) + return acc; + }, []) + ; + + return chunks.reduce(function (lines, rawChunk) { + if (rawChunk === '') return lines; + + var chunk = rawChunk.replace(/\t/g, ' '); + + var i = lines.length - 1; + if (lines[i].length + chunk.length > stop) { + lines[i] = lines[i].replace(/\s+$/, ''); + + chunk.split(/\n/).forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else if (chunk.match(/\n/)) { + var xs = chunk.split(/\n/); + lines[i] += xs.shift(); + xs.forEach(function (c) { + lines.push( + new Array(start + 1).join(' ') + + c.replace(/^\s+/, '') + ); + }); + } + else { + lines[i] += chunk; + } + + return lines; + }, [ new Array(start + 1).join(' ') ]).join('\n'); + }; +}; diff --git a/test/screenshot/COMMIT_EDITMSG b/test/screenshot/COMMIT_EDITMSG index b23d639..5bf7d31 100644 --- a/test/screenshot/COMMIT_EDITMSG +++ b/test/screenshot/COMMIT_EDITMSG @@ -1,6 +1,8 @@ -This is the commit title; it should be short. Commit will highlight if it exceeds 72 characters (customizable). +This is the commit title; it should be short. Commit will highlight if it exceeds 50 characters -Everything after the first blank line is the commit description. It can be as long as you like. +Everything after the first blank line is the commit body. It can be as long as you like. Commit will automatically wrap it to 75 characters. + +Both options are customizable. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit.