From ffc3d830fdf973a43f8359244059abd7a5791075 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 29 Jul 2022 09:05:58 +0200 Subject: [PATCH] Use escape sequence \x1b to clear messenger widget --- src/property/Property.cpp | 8 ++++++++ src/property/Property.h | 8 ++++++++ src/property/types/CloudString.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/src/property/Property.cpp b/src/property/Property.cpp index 243c2ab47..833d9c68d 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -55,6 +55,14 @@ Property::Property() } +/****************************************************************************** + CONST + ******************************************************************************/ +namespace PropertyActions +{ + const String CLEAR = "\x1b"; +} + /****************************************************************************** PUBLIC MEMBER FUNCTIONS ******************************************************************************/ diff --git a/src/property/Property.h b/src/property/Property.h index bc7aa665a..6571bf625 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -51,6 +51,14 @@ #define appendAttribute(x) appendAttributeReal(x, getAttributeName(#x, '.'), encoder) #define setAttribute(x) setAttributeReal(x, getAttributeName(#x, '.')) +/****************************************************************************** + CONST + ******************************************************************************/ +namespace PropertyActions +{ + extern const String CLEAR; +} + /****************************************************************************** ENUM ******************************************************************************/ diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index 027179411..f07f59ccf 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -46,6 +46,9 @@ class CloudString : public Property { operator String() const { return _value; } + void clear() { + _value = PropertyActions::CLEAR; + } virtual bool isDifferentFromCloud() { return _value != _cloud_value; }