From: Shawn O. Pearce Date: Wed, 02 Jul 2008 05:23:42 GMT Subject: Re: [PATCH] git-gui: Implement "Stage/Unstage Line" Message-ID: <20080702052342.GN11793@spearce.org> In-Reply-To: <48649519.1010307@viscovery.net> Johannes Sixt wrote: > From: Johannes Sixt > > This adds a context menu entry below "Stage/Unstage Hunk" that stages or > unstages just the line under the mouse pointer. Thanks! After some brief testing this is in now my tree on repo.or.cz. > Disclaimer: I'm Tcl/Tk illiterate. Feel free to munge the patch > to your taste. I wouldn't say illiterate, given this contribution. :) > The 'do_rescan' is probably a bit heavy-weight. But editing the > diff window like we do in "Stage Hunk" would be a bit complex, and > just redisplaying the diff is easier. Yea, I see why you are doing a do_rescan at the end. I was going to suggest just calling reshow_diff but that doesn't get the lists updated properly when a file is being initially staged as a result of the current line being added. Editing the Tk widget is possible, but it can be a pain. > Furthermore, I don't know why I have to do the loop until > "end - 1 chars". If it goes until "end", then the hunk contains > an extra line, so that the patch in general does not apply. > Is there an extra newline in the diff view that is not in the > git diff output? Yup. Tk text widgets have an extra "\n" at the end of the content that was inserted into it. Thus an empty text widget has a single LF as its content. Weird, I know. -- Shawn.