diff --git a/src/getDisplayResults.js b/src/getDisplayResults.js index e3db1f3..9ba592e 100644 --- a/src/getDisplayResults.js +++ b/src/getDisplayResults.js @@ -1,11 +1,26 @@ const fp = require('lodash/fp'); +const CHARCODE_SPACE = 32; +const CHARCODE_TAB = 9; +const CHARCODE_LINE_FEED = 10; +const CHARCODE_LINE_TABULATION = 11; +const CHARCODE_FORM_FEED = 12; +const CHARCODE_CARRIAGE_RETURN = 13; + +const PRINTABLE_WHITESPACE_CHARACTERS = [ + CHARCODE_SPACE, + CHARCODE_TAB, + CHARCODE_LINE_FEED, + CHARCODE_LINE_TABULATION, + CHARCODE_FORM_FEED, + CHARCODE_CARRIAGE_RETURN +]; + const getByteArrayDisplayResults = (resultValue) => { const stringifiedByteArray = String.fromCharCode.apply( null, - resultValue.filter((x) => x > 32) + resultValue.filter((x) => x > 31 || PRINTABLE_WHITESPACE_CHARACTERS.includes(x)) ); - return { displayResult: stringifiedByteArray, outputLength: fp.flow(fp.toString, fp.size)(stringifiedByteArray), diff --git a/styles/style.less b/styles/style.less index 685bbe3..81d4c96 100644 --- a/styles/style.less +++ b/styles/style.less @@ -844,7 +844,7 @@ pre { &.output { line-height: 15px; - font-size: 11px; + font-size: 12px; .output-title { margin-bottom: 4px; @@ -1135,6 +1135,7 @@ pre { .show-whitespace { white-space: pre-wrap; word-wrap: break-word; + font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; } .error-message {