1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 11:30:37 +00:00

Makes F1 contextual help more flexible.

The detection of the keyword at the cursor will consider cases in which 
the cursor is just to the right of the last typed word.
This commit is contained in:
Fellippe Heitor 2021-01-26 22:53:30 -03:00
parent fe4c4996c9
commit e735ae1898

View file

@ -2445,10 +2445,6 @@ FUNCTION ide2 (ignore)
contextualhelp: contextualhelp:
IdeContextHelpSF = 0 IdeContextHelpSF = 0
'identify word or character at current cursor position 'identify word or character at current cursor position
a$ = idegetline(idecy)
x = idecx
IF LEN(a$) > 0 AND x = LEN(a$) + 1 THEN x = x - 1
IF x <= LEN(a$) THEN
a2$ = UCASE$(getWordAtCursor$) a2$ = UCASE$(getWordAtCursor$)
'check if F1 is in help links 'check if F1 is in help links
fh = FREEFILE fh = FREEFILE
@ -2479,6 +2475,7 @@ FUNCTION ide2 (ignore)
IF lnk$ = "C" THEN GOTO ideloop IF lnk$ = "C" THEN GOTO ideloop
END IF END IF
IF INSTR(UCASE$(lnk$), "PARENTHESIS") THEN GOTO ideloop
OpenHelpLnk: OpenHelpLnk:
@ -2614,8 +2611,6 @@ FUNCTION ide2 (ignore)
END IF END IF
NoKeywordFound: NoKeywordFound:
END IF 'lnks END IF 'lnks
END IF
GOTO specialchar GOTO specialchar
END IF END IF
@ -13147,7 +13142,7 @@ SUB IdeMakeContextualMenu
IF LEN(l2$) > 15 THEN IF LEN(l2$) > 15 THEN
l2$ = LEFT$(l2$, 12) + STRING$(3, 250) l2$ = LEFT$(l2$, 12) + STRING$(3, 250)
END IF END IF
IF INSTR(l2$, "Parenthesis") = 0 THEN IF INSTR(l2$, "PARENTHESIS") = 0 THEN
menu$(m, i) = "#Help On '" + l2$ + "'": i = i + 1 menu$(m, i) = "#Help On '" + l2$ + "'": i = i + 1
END IF END IF
END IF END IF
@ -14416,6 +14411,10 @@ FUNCTION getWordAtCursor$
a$ = idegetline(idecy) a$ = idegetline(idecy)
x = idecx x = idecx
IF x <= LEN(a$) THEN IF x <= LEN(a$) THEN
IF ASC(a$, x) = 32 AND x > 1 THEN
IF ASC(a$, x - 1) <> 32 THEN x = x - 1
END IF
try:
IF alphanumeric(ASC(a$, x)) THEN IF alphanumeric(ASC(a$, x)) THEN
x1 = x x1 = x
DO WHILE x1 > 1 DO WHILE x1 > 1
@ -14430,6 +14429,8 @@ FUNCTION getWordAtCursor$
a2$ = CHR$(ASC(a$, x)) a2$ = CHR$(ASC(a$, x))
END IF END IF
getWordAtCursor$ = a2$ 'a2$ now holds the word or character at current cursor position getWordAtCursor$ = a2$ 'a2$ now holds the word or character at current cursor position
ELSEIF x = LEN(a$) + 1 AND x > 1 THEN
IF ASC(a$, x - 1) <> 32 THEN x = x - 1: GOTO try
END IF END IF
END FUNCTION END FUNCTION