cifkao commited on
Commit
068dd93
·
1 Parent(s): 8d095c3

Fix visualization issue with window shorter than text

Browse files
highlighted_text/src/HighlightedText.tsx CHANGED
@@ -82,7 +82,7 @@ class HighlightedText extends StreamlitComponentBase<HighlightedTextState> {
82
  const row = allScores[i].slice(0, hi);
83
  row.reverse();
84
  let result = [
85
- ...Array(Math.max(0, i - 1 - row.length)).fill(0),
86
  ...row.map((x) => x == undefined || isNaN(x) ? 0 : x)
87
  ];
88
  result = [...result, ...Array(tokens.length - result.length).fill(0)];
 
82
  const row = allScores[i].slice(0, hi);
83
  row.reverse();
84
  let result = [
85
+ ...Array(Math.max(0, i - row.length)).fill(0),
86
  ...row.map((x) => x == undefined || isNaN(x) ? 0 : x)
87
  ];
88
  result = [...result, ...Array(tokens.length - result.length).fill(0)];