sonnyp / commit Goto Github PK
View Code? Open in Web Editor NEWCommit message editor
Home Page: https://apps.gnome.org/Commit/
License: GNU General Public License v3.0
Commit message editor
Home Page: https://apps.gnome.org/Commit/
License: GNU General Public License v3.0
Add an autocomplete to setup conventional commits
https://www.conventionalcommits.org/en/v1.0.0/
| fe ->
autocompletes to feature
[optional scope]:
[optional body]
[optional footer(s)]
Now that we have a shortcuts window and preferences, it may be good to make them accessible from the main window.
Unfortunately the header bar is a bit crowded.
I can think of a few options
${type}: ${projectDirectoryName} (${detail})
Cancel
and Commit
buttons on the bottom - probably in a ActionBar@bertob any thoughts?
Hello.
Open Commit inside an bash terminar or even from Gnome menu is ok, but when i try to open from zsh shell (using ohmyzsh) Commit screen wont open:
➜ Docs flatpak run re.sonny.Commit
(re.sonny.Commit:2): Gtk-WARNING **: 12:36:35.606: cannot open display:
➜ Docs
I've tried everything i now to make this open, but no success
(The same has happend when i tried to open from vscode terminal too)
Shuffling lines up and down is a frequent operation when doing interactive rebase. A pair of key bindings to do that would be great. I'd suggest Alt + Up/Down to match gedit.
https://hosted.weblate.org/projects/commit/commit/#information is GPLv3-only
It should however be GPLv3-or-later,
as per
https://github.com/sonnyp/Commit/blob/9e012379a3db19703299ccd1356411feafe2c2bc/README.md#license
It can be changed in https://hosted.weblate.org/settings/commit/commit
Follow up from #56
I've been experimenting with setting the TextView width to the desired max body length.
The benefit is that if you make Commit window bigger you can see what the text will wrap.
It would probably be a max with thought or making the window smaller / mobile device will have a scrolled area.
An other option would be to make the Window big enough to fit the textview - only if the screen is wider than the width of course.
The TextView should be centered too.
We can also add a ruler.
Something like this seems to work well - tested in Workbench
import Pango from "gi://Pango";
const textview = workbench.builder.get_object("textview");
const metrics = textview.get_pango_context()?.get_metrics(null, null);
const text =
"foo sdfs fas fas df as dfa sdf sdf sd fs ldflasd falsdfkasdf kasdfk asdlkfask dflaksd fkals dfk asdkfl asdklf aslkd f dsf flkasd flskd flaksd faslkd f ";
textview.get_buffer().text = text;
const max_body_length = 75;
const character_width = metrics.get_approximate_char_width() / Pango.SCALE;
const total_width =
character_width * max_body_length +
1 +
textview.right_margin +
textview.left_margin;
textview.width_request = Math.ceil(total_width);
<?xml version="1.0" encoding="UTF-8" ?>
<interface>
<object class="GtkBox" id="welcome">
<property name="orientation">vertical</property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<child>
<object class="GtkTextView" id="textview">
<property name="left-margin">0</property>
<property name="right-margin">0</property>
<property name="halign">start</property>
<property name="monospace">true</property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<property name="wrap-mode">word-char</property>
</object>
</child>
</object>
</interface>
foo: bar
-> capitalize Bar
foo bar
-> capitalize Foo
foo:
is a tag and shouldn't be capitalized
Git adds instructions in the form of a block comment at the end of the file, for example
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
# modified: README.md
#
right now we make this readonly and exclude it from select all.
Since it's not deletable anyway, let's move it to its own readonly gtksourceview to remove readonly/select-all code and simplify
We can also do like https://github.com/small-tech/comet/ and move it a a GtkText
Blocked by flatpak/flatpak#4868
An alternative would be to give commit host:rw
.
Are more preferences planned? Currently there's a single option in the preferences dialog, which looks a bit weird.
https://gitlab.gnome.org/Teams/Circle/-/issues/83#note_1257600
For now there will be only one preference. I imagine 1 or 2 more in the future.
I see 2 options
@bertob do you think the first option makes sense?
First, thanks for the great app! It's very well done 😁
Only one thing is bugging me: once in a while, my muscle memory hits the "escape" key when I'm done typing my commit message (maybe because I'm used to Jetbrains IDEs and that puts my cursor back in the main editing panel? Unsure why). Unfortunately, with this Commit app, it cancels the commit and throws away my message, which hurts my feelings 😔
I have two potential behaviour suggestions that could help with this sharp edge:
Thanks again, and I hope you have a good holiday season 👋
@comradekingu Just to inform you that translations on Weblate are currently locked. Maybe it's on purpose, maybe not ;-)
If you can, please check why the descriptive/summary texts for the Commit app don’t show translated on different pages (see below). If possible, please implement it.
I’m not a programmer, so I can’t help you out unfortunately :-(
https://world.pages.gitlab.gnome.org/apps-for-gnome/hr/
https://world.pages.gitlab.gnome.org/apps-for-gnome/hr/app/re.sonny.Commit/
https://apps.gnome.org/app/re.sonny.Commit/ (also missing the last section on translation status)
Auto-capitalization is very unconvenient with Convential Commits because it uses lowercase prefixes. I suggest to make auto-capitalization optional.
Follow up #56
When maximizing or resize the window above a threshold, Commit should switch to "big editor" mode, center the textview, disable word wrap and add a ruler.
We should fallback when commit cannot be used (no display, over ssh, toolbox, ... for example).
From a UX perspective, wouldn't it make more sense to have the text focused? Users can cancel with Esc; We could also add a shortcut for Ctrl+Enter. For tab navigation there's Ctrl+Tab.
For most cases Commit
wouldn't be sensitive, so it's redundant to give Cancel
focus.
Originally posted by @BrainBlasted in #30 (comment)
Whenever I try to squash rebase, I cannot edit the previous commits:
For the maintainer to appear in Apps for gnome it must contain info about the git forge account
<maintainer>
<foaf:Person>
<foaf:name>User Name</foaf:name>
<foaf:mbox rdf:resource="mailto:[email protected]" />
<gnome:userid>gnome-user-acc</gnome:userid>
<foaf:account>
<foaf:OnlineAccount>
<foaf:accountServiceHomepage rdf:resource="https://github.com/"/>
<foaf:accountName>user-github-acc</foaf:accountName>
</foaf:OnlineAccount>
</foaf:account>
</foaf:Person>
</maintainer>
Creating a tag and later trying to add a message to it, it fails (Commit window doesn't open, it just prints the error message):
$ git tag test-tag
$ git tag test-tag -a -f
hint: Waiting for your editor to close the file...
(re.sonny.Commit:2): Gjs-CRITICAL **: 20:38:19.094: JS ERROR: TypeError: commentLines[3] is undefined
parse@file:///app/share/re.sonny.Commit/scm.js:38:21
openEditor@file:///app/share/re.sonny.Commit/application.js:104:12
Application/<@file:///app/share/re.sonny.Commit/application.js:35:15
main@file:///app/share/re.sonny.Commit/main.js:51:22
@file:///app/bin/re.sonny.Commit:12:5
fatal: no tag message?
If I create a tag with a message and later try to change it, it also fails. The only difference is in the last line:
$ git tag test-tag -a
$ git tag test-tag -a -f
hint: Waiting for your editor to close the file...
(re.sonny.Commit:2): Gjs-CRITICAL **: 20:38:49.572: JS ERROR: TypeError: commentLines[3] is undefined
parse@file:///app/share/re.sonny.Commit/scm.js:38:21
openEditor@file:///app/share/re.sonny.Commit/application.js:104:12
Application/<@file:///app/share/re.sonny.Commit/application.js:35:15
main@file:///app/share/re.sonny.Commit/main.js:51:22
@file:///app/bin/re.sonny.Commit:12:5
Updated tag 'test-tag' (was 37ac31b)
If I remove the editor = flatpak run --file-forwarding re.sonny.Commit @@
line in .gitconfig
, both scenarios work properly and add/change the tag message.
AUR package maintainer here. When running git commit
to spawn Commit, the following is spammed in the terminal:
(re.sonny.Commit:303277): Gjs-CRITICAL **: 17:03:11.736: JS ERROR: too much recursion
validateCommitButton@file:///usr/share/re.sonny.Commit/validateCommitButton.js:8:29
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:141:25
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
Editor/<@file:///usr/share/re.sonny.Commit/editor.js:105:14
...
The last repeated 4 lines repeat over and over
Autocomplete for things started with : like on this github editor (and add an preview)
🥇
"flatpak run --socket=wayland --env=GDK_BACKEND=wayland --file-forwarding re.sonny.Commit @@"
fedora 35
Depends on #30
Does it make sense for Commit to use a flat header bar? I kinda like the third option.
cc @bertob @BrainBlasted wdyt?
flat
flat - same color as content
Would be nice if it could show the last commits. Sometimes you need to see what you wrote in previous ones. And it would be very nice if the previous commits could be changed as well.
Thats what i miss when i enter commit "stories".
As discussed in the Circle issue my feeling is the current name is not terrible but a bit too generic. Something with a bit more personality would be nicer.
Some ideas to get the ball rolling:
Hi, you have a bit of code which sets the button_save
sensitive property to false when the commit message is empty but the "win.save" action remains enabled can be activate via the shortcut.
Which is probably wrong.
Cheers
Commit should not put the entire commit message on as few lines as possible: it makes reading commit messages harder than necessary on the command line.
If the user specifies a hard limit for the length of each line, the commit message should be following that size. This should be possible by iterating over the text using Pango, and finding where words wrap.
All the cool kids are doing it :P
OS: Fedora 36
Right now, I can increase the maximum title and body length of the commit above 50 and 72 respectively, but I'm not allowed to reduce it beyond that amount. I normally limit my message to I think about 60 characters, so it would be useful if Commit allowed me to tune this maximum down.
Is there any particular reason there's a minimum at all? Otherwise why not let it run to zero and let the user figure it out? 😉
Hey Sonny,
Congrats on the work you’re doing on Commit and on supporting it in GNOME circles. Sorry I was slow to reply to your messages; had other things on – happy you ran with it as I’m focussing any limited time I have left over from the Small Web work on elementary OS-specific stuff. So it’s nice to see this available for the wider community.
One request: could you capitalise my last name in the README, etc.? (Aral Balkan, not Aral balkan.) Not a biggie, I just don’t want people to think I use some weird stylised way of writing it :)
Looking forward to seeing where you take it and keep your eyes peeled for something specific to elementary OS in the near future from me ;)
Take care + 💕
Auto-capitalization even without commit-type:
-prefix is very unconvenient when I use Angular-like commit message convensions. It will be good to have an option to disable auto-capitalization.
Continuing from Reddit...
Installed files:
❯ pacman -Ql commit
commit /usr/
commit /usr/bin/
commit /usr/bin/re.sonny.Commit
commit /usr/share/
commit /usr/share/appdata/
commit /usr/share/appdata/re.sonny.Commit.appdata.xml
commit /usr/share/applications/
commit /usr/share/applications/re.sonny.Commit.desktop
commit /usr/share/glib-2.0/
commit /usr/share/glib-2.0/schemas/
commit /usr/share/glib-2.0/schemas/re.sonny.Commit.gschema.xml
commit /usr/share/icons/
commit /usr/share/icons/hicolor/
commit /usr/share/icons/hicolor/scalable/
commit /usr/share/icons/hicolor/scalable/apps/
commit /usr/share/icons/hicolor/scalable/apps/re.sonny.Commit.svg
commit /usr/share/re.sonny.Commit/
commit /usr/share/re.sonny.Commit/about.js
commit /usr/share/re.sonny.Commit/application.css
commit /usr/share/re.sonny.Commit/application.js
commit /usr/share/re.sonny.Commit/editor.js
commit /usr/share/re.sonny.Commit/main.js
commit /usr/share/re.sonny.Commit/meson.build
commit /usr/share/re.sonny.Commit/re.sonny.Commit
commit /usr/share/re.sonny.Commit/scm.js
commit /usr/share/re.sonny.Commit/setup.js
commit /usr/share/re.sonny.Commit/util.js
commit /usr/share/re.sonny.Commit/validateCommitButton.js
commit /usr/share/re.sonny.Commit/welcome.js
commit /usr/share/re.sonny.Commit/welcome.ui
commit /usr/share/re.sonny.Commit/window.js
commit /usr/share/re.sonny.Commit/window.ui
❯ git --version
git version 2.31.1
The output of git commit
complains if there's nothing to commit or commits as expected.
The preferences window is currently not modal, but it should be.
Of course, if preferences are moving to the menu this is moot :)
Currently whenever I update a commit message, the application auto uppercase the first letter which is not really a desired behaviour. Would it be possible to completely disable that or at least make it optional?
I like the simple, clean interface. Also I'd like ctrl-+ to increase the font size like it does in some other apps, or at least, have a menu item for it.
git config --global core.editor "flatpak run --file-forwarding re.sonny.Commit @@"
git config --global -e
. It'll open the Commit window and print this message in terminal:hint: Waiting for your editor to close the file... Warning: unknown commit type encountered in: /run/user/1000/doc/ab12bc58/.gitconfig
Abort
will delete all contents in .gitconfig, leaving the user with an empty file.gitconfig
, I'm unable to as existing content is read-only, and I'm only able to insert content at the start of the file or append it at the end of the fileCurrent behaviour
If you open the about page and hit escape it closes the hole app. Pressing alt+F4 or pressing the close button works like expected.
Expected behaviour
It should only close the about page without the main window
Used latest version on flathub: 2.2.0
Similar to Ctrl+/
in VSCode or Ctrl+M
/ Ctrl+Shift+M
in Builder
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.