diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
commit | 133a45c109da5310add55824db21af5239951f93 (patch) | |
tree | ba6ac4c0a950a0dda56451944315d66409923918 /contrib/replxx/src/prompt.hxx | |
parent | Initial commit. (diff) | |
download | rspamd-133a45c109da5310add55824db21af5239951f93.tar.xz rspamd-133a45c109da5310add55824db21af5239951f93.zip |
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/replxx/src/prompt.hxx')
-rw-r--r-- | contrib/replxx/src/prompt.hxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/replxx/src/prompt.hxx b/contrib/replxx/src/prompt.hxx new file mode 100644 index 0000000..9ed3f5f --- /dev/null +++ b/contrib/replxx/src/prompt.hxx @@ -0,0 +1,45 @@ +#ifndef REPLXX_PROMPT_HXX_INCLUDED +#define REPLXX_PROMPT_HXX_INCLUDED 1 + +#include <cstdlib> + +#include "unicodestring.hxx" +#include "terminal.hxx" + +namespace replxx { + +class Prompt { // a convenience struct for grouping prompt info +public: + UnicodeString _text; // our copy of the prompt text, edited + int _characterCount; // visible characters in _text + int _extraLines; // extra lines (beyond 1) occupied by prompt + int _lastLinePosition; // index into _text where last line begins + int _cursorRowOffset; // where the cursor is relative to the start of the prompt +private: + int _screenColumns; // width of screen in columns [cache] + Terminal& _terminal; +public: + Prompt( Terminal& ); + void set_text( UnicodeString const& textPtr ); + void update_state(); + void update_screen_columns( void ); + int screen_columns() const { + return ( _screenColumns ); + } + void write(); + int indentation() const; +}; + +// changing prompt for "(reverse-i-search)`text':" etc. +// +struct DynamicPrompt : public Prompt { + UnicodeString _searchText; // text we are searching for + int _direction; // current search _direction, 1=forward, -1=reverse + + DynamicPrompt( Terminal&, int initialDirection ); + void updateSearchPrompt(void); +}; + +} + +#endif |