Skip to content

Commit

Permalink
Blob view: open editor at selected line
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas committed Feb 25, 2013
1 parent 89bdcf7 commit a14ad94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tig.c
Expand Up @@ -5142,7 +5142,7 @@ tree_draw(struct view *view, struct line *line, unsigned int lineno)
}

static void
open_blob_editor(const char *id)
open_blob_editor(const char *id, unsigned int lineno)
{
const char *blob_argv[] = { "git", "cat-file", "blob", id, NULL };
char file[SIZEOF_STR] = "/tmp/tigblob.XXXXXX";
Expand All @@ -5153,7 +5153,7 @@ open_blob_editor(const char *id)
else if (!io_run_append(blob_argv, fd))
report("Failed to save blob data to file");
else
open_editor(file, 0);
open_editor(file, lineno);
if (fd != -1)
unlink(file);
}
Expand All @@ -5178,7 +5178,7 @@ tree_request(struct view *view, enum request request, struct line *line)
if (line->type != LINE_TREE_FILE) {
report("Edit only supported for files");
} else if (!is_head_commit(view->vid)) {
open_blob_editor(entry->id);
open_blob_editor(entry->id, 0);
} else {
open_editor(opt_file, 0);
}
Expand Down Expand Up @@ -5375,7 +5375,7 @@ blob_request(struct view *view, enum request request, struct line *line)
{
switch (request) {
case REQ_EDIT:
open_blob_editor(view->vid);
open_blob_editor(view->vid, (line - view->line) + 1);
return REQ_NONE;
default:
return pager_request(view, request, line);
Expand Down

0 comments on commit a14ad94

Please sign in to comment.