@@ -105,7 +105,7 @@ export interface HoverifyOptions {
105105 /**
106106 * The position within the code view to jump to
107107 */
108- position : Position
108+ position : LineOrPositionOrRange
109109 /**
110110 * The code view
111111 */
@@ -233,7 +233,7 @@ export const createHoverifier = ({
233233 const allCodeMouseOvers = new Subject < MouseEventTrigger > ( )
234234 const allCodeClicks = new Subject < MouseEventTrigger > ( )
235235 const allPositionJumps = new Subject < {
236- position : Position
236+ position : LineOrPositionOrRange
237237 codeElement : HTMLElement
238238 scrollElement : HTMLElement
239239 resolveContext : ContextResolver
@@ -306,6 +306,14 @@ export const createHoverifier = ({
306306 codeElement : HTMLElement
307307 resolveContext : ContextResolver
308308 } > = allPositionJumps . pipe (
309+ // Only use line and character for comparison
310+ map ( ( { position : { line, character } , ...rest } ) => ( { position : { line, character } , ...rest } ) ) ,
311+ // Ignore same values
312+ // It's important to do this before filtering otherwise navigating from
313+ // a position, to a line-only position, back to the first position would get ignored
314+ distinctUntilChanged ( ( a , b ) => isEqual ( a , b ) ) ,
315+ // Ignore undefined or partial positions (e.g. line only)
316+ filter ( ( jump ) : jump is typeof jump & { position : Position } => Position . is ( jump . position ) ) ,
309317 map ( ( { position, codeElement, ...rest } ) => {
310318 const row = getRowInCodeElement ( codeElement , position . line )
311319 if ( ! row ) {
0 commit comments