Selecting also the trailing newline of a line for staging/unstaging would have resulted in also staging/unstaging of the next line. Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> --- lib/diff.tcl | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/lib/diff.tcl b/lib/diff.tcl index 63f8742..a750ea7 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -632,7 +632,13 @@ proc apply_range_or_line {x y} { } set first_l [$ui_diff index "$first linestart"] - set last_l [$ui_diff index "$last lineend"] + # don't include the next line if $last points to the start of a line + # ie. <lno>.0 + if {[lindex [split $last .] 1] == 0} { + set last_l [$ui_diff index "$last -1 line lineend"] + } else { + set last_l [$ui_diff index "$last lineend"] + } if {$current_diff_path eq {} || $current_diff_header eq {}} return if {![lock_index apply_hunk]} return -- 1.7.8.1.873.gfea665 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html