mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 20:09:23 +00:00
Allow selecting lines in diff
This commit is contained in:
parent
7c91a7e3ff
commit
b213b54ac1
|
@ -70,6 +70,14 @@ div#diff div.file table tr.added td:last-child {
|
|||
background-color: #ddffdd;
|
||||
}
|
||||
|
||||
div#diff div.file table tr.added.selected td:last-child {
|
||||
background-color: #a8cfd6;
|
||||
}
|
||||
|
||||
div#diff div.file table tr.removed.selected td:last-child {
|
||||
background-color: #b8bed6;
|
||||
}
|
||||
|
||||
div#diff div.file table tr.removed td:last-child {
|
||||
background-color: #ffdddd;
|
||||
}
|
||||
|
@ -152,6 +160,11 @@ div#diff div.file table tr.hunk_header td.hunk_header {
|
|||
border-bottom: 1px solid #d3d7cf;
|
||||
}
|
||||
|
||||
div#diff div.file table tr.hunk_header.selected td.hunk_header {
|
||||
color: #aaa;
|
||||
background-color: #ececff;
|
||||
}
|
||||
|
||||
div#diff div.file table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,24 @@ function expand_collapse()
|
|||
expander.closest('tbody').toggleClass("collapsed");
|
||||
}
|
||||
|
||||
|
||||
function stage_unstage_hunk()
|
||||
{
|
||||
var addrm = $(this).nextUntil('tr.file_header, tr.hunk_header').filter('tr.added, tr.removed');
|
||||
|
||||
var unsel = $.grep(addrm, function(e) { return !$(e).hasClass('selected'); });
|
||||
addrm.removeClass('selected');
|
||||
|
||||
if (unsel.length != 0)
|
||||
{
|
||||
addrm.addClass('selected');
|
||||
}
|
||||
}
|
||||
|
||||
function stage_unstage_line()
|
||||
{
|
||||
$(this).toggleClass("selected");
|
||||
}
|
||||
function update_diff(id, lsettings)
|
||||
{
|
||||
if (html_builder_worker)
|
||||
|
@ -214,6 +232,8 @@ function update_diff(id, lsettings)
|
|||
content.html(event.data.diff_html);
|
||||
|
||||
$(".expander").click(expand_collapse);
|
||||
$("tr.hunk_header").click(stage_unstage_hunk);
|
||||
$("tr.added, tr.removed").click(stage_unstage_line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue