microsoft/Terminal

[Audit] Use std::wstring_view for all global strings

Open

#2,674 建立於 2019年9月5日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)C++ (3,212 fork)batch import
Area-CodeHealthArea-SettingsHelp WantedIssue-TaskProduct-ConhostProduct-Terminal

倉庫指標

Star
 (35,764 star)
PR 合併指標
 (平均合併 27天 19小時) (30 天內合併 24 個 PR)

描述

I left this behind in the audit mode enable phase.

This is because changing the DEFAULT_FONT_FACE to a std::wstring_view cascades in a way that is troublesome.

For one, std::wstring_view is not guaranteed to be null terminated. Some of the consumers of this value throughout the codebase use the pointer to this memory location as a z-terminated string instead of a counted string. In the context of pointing to a globally allocated string, we can probably feel safe that it is null terminated and could ignore this. But I don't like ignoring things like this as they pop up later when refactoring occurs.

For two, changing the way the font face string works cascades through the entire FontInfo and friends classes in a way that touches many, many things. I don't really want to move all of that around without also addressing #602 at the same time because we've already identified that this particular value needs to change in those classes to satisfy that bug and circumstance.'

For three, we haven't even started talking about the cascading effects of doing this to the other three strings.

So for now, I've punted and left this TODO behind.

貢獻者指南