Skip to content

Commit d4a9955

Browse files
author
Nick Kibysh
committed
fixed issue with dropped empty strings between EOLs
1 parent 36c278f commit d4a9955

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

nRF Toolbox/Profiles/UART/Model/UARTCommandModel.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct TextCommand: UARTCommandModel, Equatable {
8181
])
8282
}
8383

84-
var title: String { text }
84+
var title: String { text.split(whereSeparator: \.isNewline).joined() }
8585

8686
var data: Data {
8787
text.data(using: .utf8)!

nRF Toolbox/Profiles/UART/NewCommand/UARTNewCommandViewController.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ class UARTNewCommandViewController: UIViewController {
116116
let image = CommandImage.allCases[selectedItem]
117117

118118
if typeSegmentControl.selectedSegmentIndex == 0 {
119-
let text = textView.text.split(separator: "\n").joined(separator: self.eolSymbol())
119+
let slices = textView.text.split(omittingEmptySubsequences: false, whereSeparator: \.isNewline)
120+
let text = slices.joined(separator: eolSymbol())
121+
120122
command = TextCommand(text: text, image: image, eol: self.eolSymbol())
121123
} else {
122124
command = DataCommand(data: Data(valueTextField.text!.hexa), image: image)

0 commit comments

Comments
 (0)