git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[[TIG][PATCH] 2/3] Display correct diff the context in split log view

From
Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Date
Aug 3, 2013, 00:23 UTC
Message-ID
<1375489399-11618-3-git-send-email-a.kumar@alumni.iitm.ac.in>
In-Reply-To
<1375489399-11618-1-git-send-email-a.kumar@alumni.iitm.ac.in>

In the log view, when scrolling across a commit, the diff view should automatically switch to the commit whose context the cursor is on in the log view. This commit changes things to catch the REQ_ENTER in the log view and handle recalculation of the commit and diff display from log_request, rather than delegating it to pager_request. In addition, it also gets rid of unexpected upward scrolling of the log view.

Fixes GH #155
Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
---
 NEWS  |  1 +
 tig.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)
diff --git a/NEWS b/NEWS
index 0394407..f59e517 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ Bug fixes:
  - Fix rendering glitch for branch names.
  - Do not apply diff styling to untracked files in the stage view. (GH #153)
  - Fix tree indentation for entries containing combining characters. (GH #170)
+ - Introduce a more natural context-sensitive log display. (GH #155)
 
 tig-1.1
 -------
diff --git a/tig.c b/tig.c
index dd4b0f4..53947b7 100644
--- a/tig.c
+++ b/tig.c
@@ -4478,6 +4478,18 @@ log_request(struct view *view, enum request request, struct line *line)
 		state->update_commit_ref = TRUE;
 		return pager_request(view, request, line);
 
+	case REQ_ENTER:
+		/* Recalculate the correct commit for the context. */
+		state->update_commit_ref = TRUE;
+
+		open_view(view, REQ_VIEW_DIFF, OPEN_SPLIT);
+		update_view_title(view);
+
+		/* We don't want to delegate this to pager_request,
+		   since we don't want the extra scrolling of the log
+		   view. */
+		return REQ_NONE;
+
 	default:
 		return pager_request(view, request, line);
 	}
-- 
1.8.3.2
Previous: Jonas FonsecaNext: Jonas Fonseca
Message 6 of 9 in “Refactoring of the log view”
  1. Kumar AppaiahAug 3, 2013
  2. [[TIG][PATCH] 1/3] Add log_select function to find commit from context in log viewKumar Appaiah, Aug 3, 2013
  3. Jonas FonsecaAug 6, 2013
  4. Kumar AppaiahAug 6, 2013
  5. Jonas FonsecaAug 6, 2013
  6. [[TIG][PATCH] 2/3] Display correct diff the context in split log viewKumar Appaiah, Aug 3, 2013
  7. Jonas FonsecaAug 6, 2013
  8. [[TIG][PATCH] 3/3] Revert "Scroll diff with arrow keys in log view"Kumar Appaiah, Aug 3, 2013
  9. Jonas FonsecaAug 6, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.