Apply suggestions from code review

Co-authored-by: Tushar Maheshwari <tushar27192@gmail.com>
This commit is contained in:
Arthur Sonzogni
2021-08-08 22:39:06 +02:00
committed by GitHub
parent cfeb771611
commit a11602d505
3 changed files with 5 additions and 7 deletions

View File

@@ -102,8 +102,8 @@ class ConstStringListRef {
} }
private: private:
const std::vector<std::string>* const ref_ = nullptr; const std::vector<std::string>* ref_ = nullptr;
const std::vector<std::wstring>* const ref_wide_ = nullptr; const std::vector<std::wstring>* ref_wide_ = nullptr;
}; };
} // namespace ftxui } // namespace ftxui

View File

@@ -16,9 +16,7 @@ Event Event::Character(std::string input) {
// static // static
Event Event::Character(char c) { Event Event::Character(char c) {
std::string input; return Event::Character(std::string{c});
input += c;
return Event::Character(input);
} }
// static // static

View File

@@ -28,7 +28,7 @@ class Text : public Node {
int y = box_.y_min; int y = box_.y_min;
if (y > box_.y_max) if (y > box_.y_max)
return; return;
for (auto cell : Utf8ToGlyphs(text_)) { for (const auto& cell : Utf8ToGlyphs(text_)) {
if (x > box_.x_max) if (x > box_.x_max)
return; return;
screen.PixelAt(x, y).character = cell; screen.PixelAt(x, y).character = cell;
@@ -43,7 +43,7 @@ class Text : public Node {
class VText : public Node { class VText : public Node {
public: public:
VText(std::string text) : text_(text) { VText(std::string text) : text_(text) {
width_ = string_width(text_) ? 1 : 0; width_{std::min(string_width(text_), 1)}
} }
void ComputeRequirement() override { void ComputeRequirement() override {