diff -r b1f75d8e887a -r a1cd6eae2ad3 mercurial/crecord.py --- a/mercurial/crecord.py Tue Aug 22 16:59:02 2017 -0400 +++ b/mercurial/crecord.py Mon Aug 28 13:43:31 2017 +0200 @@ -1440,6 +1440,17 @@ except curses.error: pass + def commitMessageWindow(self): + "Create a temporary commit message editing window on the screen." + + curses.raw() + curses.def_prog_mode() + curses.endwin() + self.commenttext = self.ui.edit(self.commenttext, self.ui.username()) + curses.cbreak() + self.stdscr.refresh() + self.stdscr.keypad(1) # allow arrow-keys to continue to function + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1661,6 +1672,8 @@ self.togglefolded() elif keypressed in ["F"]: self.togglefolded(foldparent=True) + elif keypressed in ["m"]: + self.commitMessageWindow() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() @@ -1736,3 +1749,8 @@ keypressed = "foobar" if self.handlekeypressed(keypressed): break + + if self.commenttext != "": + whitespaceremoved = re.sub("(?m)^\s.*(\n|$)", "", self.commenttext) + if whitespaceremoved != "": + self.opts['message'] = self.commenttext