16 for (
auto it = _dictionary.begin();
it != _dictionary.end(); ++
it)
18 it = find_if(
it, _dictionary.end(), [&](
string elemnt) ->
bool {
19 return (elemnt.compare(0, word.size(), word) == 0) ? true : false;
22 if (
it != _dictionary.end())
24 if (
it->compare(word) == 0)
27 finds.push_back(
it->substr(word.size(),
it->size()));
39 : _dictionary(dictionary), _history_words_index(0), _num_of_chars2_in_line(0), _tab_index(0), _is_first_time_up_arrow(true), _bypass(bypass)
45 temp_chars2_queue.push_back(
'\0');
46 auto word =
string(temp_chars2_queue.data());
62 for (
auto i = 0;
i < num_of_backspaces; ++
i)
127 auto ch =
static_cast<char>(_getch_nolock());
130 vector<uint8_t> vec_ch = {
static_cast<uint8_t>(_getch_nolock())};
137 auto fd = fileno(stdin);
139 struct termios old_settings, new_settings;
140 tcgetattr(fd, &old_settings);
141 new_settings = old_settings;
142 new_settings.c_lflag &= (~ICANON & ~ECHO);
144 tcsetattr(fd, TCSANOW, &new_settings);
156 auto res = select(fd+1, &fds,
NULL,
NULL, &tv );
157 if((res > 0) && (FD_ISSET(fd, &fds)))
160 auto num_of_chars = read(fd, ch, 10 );
161 tcsetattr(fd, TCSAFLUSH, &old_settings );
162 if (num_of_chars == 1)
166 vector<uint8_t> vec_ch;
167 for (
auto i = 0;
i < num_of_chars; ++
i)
168 vec_ch.push_back(ch[
i]);
173 tcsetattr(fd, TCSAFLUSH, &old_settings );
186 std::getline(std::cin, res);
222 for (
auto c : vec_word)
260 else if (isprint(ch))