Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@
if (value === null || value === undefined) {
return 'null'
}
return String(value)
const str = String(value)
// Escape special whitespace so they display visibly in single-line widgets.
// Widgets that support multi-line display (e.g. TextboxWidget) set
// escapeSpecialCharacters: false in their data() to opt out.
if (this.escapeSpecialCharacters !== false) {
return str.replace(/\r\n/g, '\\r\\n').replace(/\r/g, '\\r').replace(/\n/g, '\\n').replace(/\t/g, '\\t')

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYX&open=AZ4n6U1HHE4tGNmZvdYX&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYW&open=AZ4n6U1HHE4tGNmZvdYW&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYa&open=AZ4n6U1HHE4tGNmZvdYa&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYY&open=AZ4n6U1HHE4tGNmZvdYY&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYZ&open=AZ4n6U1HHE4tGNmZvdYZ&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYb&open=AZ4n6U1HHE4tGNmZvdYb&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYV&open=AZ4n6U1HHE4tGNmZvdYV&pullRequest=3373

Check warning on line 45 in openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/FormatValueBase.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`String.raw` should be used to avoid escaping `\`.

See more on https://sonarcloud.io/project/issues?id=OpenC3_cosmos&issues=AZ4n6U1HHE4tGNmZvdYc&open=AZ4n6U1HHE4tGNmZvdYc&pullRequest=3373
}
return str
},
// sprintf-js doesn't support BigInt values so we handle common
// integer format specifiers manually to preserve full precision
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default {
return {
width: 200,
height: 200,
// Allow actual newlines to render as line breaks in v-textarea
escapeSpecialCharacters: false,
}
},
computed: {
Expand Down