Skip to content

Commit 4783ad6

Browse files
Create rough solution for handling non-printing characters in results
1 parent 9f0a975 commit 4783ad6

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

extensions/ql-vscode/src/view/RawTableValue.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,28 @@ interface Props {
1010

1111
export default function RawTableValue(props: Props): JSX.Element {
1212
const v = props.value;
13+
const codes: { [key: string]: any } = {
14+
'\n': 'U+000A',
15+
'\b': 'U+2084',
16+
'\0': 'U+0000'
17+
};
18+
1319
if (
1420
typeof v === 'string'
1521
|| typeof v === 'number'
1622
|| typeof v === 'boolean'
1723
) {
18-
return <span>{v.toString()}</span>;
24+
const text = v.toString();
25+
const newVal = text.split('');
26+
for (let i = 0; i < newVal.length; i++) {
27+
for (const char in codes) {
28+
if (char === newVal[i]) {
29+
newVal[i] = codes[char];
30+
}
31+
}
32+
}
33+
const cleanVal = newVal.join('');
34+
return <span>{cleanVal}</span>;
1935
}
2036

2137
return renderLocation(v.url, v.label, props.databaseUri);

0 commit comments

Comments
 (0)