From aca9ec43b71c52e0f92b43e737fc019fcce4c679 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Fri, 1 Jan 2021 21:52:43 -0300 Subject: [PATCH] Considers selected text when inserting keycode (ctrlk). --- source/ide/ide_methods.bas | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 3c62e3572..83d270899 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -4908,13 +4908,21 @@ FUNCTION ide2 (ignore) LOOP UNTIL tempk <> 0 END IF tempk$ = LTRIM$(tempk$) + + 'insert + IF ideselect THEN GOSUB delselect a$ = idegetline(idecy) - DO UNTIL LEN(a$) >= idecx: a$ = a$ + " ": LOOP 'add spaces if necessary to the end of a$ so we insert in the proper position. - l$ = LEFT$(a$, idecx - 1): r$ = RIGHT$(a$, LEN(a$) - idecx + 1) - text$ = l$ + tempk$ + r$ - idesetline idecy, text$ - idecx = idecx + len(tempk$) + IF LEN(a$) < idecx - 1 THEN a$ = a$ + SPACE$(idecx - 1 - LEN(a$)) + a$ = LEFT$(a$, idecx - 1) + tempk$ + RIGHT$(a$, LEN(a$) - idecx + 1) + idesetline idecy, a$ + + IF PasteCursorAtEnd THEN + 'Place the cursor at the end of the inserted content: + idecx = idecx + LEN(tempk$) + END IF + idechangemade = 1 + dummy = DarkenFGBG(0) PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt retval = 1