Permalink
Browse files

Blob view: open editor at selected line

  • Loading branch information...
1 parent 89bdcf7 commit a14ad94dbde5bee0eef66047dfc3d3f02a59bf3a @jonas committed Feb 25, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 tig.c
View
@@ -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";
@@ -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);
}
@@ -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);
}
@@ -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);

0 comments on commit a14ad94

Please sign in to comment.