# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Preferences/PreferencesAdvancedView+JoinItems.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  PreferencesAdvancedView+JoinItems.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 11/4/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import RxCocoa

    10

    import RxSwift

    11

    12

    extension PreferencesAdvancedView {

    13

    14

    50

        func setupJoinStringTextField() {

    15

    50

            self.joinAndWrapSectionTitle.stringValue = "preferences_multi_clip_join_and_wrap_section_title".l7n

    16

    50

    17

    50

            self.joinAndWrapNote.stringValue = "preferences_multi_clip_join_and_wrap_section_note".l7n

    18

    50

    19

    50

            self.joinClipsTitle.stringValue = "preferences_multi_clip_join_title".l7n

    20

    50

    21

    50

            let useJoinString = prefs.useJoinString

    22

    50

    23

    50

            self.joinStyleSelector.setLabel("preferences_multi_clip_joined_by_newline".l7n, forSegment: 0)

    24

    50

            self.joinStyleSelector.setLabel("preferences_multi_clip_joined_by_string".l7n, forSegment: 1)

    25

    50

            self.joinStyleSelector.selectSegment(withTag: useJoinString ? 1 : 0)

    26

    50

    27

    50

            self.joinStringTextField.isEnabled = useJoinString

    28

    50

            self.joinStringTextField.isHidden = !useJoinString

    29

    50

            self.joinStringTextField.placeholderString = "preferences_multi_clip_joined_by_string_placeholder".l7n

    30

    50

    31

    50

            if let joinString = prefs.multiJoinString {

    32

    0

                self.joinStringTextField.stringValue = joinString

    33

    0

                self.joinStringTextField.isHidden = !useJoinString

    34

    0

                self.joinStringTextField.isEnabled = useJoinString

    35

    50

            }

    36

    50

    37

    50

            self.joinStringTextField.rx.text

    38

    50

                .distinctUntilChanged { lhs, rhs in rhs == lhs }

    39

    50

                .subscribe(onNext: { text in

    40

    50

                    if self.joinStringTextField.isEnabled {

    41

    0

                        self.prefs.multiJoinString = text

    42

    50

                    }

    43

    50

                })

    44

    50

                .disposed(by: self.disposeBag)

    45

    50

        }

    46

    }