From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Mon, 18 Jan 2016 15:45:05 +0000 Subject: Reverse Paths in Title In-Reply-To: References: Message-ID: <20160118154505.GS14056@serenity.lan> On Mon, Jan 18, 2016 at 04:16:03PM +0100, Jason A. Donenfeld wrote: > With lots of tabs open containing many files from /tree, it's useful > to see which file is open. For this I'm reversing the components of > the path name, flipping the slash around, and pre-pending it to the > document title. > > http://git.zx2c4.com/linux/tree/arch/x86/boot/copy.S > > Take a look at the document on that page. I find the reversed path really confusing when I look at it as a whole, which makes it harder to find tabs in a list such as the tab dropdown Firefox presents when you have a lot of tabs. I was surprised we don't already show the file path in the header, which I agree is a good idea. Personally, I'd prefer something like this which has the advantage that it still leaves the project name at the front of the title. -- >8 -- diff --git a/cgit.c b/cgit.c index 28a2f14..6c85465 100644 --- a/cgit.c +++ b/cgit.c @@ -586,7 +586,8 @@ static int prepare_repo_cmd(void) cgit_print_docend(); return 1; } - ctx.page.title = fmtalloc("%s - %s", ctx.repo->name, ctx.repo->desc); + ctx.page.title = fmtalloc("%s%s%s - %s", ctx.repo->name, + ctx.qry.page ? "/" : "", ctx.qry.page, ctx.repo->desc); if (!ctx.repo->defbranch) ctx.repo->defbranch = guess_defbranch();