xaizek / libcursedrl (License: GPLv3+) (since 2019-03-24)
libcursed extension for integration with readline.
Commit 6470187b60113b74d88f5c36156be3d932af1531

Move history functions to cursedrl::PromptHistory
A new namespace. This breaks existing code.
Author: xaizek
Author date (UTC): 2022-06-25 21:25
Committer name: xaizek
Committer date (UTC): 2022-06-25 21:26
Parent(s): 6b93b309df1fd2f3c3e9cad98425139e0a78b6e6
Signing key: 99DC5E4DB05F6BE2
Tree: 4792515fac806579f70851f83cdd85cda7dcd27c
File Lines added Lines deleted
PromptRequest.cpp 4 8
PromptRequest.hpp 8 6
File PromptRequest.cpp changed (mode: 100644) (index aaf8c27..f1ae7ee)
... ... private:
94 94 } }
95 95
96 96 void void
97 PromptRequest::loadHistory(const std::string &path)
98 {
99 static_cast<void>(read_history(path.c_str()));
100 }
97 PromptHistory::load(const std::string &path)
98 { static_cast<void>(read_history(path.c_str())); }
101 99
102 100 void void
103 PromptRequest::saveHistory(const std::string &path)
104 {
105 static_cast<void>(write_history(path.c_str()));
106 }
101 PromptHistory::save(const std::string &path)
102 { static_cast<void>(write_history(path.c_str())); }
107 103
108 104 PromptResult::PromptResult(std::wstring input, bool accepted) PromptResult::PromptResult(std::wstring input, bool accepted)
109 105 : input(std::move(input)), accepted(accepted) : input(std::move(input)), accepted(accepted)
File PromptRequest.hpp changed (mode: 100644) (index c15eb62..c8e8b04)
... ... class Screen;
35 35
36 36 namespace cursedrl { namespace cursedrl {
37 37
38 // Groups history management functions.
39 namespace PromptHistory {
40 // Loads history from the file.
41 void load(const std::string &path);
42 // Stores history to the file.
43 void save(const std::string &path);
44 };
45
38 46 // Describes result of a prompt request. // Describes result of a prompt request.
39 47 class PromptResult class PromptResult
40 48 { {
 
... ... public:
79 87 PromptRequest & operator=(const PromptRequest &rhs) = delete; PromptRequest & operator=(const PromptRequest &rhs) = delete;
80 88 PromptRequest & operator=(PromptRequest &&rhs) = delete; PromptRequest & operator=(PromptRequest &&rhs) = delete;
81 89
82 public:
83 // Loads history from the file.
84 static void loadHistory(const std::string &path);
85 // Stores history to the file.
86 static void saveHistory(const std::string &path);
87
88 90 public: public:
89 91 // Sets callback to be invoked when input is changed. // Sets callback to be invoked when input is changed.
90 92 void setOnInputChanged(inputChangedFunc newOnInputChanged); void setOnInputChanged(inputChangedFunc newOnInputChanged);
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/libcursedrl

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/libcursedrl

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master