mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 15:00:58 +01:00
Merge pull request #94 from Koolvin/master
Multiline Highlighting in Diffusion
This commit is contained in:
commit
efa2ab2fef
2 changed files with 20 additions and 5 deletions
|
@ -265,7 +265,7 @@ class AphrontDefaultApplicationConfiguration
|
||||||
'browse/'.
|
'browse/'.
|
||||||
'(?P<path>.*?)'.
|
'(?P<path>.*?)'.
|
||||||
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
||||||
'(?:[$](?P<line>\d+))?'.
|
'(?:[$](?P<line>\d+(?:-\d+)?))?'.
|
||||||
'$'
|
'$'
|
||||||
=> 'DiffusionBrowseController',
|
=> 'DiffusionBrowseController',
|
||||||
'diff/'.
|
'diff/'.
|
||||||
|
|
|
@ -313,6 +313,19 @@ class DiffusionBrowseFileController extends DiffusionController {
|
||||||
$range = 1;
|
$range = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$targ = '';
|
||||||
|
$min_line = 0;
|
||||||
|
$line = $drequest->getLine();
|
||||||
|
if (strpos($line,'-') !== false) {
|
||||||
|
list($min,$max) = explode('-',$line,2);
|
||||||
|
$min_line = min($min, $max);
|
||||||
|
$max_line = max($min, $max);
|
||||||
|
} else if (strlen($line)) {
|
||||||
|
$min_line = $line;
|
||||||
|
$max_line = $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($text_list as $k => $line) {
|
foreach ($text_list as $k => $line) {
|
||||||
if ($needs_blame) {
|
if ($needs_blame) {
|
||||||
// If the line's rev is same as the line above, show empty content
|
// If the line's rev is same as the line above, show empty content
|
||||||
|
@ -370,11 +383,13 @@ class DiffusionBrowseFileController extends DiffusionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight the line of interest if needed.
|
// Highlight the line of interest if needed.
|
||||||
if ($n == $drequest->getLine()) {
|
if ($min_line > 0 && ($n >= $min_line && $n <= $max_line)) {
|
||||||
$tr = '<tr style="background: #ffff00;">';
|
$tr = '<tr style="background: #ffff00;">';
|
||||||
|
if ($targ == '') {
|
||||||
$targ = '<a id="scroll_target"></a>';
|
$targ = '<a id="scroll_target"></a>';
|
||||||
Javelin::initBehavior('diffusion-jump-to',
|
Javelin::initBehavior('diffusion-jump-to',
|
||||||
array('target' => 'scroll_target'));
|
array('target' => 'scroll_target'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$tr = '<tr>';
|
$tr = '<tr>';
|
||||||
$targ = null;
|
$targ = null;
|
||||||
|
|
Loading…
Reference in a new issue