Page MenuHomePhorge

D25569.1736978881.diff
No OneTemporary

D25569.1736978881.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -485,7 +485,7 @@
'rsrc/js/core/behavior-keyboard-pager.js' => '1325b731',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '42c44e8b',
'rsrc/js/core/behavior-lightbox-attachments.js' => '14c7ab36',
- 'rsrc/js/core/behavior-line-linker.js' => '0d915ff5',
+ 'rsrc/js/core/behavior-line-linker.js' => '20613f20',
'rsrc/js/core/behavior-linked-container.js' => '74446546',
'rsrc/js/core/behavior-more.js' => '506aa3f4',
'rsrc/js/core/behavior-object-selector.js' => '98ef467f',
@@ -650,7 +650,7 @@
'javelin-behavior-phabricator-gesture-example' => '242dedd0',
'javelin-behavior-phabricator-keyboard-pager' => '1325b731',
'javelin-behavior-phabricator-keyboard-shortcuts' => '42c44e8b',
- 'javelin-behavior-phabricator-line-linker' => '0d915ff5',
+ 'javelin-behavior-phabricator-line-linker' => '20613f20',
'javelin-behavior-phabricator-notification-example' => '29819b75',
'javelin-behavior-phabricator-object-selector' => '98ef467f',
'javelin-behavior-phabricator-oncopy' => 'da8f5259',
@@ -1003,13 +1003,6 @@
'0d2490ce' => array(
'javelin-install',
),
- '0d915ff5' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-history',
- 'javelin-external-editor-link-engine',
- ),
'0eaa33a9' => array(
'javelin-behavior',
'javelin-dom',
@@ -1107,6 +1100,13 @@
'javelin-uri',
'javelin-install',
),
+ '20613f20' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-history',
+ 'javelin-external-editor-link-engine',
+ ),
'225bbb98' => array(
'javelin-install',
'javelin-reactor',
diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php
--- a/src/view/layout/PhabricatorSourceCodeView.php
+++ b/src/view/layout/PhabricatorSourceCodeView.php
@@ -132,7 +132,7 @@
if ($this->canClickHighlight) {
if ($base_uri) {
- $line_href = $base_uri.'$'.$line_number;
+ $line_href = $base_uri.'#'.$line_number;
} else {
$line_href = null;
}
@@ -142,6 +142,7 @@
array(
'href' => $line_href,
'data-n' => $line_number,
+ 'id' => $line_number,
));
} else {
$tag_number = phutil_tag(
diff --git a/webroot/rsrc/js/core/behavior-line-linker.js b/webroot/rsrc/js/core/behavior-line-linker.js
--- a/webroot/rsrc/js/core/behavior-line-linker.js
+++ b/webroot/rsrc/js/core/behavior-line-linker.js
@@ -160,11 +160,16 @@
target = null;
root = null;
- var lines = (o == t ? o : Math.min(o, t) + '-' + Math.max(o, t));
-
uri = JX.$U(uri);
path = uri.getPath();
- path = path + '$' + lines;
+ // Use anchor fragment for single line (calling the resulting URL will
+ // not highlight or scroll). Use custom $ when selecting multiple lines
+ // (calling the resulting URL will highlight and scroll to position).
+ if (o == t) {
+ path = path + '#' + o;
+ } else {
+ path = path + '$' + Math.min(o, t) + '-' + Math.max(o, t);
+ }
uri = uri.setPath(path).toString();
JX.History.replace(uri);

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 15, 22:08 (5 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1108925
Default Alt Text
D25569.1736978881.diff (3 KB)

Event Timeline