MCPcopy Create free account
hub / github.com/Kitware/CMake / OnTab

Method OnTab

Source/CursesDialog/cmCursesPathWidget.cxx:37–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
38{
39 if (!this->GetString()) {
40 return;
41 }
42 FORM* form = fm->GetForm();
43 form_driver(form, REQ_NEXT_FIELD);
44 form_driver(form, REQ_PREV_FIELD);
45 std::string cstr = this->GetString();
46 cstr = cstr.substr(0, cstr.find_last_not_of(" \t\n\r") + 1);
47 if (this->LastString != cstr) {
48 this->Cycle = false;
49 this->CurrentIndex = 0;
50 this->LastGlob = "";
51 }
52 std::string glob;
53 if (this->Cycle) {
54 glob = this->LastGlob;
55 } else {
56 glob = cstr + "*";
57 }
58 std::vector<std::string> dirs;
59
60 cmSystemTools::SimpleGlob(glob, dirs,
61 (this->Type == cmStateEnums::PATH ? -1 : 0));
62 if (this->CurrentIndex < dirs.size()) {
63 cstr = dirs[this->CurrentIndex];
64 }
65 if (cstr[cstr.size() - 1] == '*') {
66 cstr = cstr.substr(0, cstr.size() - 1);
67 }
68
69 if (cmSystemTools::FileIsDirectory(cstr)) {
70 cstr += "/";
71 }
72
73 this->SetString(cstr);
74 touchwin(w);
75 wrefresh(w);
76 form_driver(form, REQ_END_FIELD);
77 this->LastGlob = glob;
78 this->LastString = cstr;
79 this->Cycle = true;
80 this->CurrentIndex++;
81 if (this->CurrentIndex >= dirs.size()) {
82 this->CurrentIndex = 0;
83 }
84}
85
86void cmCursesPathWidget::OnReturn(cmCursesMainForm* fm, WINDOW* w)
87{

Callers

nothing calls this directly

Calls 9

form_driverFunction · 0.85
touchwinFunction · 0.85
wrefreshFunction · 0.85
GetFormMethod · 0.80
find_last_not_ofMethod · 0.80
GetStringMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45
SetStringMethod · 0.45

Tested by

no test coverage detected