Skip to content
Prev Previous commit
Next Next commit
feat(commit-input): add multiline feature
- Add ability to the answer inputs to aacept multilines. - No more accidental Enter key, now Enter key only breaks the line into a new line and it can be removed/undo using backspace key normally. - Now the user can submit the commit only when he is sure by pressing combination of Alt + Enter. BREAKING CHANGE:
  • Loading branch information
anasalaqeel committed Sep 27, 2025
commit 4e43e0d9365353a151f744d4a9376627138bf1e7
4 changes: 3 additions & 1 deletion commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def _prompt_commit_questions(self) -> str:
raise CustomError(root_err.__str__())
raise err
elif question["type"] == "input" and question.get("multiline", False):
print(f"\033[90m💡 Multiline input:\n Press Enter for new lines and Esc+Enter to finish\033[0m \n \033[90mor (Finish with 'Alt+Enter' or 'Esc then Enter')\033[0m")
print(
"\033[90m💡 Multiline input:\n Press Enter for new lines and Esc+Enter to finish\033[0m \n \033[90mor (Finish with 'Alt+Enter' or 'Esc then Enter')\033[0m"
)
multiline_question = question.copy()
multiline_question["multiline"] = True
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from commitizen import defaults
from commitizen.cz.base import BaseCommitizen
from commitizen.cz.utils import multiple_line_breaker, required_validator
from commitizen.cz.utils import required_validator
from commitizen.question import CzQuestion

__all__ = ["ConventionalCommitsCz"]
Expand Down
4 changes: 0 additions & 4 deletions commitizen/cz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import re
import tempfile

import questionary

from commitizen import git
from commitizen.cz import exceptions

Expand All @@ -20,8 +18,6 @@ def multiple_line_breaker(answer: str, sep: str = "|") -> str:
return "\n".join(line.strip() for line in answer.split(sep) if line)




def strip_local_version(version: str) -> str:
return _RE_LOCAL_VERSION.sub("", version)

Expand Down