display help page
| 3150 | |
| 3151 | // display help page |
| 3152 | bool Query::help() |
| 3153 | { |
| 3154 | Mode oldMode = mode_; |
| 3155 | |
| 3156 | mode_ = Mode::HELP; |
| 3157 | |
| 3158 | Screen::clear(); |
| 3159 | redraw(); |
| 3160 | |
| 3161 | bool ctrl_q = false; // CTRL-Q is pressed |
| 3162 | bool ctrl_o = false; // CTRL-O is pressed |
| 3163 | bool restart = false; // META key pressed, restart search when exiting the help screen |
| 3164 | |
| 3165 | while (mode_ == Mode::HELP) |
| 3166 | { |
| 3167 | int key; |
| 3168 | |
| 3169 | Screen::put(0, Screen::cols - 1, "?"); |
| 3170 | |
| 3171 | #ifdef OS_WIN |
| 3172 | |
| 3173 | while (true) |
| 3174 | { |
| 3175 | key = VKey::in(500); |
| 3176 | |
| 3177 | if (key > 0) |
| 3178 | break; |
| 3179 | |
| 3180 | // detect screen size changes |
| 3181 | int rows = Screen::rows; |
| 3182 | int cols = Screen::cols; |
| 3183 | |
| 3184 | Screen::getsize(); |
| 3185 | |
| 3186 | if (rows != Screen::rows || cols != Screen::cols) |
| 3187 | redraw(); |
| 3188 | } |
| 3189 | |
| 3190 | #else |
| 3191 | |
| 3192 | key = VKey::get(); |
| 3193 | |
| 3194 | #endif |
| 3195 | |
| 3196 | if (ctrl_o) |
| 3197 | { |
| 3198 | meta(key); |
| 3199 | ctrl_o = false; |
| 3200 | restart = true; |
| 3201 | } |
| 3202 | else if (key == VKey::CTRL_Q) |
| 3203 | { |
| 3204 | ctrl_q = true; |
| 3205 | break; |
| 3206 | } |
| 3207 | else if (key == VKey::ESC || key == VKey::CTRL_Z || key == VKey::FN(1)) |
| 3208 | { |
| 3209 | break; |
nothing calls this directly
no outgoing calls
no test coverage detected