summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c38c64b)
raw | patch | inline | side by side (parent: c38c64b)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 28 Sep 2007 15:59:47 +0000 (17:59 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 28 Sep 2007 15:59:54 +0000 (17:59 +0200) |
This way there is only one place calling system. In addition, files
opened in an editor will now wait for the user to press Enter to
continue. Whether this is good or bad can be discussed but it feels more
consistent and could help the user spot any errors printed by the
editor.
opened in an editor will now wait for the user to press Enter to
continue. Whether this is good or bad can be discussed but it feels more
consistent and could help the user spot any errors printed by the
editor.
tig.c | patch | blob | history |
index cc7f6b8d3d7a78f2757b2d7f81162d3996bda29a..b9fd89c7f20c44a9c1830235eded41cd8f5f8180 100644 (file)
--- a/tig.c
+++ b/tig.c
}
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);
}
}