fix highlight url hash ordering

This commit is contained in:
Luck
2021-05-21 13:57:36 +01:00
parent 63053c276e
commit ca32d749ed

View File

@@ -112,8 +112,9 @@ function useSelectedLine() {
useEffect(() => { useEffect(() => {
if (selected[0] !== -1) { if (selected[0] !== -1) {
if (selected[1] !== -1) { if (selected[1] !== -1) {
const [s, e] = selected.sort(); const start = Math.min(...selected);
window.location.hash = `#L${s}-${e}`; const end = Math.max(...selected);
window.location.hash = `#L${start}-${end}`;
} else { } else {
window.location.hash = `#L${selected[0]}`; window.location.hash = `#L${selected[0]}`;
} }