Repository: microsoft/terminal
File: src/buffer/out/textBuffer.cpp (C++)

Code before:
        {
            (*mark.commandEnd).y += delta;
        }
        if (mark.outputEnd.has_value())
        {
            (*mark.outputEnd).y += delta;
        }
    }
    _trimMarksOutsideBuffer();
}

// Method Description:
// - Add a mark to our list of marks, and treat it as the active "prompt". For
//   the sake of shell integration, we need to know which mark represents the
//   current prompt/command/output. Internally, we'll always treat the _last_
//   mark in the list as the current prompt.
// Arguments:
// - m: the mark to add.
void TextBuffer::StartPromptMark(const ScrollMark& m)
{
    _marks.push_back(m);
}
// Method Description:
// - Add a mark to our list of marks. Don't treat this as the active prompt.
//   This sould be used for marks created by the UI or from other user input.
//   By inserting at the start of the list, we can seperate out marks that were
//   generated by client programs vs ones created by the user.
// Arguments:
// - m: the mark to add.
void TextBuffer::AddMark(const ScrollMark& m)
{
    _marks.insert(_marks.begin(), m);
}

void TextBuffer::_trimMarksOutsideBuffer()
{
    const auto height = GetSize().Height();
    _marks.erase(std::remove_if(_marks.begin(),
                                _marks.end(),
                                [height](const auto& m) {
                                    return (m.start.y < 0) ||
                                           (m.start.y >= height);
                                }),
                 _marks.end());
}

void TextBuffer::SetCurrentPromptEnd(const til::point pos) noexcept
{
    if (_marks.empty())
    {
        return;

Review comment (suggestion):
```suggestion
//   This should be used for marks created by the UI or from other user input.
//   By inserting at the start of the list, we can separate out marks that were
```

Code after:
        {
            (*mark.commandEnd).y += delta;
        }
        if (mark.outputEnd.has_value())
        {
            (*mark.outputEnd).y += delta;
        }
    }
    _trimMarksOutsideBuffer();
}

// Method Description:
// - Add a mark to our list of marks, and treat it as the active "prompt". For
//   the sake of shell integration, we need to know which mark represents the
//   current prompt/command/output. Internally, we'll always treat the _last_
//   mark in the list as the current prompt.
// Arguments:
// - m: the mark to add.
void TextBuffer::StartPromptMark(const ScrollMark& m)
{
    _marks.push_back(m);
}
// Method Description:
// - Add a mark to our list of marks. Don't treat this as the active prompt.
//   This should be used for marks created by the UI or from other user input.
//   By inserting at the start of the list, we can separate out marks that were
//   generated by client programs vs ones created by the user.
// Arguments:
// - m: the mark to add.
void TextBuffer::AddMark(const ScrollMark& m)
{
    _marks.insert(_marks.begin(), m);
}

void TextBuffer::_trimMarksOutsideBuffer()
{
    const auto height = GetSize().Height();
    _marks.erase(std::remove_if(_marks.begin(),
                                _marks.end(),
                                [height](const auto& m) {
                                    return (m.start.y < 0) ||
                                           (m.start.y >= height);
                                }),
                 _marks.end());
}

void TextBuffer::SetCurrentPromptEnd(const til::point pos) noexcept
{
    if (_marks.empty())
    {
        return;