mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-17 05:00:04 +02:00
[v7.0/forgejo] fix(ui): handle out-of-bounds end line in code selection (#4820)
Backport of https://codeberg.org/forgejo/forgejo/pulls/4788. - fallback to the last line, preventing TypeError - add E2E test Co-authored-by: Solomon Victorino <git@solomonvictorino.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4820 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
ae2312b767
commit
0f7cd8d46a
2 changed files with 55 additions and 1 deletions
|
@ -156,7 +156,8 @@ export function initRepoCodeView() {
|
|||
if (m) {
|
||||
$first = $linesEls.filter(`[rel=${m[1]}]`);
|
||||
if ($first.length) {
|
||||
selectRange($linesEls, $first, $linesEls.filter(`[rel=${m[2]}]`));
|
||||
const $last = $linesEls.filter(`[rel=${m[2]}]`);
|
||||
selectRange($linesEls, $first, $last.length ? $last : $linesEls.last());
|
||||
|
||||
// show code view menu marker (don't show in blame page)
|
||||
if (!isBlame()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue