blob: 8eca3a28ee8f1ca54c9675a1b5a0b59f6a932c61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "input.h"
#include <util/generic/yexception.h>
namespace NSQLComplete {
TCompletionInput SharpedInput(TString& text) {
constexpr char delim = '#';
size_t pos = text.find_first_of(delim);
if (pos == TString::npos) {
return {
.Text = text,
};
}
Y_ENSURE(!TStringBuf(text).Tail(pos + 1).Contains(delim));
text.erase(std::begin(text) + pos);
return {
.Text = text,
.CursorPosition = pos,
};
}
} // namespace NSQLComplete
|