Skip to content

Commit

Permalink
fix: empty file highlighting error (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
xyJen authored and otakustay committed Dec 9, 2024
1 parent 090f443 commit 42e633f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Hunk/CodeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,20 @@ const defaultRenderToken: DefaultRenderToken = ({type, value, markType, properti
};

function isEmptyToken(tokens: TokenNode[]) {
if (!Array.isArray(tokens)) {
return true;
}

if (tokens.length > 1) {
return false;
}

const [token] = tokens;
return token.type === 'text' && !token.value;
if (tokens.length === 1) {
const [token] = tokens;
return token.type === 'text' && !token.value;
}

return true;
}

export interface CodeCellProps extends HTMLAttributes<HTMLTableCellElement> {
Expand Down

0 comments on commit 42e633f

Please sign in to comment.