diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2020-09-20 12:20:24 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-21 20:15:10 +0200 |
commit | fa96e57c156193566dafe00116933dd8a8d80c7f (patch) | |
tree | ef59f0e765334b728f8a0e58f8153a43b156631b /Libraries/LibGUI/TextDocument.cpp | |
parent | 5b6ccbb9184026578b1fc4110e72cd12b1144840 (diff) | |
download | serenity-fa96e57c156193566dafe00116933dd8a8d80c7f.zip |
LibGUI: Add optional placeholder to TextEditor
This lets you show some disabled text when no text is entered, and the
editor is not focused.
Diffstat (limited to 'Libraries/LibGUI/TextDocument.cpp')
-rw-r--r-- | Libraries/LibGUI/TextDocument.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibGUI/TextDocument.cpp b/Libraries/LibGUI/TextDocument.cpp index c16e757c41..10a5ffe497 100644 --- a/Libraries/LibGUI/TextDocument.cpp +++ b/Libraries/LibGUI/TextDocument.cpp @@ -675,6 +675,11 @@ void TextDocument::remove(const TextRange& unnormalized_range) notify_did_change(); } +bool TextDocument::is_empty() const +{ + return line_count() == 1 && line(0).is_empty(); +} + TextRange TextDocument::range_for_entire_line(size_t line_index) const { if (line_index >= line_count()) |