}
static void
-open_editor(bool from_root, char *file)
+open_external_viewer(const char *cmd)
+{
+ def_prog_mode(); /* save current tty modes */
+ endwin(); /* restore original tty modes */
+ system(cmd);
+ fprintf(stderr, "Press Enter to continue");
+ getc(stdin);
+ reset_prog_mode();
+ redraw_display();
+}
+
+static void
+open_editor(bool from_root, const char *file)
{
char cmd[SIZEOF_STR];
char file_sq[SIZEOF_STR];
if (sq_quote(file_sq, 0, file) < sizeof(file_sq) &&
string_format(cmd, "%s %s%s", editor, prefix, file_sq)) {
- def_prog_mode(); /* save current tty modes */
- endwin(); /* restore original tty modes */
- system(cmd);
- reset_prog_mode();
- redraw_display();
+ open_external_viewer(cmd);
}
}
cherry_pick = "git cherry-pick";
if (string_format(cmd, "%s %s", cherry_pick, commit->id)) {
- def_prog_mode(); /* save current tty modes */
- endwin(); /* restore original tty modes */
- system(cmd);
- fprintf(stderr, "Press Enter to continue");
- getc(stdin);
- reset_prog_mode();
- redraw_display();
+ open_external_viewer(cmd);
}
}