|
31 | 31 | #define TWISTY2_CLOSE " < " |
32 | 32 | #define TWISTY1_LEN 2 |
33 | 33 | #define TWISTY2_LEN 4 |
| 34 | +#define HELP_BG 0x73c990 |
| 35 | +#define HELP_FG 0x20242a |
34 | 36 |
|
35 | 37 | int g_themeId = 0; |
36 | 38 | int g_lineMarker[MAX_MARKERS] = { |
@@ -1447,7 +1449,7 @@ TextEditHelpWidget::TextEditHelpWidget(TextEditInput *editor, int chW, int chH, |
1447 | 1449 | _editor(editor), |
1448 | 1450 | _openPackage(NULL), |
1449 | 1451 | _openKeyword(-1) { |
1450 | | - _theme = new EditTheme(0x73c990, 0x20242a); |
| 1452 | + _theme = new EditTheme(HELP_BG, HELP_FG); |
1451 | 1453 | hide(); |
1452 | 1454 | if (overlay) { |
1453 | 1455 | _x = editor->_width - (chW * HELP_WIDTH); |
@@ -1574,12 +1576,31 @@ void TextEditHelpWidget::createCompletionHelp() { |
1574 | 1576 | char *selection = _editor->getWordBeforeCursor(); |
1575 | 1577 | int len = selection != NULL ? strlen(selection) : 0; |
1576 | 1578 | if (len > 0) { |
| 1579 | + StringList words; |
1577 | 1580 | for (int i = 0; i < keyword_help_len; i++) { |
1578 | 1581 | if (strncasecmp(selection, keyword_help[i].keyword, len) == 0) { |
| 1582 | + words.add(keyword_help[i].keyword); |
1579 | 1583 | _buf.append(keyword_help[i].keyword); |
1580 | 1584 | _buf.append("\n", 1); |
1581 | 1585 | } |
1582 | 1586 | } |
| 1587 | + const char *found = strstr(_editor->getText(), selection); |
| 1588 | + while (found != NULL) { |
| 1589 | + const char *end = found; |
| 1590 | + while (!IS_WHITE(*end) && *end != '\0') { |
| 1591 | + end++; |
| 1592 | + } |
| 1593 | + if (end - found > len) { |
| 1594 | + String next; |
| 1595 | + next.append(found, end - found); |
| 1596 | + if (!words.exists(next)) { |
| 1597 | + words.add(next); |
| 1598 | + _buf.append(found, end - found); |
| 1599 | + _buf.append("\n", 1); |
| 1600 | + } |
| 1601 | + } |
| 1602 | + found = strstr(found + len, selection); |
| 1603 | + } |
1583 | 1604 | } else { |
1584 | 1605 | const char *package = NULL; |
1585 | 1606 | for (int i = 0; i < keyword_help_len; i++) { |
|
0 commit comments