From 80e740b72ffda6e404b3e03bab8ea5b60c0e283c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 30 Aug 2012 08:50:22 +0200 Subject: script: add diff between current script and version in repository New options: - script.look.diff_command - script.look.diff_color Key alt-d has been changed to alt-v on script buffer (view script). Key alt-d is now used on detail of script to jump to diff (if diff is displayed). --- src/plugins/script/script-buffer.c | 44 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'src/plugins/script/script-buffer.c') diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c index 239c8a01c..1be10b02e 100644 --- a/src/plugins/script/script-buffer.c +++ b/src/plugins/script/script-buffer.c @@ -36,7 +36,8 @@ struct t_gui_buffer *script_buffer = NULL; int script_buffer_selected_line = 0; struct t_repo_script *script_buffer_detail_script = NULL; -int script_buffer_detail_script_line_source = 0; +int script_buffer_detail_script_last_line = 0; +int script_buffer_detail_script_line_diff = -1; /* @@ -475,7 +476,8 @@ script_buffer_display_detail_script (struct t_repo_script *script) (script->max_weechat) ? script->max_weechat : "-"); line++; - script_buffer_detail_script_line_source = line + 2; + script_buffer_detail_script_last_line = line + 2; + script_buffer_detail_script_line_diff = -1; } /* @@ -502,14 +504,14 @@ script_buffer_refresh (int clear) { snprintf (str_title, sizeof (str_title), "%s", - _("alt+d=back to list")); + _("Alt+key/input: v=back to list d=jump to diff")); } else { snprintf (str_title, sizeof (str_title), _("%d/%d scripts (filter: %s) | Sort: %s | " "Alt+key/input: i=install r=remove l=load L=reload " - "u=unload h=(un)hold d=show detail | Input: q=close " + "u=unload h=(un)hold v=view script | Input: q=close " "$=refresh s:x,y=sort words=filter *=reset filter | " "Mouse: left=select right=install/remove"), script_repo_count_displayed, @@ -704,14 +706,15 @@ int script_buffer_input_cb (void *data, struct t_gui_buffer *buffer, const char *input_data) { - char *actions[][2] = { { "l", "load" }, - { "u", "unload" }, - { "L", "reload" }, - { "i", "install" }, - { "r", "remove" }, - { "h", "hold" }, - { "d", "show" }, - { NULL, NULL } }; + char *actions[][2] = { { "l", "load" }, + { "u", "unload" }, + { "L", "reload" }, + { "i", "install" }, + { "r", "remove" }, + { "h", "hold" }, + { "v", "show" }, + { "d", "showdiff" }, + { NULL, NULL } }; char str_command[64]; int i; @@ -811,14 +814,15 @@ script_buffer_set_callbacks () void script_buffer_set_keys () { - char *keys[][2] = { { "meta-l", "load" }, - { "meta-u", "unload" }, - { "meta-L", "reload" }, - { "meta-i", "install" }, - { "meta-r", "remove" }, - { "meta-h", "hold" }, - { "meta-d", "show" }, - { NULL, NULL } }; + char *keys[][2] = { { "meta-l", "load" }, + { "meta-u", "unload" }, + { "meta-L", "reload" }, + { "meta-i", "install" }, + { "meta-r", "remove" }, + { "meta-h", "hold" }, + { "meta-v", "show" }, + { "meta-d", "showdiff" }, + { NULL, NULL } }; char str_key[64], str_command[64]; int i; -- cgit v1.2.3