int get_ext_cmd(void) -- Get an extended command in a window-port specific way. An index into extcmdlist[] is returned on a successful selection, -1 otherwise. */
| 1794 | selection, -1 otherwise. |
| 1795 | */ |
| 1796 | int |
| 1797 | mswin_get_ext_cmd(void) |
| 1798 | { |
| 1799 | char cmd[BUFSZ]; |
| 1800 | int ret; |
| 1801 | logDebug("mswin_get_ext_cmd()\n"); |
| 1802 | |
| 1803 | if (!iflags.wc_popup_dialog) { |
| 1804 | char c; |
| 1805 | int i, len; |
| 1806 | int createcaret; |
| 1807 | |
| 1808 | createcaret = 1; |
| 1809 | SendMessage(mswin_hwnd_from_winid(WIN_MESSAGE), WM_MSNH_COMMAND, |
| 1810 | (WPARAM) MSNH_MSG_CARET, (LPARAM) &createcaret); |
| 1811 | |
| 1812 | cmd[0] = '\0'; |
| 1813 | i = -2; |
| 1814 | mswin_clear_nhwindow(WIN_MESSAGE); |
| 1815 | mswin_putstr_ex(WIN_MESSAGE, ATR_BOLD, "#", 0); |
| 1816 | len = 0; |
| 1817 | ShowCaret(mswin_hwnd_from_winid(WIN_MESSAGE)); |
| 1818 | while (i == -2) { |
| 1819 | int oindex, com_index; |
| 1820 | c = mswin_nhgetch(); |
| 1821 | switch (c) { |
| 1822 | case VK_ESCAPE: |
| 1823 | i = -1; |
| 1824 | break; |
| 1825 | case '\n': |
| 1826 | case '\r': |
| 1827 | case -115: |
| 1828 | for (i = 0; extcmdlist[i].ef_txt != (char *) 0; i++) |
| 1829 | if (!strcmpi(cmd, extcmdlist[i].ef_txt)) |
| 1830 | break; |
| 1831 | |
| 1832 | if (extcmdlist[i].ef_txt == (char *) 0) { |
| 1833 | pline("%s%s: unknown extended command.", |
| 1834 | visctrl(extcmd_initiator()), cmd); |
| 1835 | i = -1; |
| 1836 | } |
| 1837 | break; |
| 1838 | default: |
| 1839 | if (cmd[0]) |
| 1840 | mswin_putstr_ex(WIN_MESSAGE, ATR_BOLD, cmd, |
| 1841 | -(int) strlen(cmd)); |
| 1842 | if (c == VK_BACK) { |
| 1843 | if (len > 0) |
| 1844 | len--; |
| 1845 | cmd[len] = '\0'; |
| 1846 | } else { |
| 1847 | cmd[len++] = c; |
| 1848 | cmd[len] = '\0'; |
| 1849 | /* Find a command with this prefix in extcmdlist */ |
| 1850 | com_index = -1; |
| 1851 | for (oindex = 0; extcmdlist[oindex].ef_txt != (char *) 0; |
| 1852 | oindex++) { |
| 1853 | if ((extcmdlist[oindex].flags & AUTOCOMPLETE) |
nothing calls this directly
no test coverage detected