Before I start my apologies if this isn't how to do a follow up a question.
First, read the answer to this this post detailing what I am trying to accomplish that flushes backrefs right (with biblatex and backref option), and outside of the margins here:
Biblatex: pagebackref reference in the (flush) right margin
Now I really like this code, since I think it looks nice and clean, and allows for nice linking of backrefs. However, an issue arises when there is a reference that goes all the way to the end. The backref link gets moved to a new line, which I obviously do not want. Do any latex experts know how to fix this?
See picture below.
This is the code that I pasted into my thesis:
\renewbibmacro*{pageref}{%
\iflistundef{pageref}
{\renewcommand{\finentrypunct}{\addperiod}}
{\renewcommand{\finentrypunct}{\addspace}%
\printtext{\addperiod\hfill\rlap{\hskip15pt\colorbox{blue!5}{\scriptsize\printlist[pageref][-\value{listtotal}]{pageref}}}}}}
Any help is appreciated!
EDIT: Here is MWE showing the error
\documentclass{article}
\usepackage{times}
\usepackage{csquotes}
\usepackage{xcolor}
\pagecolor{white} %renders latex PDF in white background
\usepackage[style=numeric-comp,backref=true,backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{RN283,
author = {Sparkes, R. S. and Simon, M. and Cohn, V. H. and Fournier, R. E. and Lem, J. and Klisak, I. and Heinzmann, C. and Blatt, C. and Lucero, M. and Mohandas, T.},
title = {Assignment of the human and mouse prion protein genes to homologous chromosomes},
journal = {Proceedings of the National Academy of Sciences},
volume = {83},
number = {19},
pages = {7358},
DOI = {10.1073/pnas.83.19.7358},
url = {http://www.pnas.org/content/83/19/7358.abstract},
year = {1986},
type = {Journal Article}
}
@article{RN210,
author = {Stahl, Neil and Borchelt, David R. and Hsiao, Karen and Prusiner, Stanley B.},
title = {Scrapie prion protein contains a phosphatidylinositol glycolipid},
journal = {Cell},
volume = {51},
number = {2},
pages = {229-240},
ISSN = {0092-8674},
DOI = {https://doi.org/10.1016/0092-8674(87)90150-4},
url = {http://www.sciencedirect.com/science/article/pii/0092867487901504},
year = {1987},
type = {Journal Article}
}
\end{filecontents}
\addbibresource{\jobname.bib}
% pagereference in the right margin
\renewbibmacro*{pageref}{%
\iflistundef{pageref}
{\renewcommand{\finentrypunct}{\addperiod}}
{\renewcommand{\finentrypunct}{\addspace}%
\printtext{\addperiod\hfill\rlap{\hskip15pt\colorbox{blue!5}{\scriptsize\printlist[pageref][-\value{listtotal}]{pageref}}}}}}
\begin{document}
Example citation \cite{RN283, RN210}
\printbibliography
\end{document}


