fix(ui): handle out-of-bounds end line in code selection (#4788)
- fallback to the last line, preventing TypeError - add E2E test Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4788 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Solomon Victorino <git@solomonvictorino.com> Co-committed-by: Solomon Victorino <git@solomonvictorino.com>
This commit is contained in:
parent
c031881a20
commit
3ee5bc262f
2 changed files with 55 additions and 1 deletions
|
@ -158,7 +158,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