Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a %(text) variable #457

Merged
merged 1 commit into from
Nov 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ following variables.
|%(mainargs) |Options from 'main-options' used by the main view.
|%(prompt) |Prompt for the argument value. Optionally specify a
custom prompt using `"%(prompt Enter branch name: )"`
|%(text) |The text of the currently selected line.
|%(repo:head) |The name of the checked out branch, e.g. `master`
|%(repo:head-id) |The commit ID of the checked out branch.
|%(repo:remote) |The remote associated with the checked out branch,
Expand Down
1 change: 1 addition & 0 deletions doc/tigrc.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ following variable names, which are substituted before commands are run:
|%(mainargs) |Options from 'main-options' used by the main view.
|%(prompt) |Prompt for the argument value. Optionally specify a
custom prompt using `"%(prompt Enter branch name: )"`
|%(text) |The text of the currently selected line.
|%(repo:head) |The name of the checked out branch, e.g. `master`
|%(repo:head-id) |The commit ID of the checked out branch.
|%(repo:remote) |The remote associated with the checked out branch,
Expand Down
3 changes: 2 additions & 1 deletion include/tig/argv.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ typedef unsigned long argv_number;
_(argv_string, remote, "origin", "") \
_(argv_string, stash, "", "") \
_(argv_string, status, "", "") \
_(argv_string, tag, "", "")
_(argv_string, tag, "", "") \
_(argv_string, text, "", "") \

#define ARGV_ENV_FIELDS(type, name, ifempty, initval) type name;

Expand Down
6 changes: 5 additions & 1 deletion src/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ pager_request(struct view *view, enum request request, struct line *line)
void
pager_select(struct view *view, struct line *line)
{
const char *text = box_text(line);

string_ncopy(view->env->text, text, strlen(text));

if (line->type == LINE_COMMIT) {
string_copy_rev_from_commit_line(view->env->commit, box_text(line));
string_copy_rev_from_commit_line(view->env->commit, text);
if (!view_has_flags(view, VIEW_NO_REF))
string_copy_rev(view->ref, view->env->commit);
}
Expand Down