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.

贡献者指南