From aebb18088b9a0b14e1541d3b90ab63d7f4bc46d4 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 01:29:21 -0200 Subject: [PATCH 01/18] Fix to dialog textboxes clipboard/selection behavior. - Add Ctrl+A to select all. - Add Ctrl+X to cut. - Copy and Paste rewritten with selections in mind. --- source/ide/ide_methods.bas | 77 ++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 112f5de83..d536fd5e6 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7197,10 +7197,66 @@ IF t = 1 THEN 'text field END IF END IF END IF 'mousedown + + a$ = idetxt(o.txt) IF focusoffset = 0 THEN - a$ = idetxt(o.txt) IF LEN(kk$) = 1 THEN k = ASC(kk$) + IF (KSHIFT AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(kk$) = "V") THEN 'paste from clipboard + clip$ = _CLIPBOARD$ 'read clipboard + x = INSTR(clip$, CHR$(13)) + IF x THEN clip$ = LEFT$(clip$, x - 1) + x = INSTR(clip$, CHR$(10)) + IF x THEN clip$ = LEFT$(clip$, x - 1) + IF LEN(clip$) THEN + IF o.issel THEN + sx1 = o.sx1: sx2 = o.v1 + if sx1 > sx2 then SWAP sx1, sx2 + if sx2 - sx1 > 0 then + a$ = left$(a$, sx1) + clip$ + right$(a$, len(a$) - sx2) + o.v1 = sx1 + o.issel = 0 + end if + ELSE + a$ = left$(a$, o.v1) + clip$ + right$(a$, len(a$) - o.v1) + END IF + END IF + k = 255 + END IF + + IF (KCONTROL AND UCASE$(kk$) = "A") THEN 'select all + if len(a$) > 0 then + o.issel = -1 + o.sx1 = 0 + o.v1 = len(a$) + END IF + k = 255 + END IF + + IF ((KCTRL AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(kk$) = "C")) THEN 'copy to clipboard + IF o.issel THEN + sx1 = o.sx1: sx2 = o.v1 + if sx1 > sx2 then SWAP sx1, sx2 + if sx2 - sx1 > 0 then _CLIPBOARD$ = mid$(a$, sx1 + 1, sx2 - sx1) + END IF + k = 255 + END IF + + IF ((KSHIFT AND KB = KEY_DELETE) OR (KCONTROL AND UCASE$(kk$) = "X")) THEN 'cut to clipboard + IF o.issel THEN + sx1 = o.sx1: sx2 = o.v1 + if sx1 > sx2 then SWAP sx1, sx2 + if sx2 - sx1 > 0 then + _CLIPBOARD$ = mid$(a$, sx1 + 1, sx2 - sx1) + 'delete selection + a$ = left$(a$, sx1) + right$(a$, len(a$) - sx2) + o.v1 = sx1 + o.issel = 0 + end if + END IF + k = 255 + END IF + IF k = 8 AND o.v1 > 0 THEN if o.issel THEN sx1 = o.sx1: sx2 = o.v1 @@ -7208,7 +7264,6 @@ IF t = 1 THEN 'text field if sx2 - sx1 > 0 then 'delete selection a$ = left$(a$, sx1) + right$(a$, len(a$) - sx2) - idetxt(o.txt) = a$ o.issel = 0 end if else @@ -7222,7 +7277,6 @@ IF t = 1 THEN 'text field if sx2 - sx1 > 0 then 'delete selection a$ = left$(a$, sx1) + right$(a$, len(a$) - sx2) - idetxt(o.txt) = a$ o.issel = 0 end if END IF @@ -7263,23 +7317,6 @@ IF t = 1 THEN 'text field end if END IF - IF (KSHIFT AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "V") THEN 'paste from clipboard - clip$ = _CLIPBOARD$ 'read clipboard - x = INSTR(clip$, CHR$(13)) - IF x THEN clip$ = LEFT$(clip$, x - 1) - x = INSTR(clip$, CHR$(10)) - IF x THEN clip$ = LEFT$(clip$, x - 1) - IF LEN(clip$) THEN - a$ = clip$ - idetxt(o.txt) = a$ - o.v1 = LEN(a$) - END IF - END IF - - IF ((KCTRL AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "C")) THEN 'copy to clipboard - _CLIPBOARD$ = idetxt(o.txt) - END IF - 'cursor control if kk$ = CHR$(0) + "K" THEN GOSUB selectcheck: o.v1 = o.v1 - 1 IF kk$ = CHR$(0) + "M" THEN GOSUB selectcheck: o.v1 = o.v1 + 1 From 26a66813bc857accc896f621b5a061e99e1d356c Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 14:38:19 -0200 Subject: [PATCH 02/18] Add extended textbox functionality to the quick search field. --- source/ide/ide_methods.bas | 224 ++++++++++++++++++++++++++++++------- 1 file changed, 182 insertions(+), 42 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index d536fd5e6..77e36ed9b 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -104,6 +104,11 @@ END FUNCTION FUNCTION ide2 (ignore) STATIC MenuLocations as STRING +STATIC idesystem2.issel AS _BYTE +STATIC idesystem2.sx1 AS LONG +STATIC idesystem2.v1 AS LONG + +CONST idesystem2.w = 20 c$ = idecommand$ @@ -118,8 +123,6 @@ IF ideerror THEN END IF ideerror = 1 'unknown IDE error - - IF LEFT$(c$, 1) = CHR$(12) THEN f$ = RIGHT$(c$, LEN(c$) - 1) LOCATE , , 0 @@ -756,16 +759,38 @@ DO COLOR 1, 7: LOCATE 2, ((idewx / 2) - 1) - (LEN(a$) - 1) \ 2: PRINT a$; 'update search bar - LOCATE idewy - 4, idewx - 30 + LOCATE idewy - 4, idewx - (idesystem2.w + 10) COLOR 7, 1: PRINT chr$(180); - COLOR 3, 1: PRINT "Find[ " + chr$(18) + "]"; + COLOR 3, 1: PRINT "Find[" + SPACE$(idesystem2.w + 1) + chr$(18) + "]"; COLOR 7, 1: PRINT chr$(195); - f$ = idefindtext - IF LEN(f$) > 20 THEN - f$ = string$(3, 250) + RIGHT$(f$, 17) + + a$ = idefindtext + tx = 1 + IF LEN(a$) > idesystem2.w THEN + IF IdeSystem = 2 THEN + tx = idesystem2.v1 - idesystem2.w + 1 + IF tx < 1 THEN tx = 1 + a$ = MID$(a$, tx, idesystem2.w) + ELSE + a$ = LEFT$(a$, idesystem2.w) + END IF + END IF + + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + if sx1 > sx2 then SWAP sx1, sx2 + + x = x + 2 + 'apply selection color change if necessary + IF idesystem2.issel = 0 or IdeSystem <> 2 THEN + COLOR 3, 1 + LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4: PRINT a$; + ELSE + FOR ColorCHAR = 1 to len(a$) + if ColorCHAR + tx - 2 >= sx1 AND ColorCHAR + tx - 2 < sx2 THEN COLOR 1, 3 ELSE COLOR 3, 1 + LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4 - 1 + ColorCHAR + PRINT mid$(a$, ColorCHAR, 1); + NEXT END IF - LOCATE idewy - 4, idewx - 28 + 4: COLOR 3, 1: PRINT f$ - findtext$ = f$ 'alter cursor style to match insert mode IF ideinsert THEN LOCATE , , , 0, 31 ELSE LOCATE , , , 8, 8 @@ -877,7 +902,15 @@ DO IF IdeSystem = 2 THEN 'override cursor position SCREEN , , 0, 0 - LOCATE idewy - 4, idewx - 28 + 4 + LEN(findtext$) + tx = idesystem2.v1 + IF LEN(idefindtext) > idesystem2.w THEN + IF idesystem2.v1 > idesystem2.w THEN + tx = idesystem2.w + ELSE + tx = idesystem2.v1 + END IF + END IF + LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4 + tx SCREEN , , 3, 0 END IF @@ -1294,6 +1327,7 @@ DO IF KCTRL AND UCASE$(K$) = "F" THEN K$ = "" IdeSystem = 2 + if len(idefindtext) then idesystem2.issel = -1: idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext) END IF IF KCTRL AND KB = KEY_F3 THEN @@ -1305,6 +1339,7 @@ DO IF IdeSystem = 3 THEN IdeSystem = 1 idemf3: IF idefindtext$ <> "" THEN + if IdeSystem = 2 then idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext): idesystem2.issel = -1 IF KSHIFT THEN idefindinvert = 1 IdeAddSearched idefindtext idefindagain @@ -1462,11 +1497,12 @@ DO 'IdeSystem specific code goes here - IF mCLICK THEN 'Find [...] search field - IF mY = idewy - 4 AND mX > idewx - 30 AND mX < idewx - 1 THEN 'inside text box - IF mX <= idewx - 28 + 2 THEN + IF mCLICK THEN 'Find [...] search field (IdeSystem = 2) + IF mY = idewy - 4 AND mX > idewx - (idesystem2.w + 10) AND mX < idewx - 1 THEN 'inside text box + IF mX <= idewx - (idesystem2.w + 8) + 2 THEN IF LEN(idefindtext) = 0 THEN IdeSystem = 2 'no search string, so begin editing + idesystem2.issel = 0: idesystem2.v1 = 0 ELSE IdeAddSearched idefindtext IdeSystem = 1: GOTO idemf3 'F3 functionality @@ -1486,6 +1522,7 @@ DO ELSE IF IdeSystem = 2 THEN idefindtext = "" 'clicking on the text field again clears text IdeSystem = 2 + if len(idefindtext) then idesystem2.issel = -1: idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext) END IF END IF END IF @@ -1529,43 +1566,141 @@ DO END IF IF IdeSystem = 2 THEN - - IF (KSHIFT AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "V") THEN 'paste from clipboard - clip$ = _CLIPBOARD$ 'read clipboard - x = INSTR(clip$, CHR$(13)) - IF x THEN clip$ = LEFT$(clip$, x - 1) - x = INSTR(clip$, CHR$(10)) - IF x THEN clip$ = LEFT$(clip$, x - 1) - IF LEN(clip$) THEN - idefindtext = clip$ - GOTO specialchar - END IF - END IF - - IF ((KCTRL AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "C")) THEN 'copy to clipboard - IF LEN(idefindtext) THEN _CLIPBOARD$ = idefindtext - GOTO specialchar - END IF - + a$ = idefindtext IF LEN(K$) = 1 THEN - IF K$ = CHR$(27) THEN + k = ASC(K$) + IF (KSHIFT AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "V") THEN 'paste from clipboard + clip$ = _CLIPBOARD$ 'read clipboard + x = INSTR(clip$, CHR$(13)) + IF x THEN clip$ = LEFT$(clip$, x - 1) + x = INSTR(clip$, CHR$(10)) + IF x THEN clip$ = LEFT$(clip$, x - 1) + IF LEN(clip$) THEN + IF idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + IF sx1 > sx2 THEN SWAP sx1, sx2 + IF sx2 - sx1 > 0 THEN + a$ = LEFT$(a$, sx1) + clip$ + RIGHT$(a$, LEN(a$) - sx2) + idesystem2.v1 = sx1 + idesystem2.issel = 0 + END IF + ELSE + a$ = LEFT$(a$, idesystem2.v1) + clip$ + RIGHT$(a$, LEN(a$) - idesystem2.v1) + END IF + END IF + k = 255 + END IF + + IF (KCONTROL AND UCASE$(K$) = "A") THEN 'select all + IF LEN(a$) > 0 THEN + idesystem2.issel = -1 + idesystem2.sx1 = 0 + idesystem2.v1 = LEN(a$) + END IF + k = 255 + END IF + + IF ((KCTRL AND KB = KEY_INSERT) OR (KCONTROL AND UCASE$(K$) = "C")) THEN 'copy to clipboard + IF idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + IF sx1 > sx2 THEN SWAP sx1, sx2 + IF sx2 - sx1 > 0 THEN _CLIPBOARD$ = MID$(a$, sx1 + 1, sx2 - sx1) + END IF + k = 255 + END IF + + IF ((KSHIFT AND KB = KEY_DELETE) OR (KCONTROL AND UCASE$(K$) = "X")) THEN 'cut to clipboard + IF idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + IF sx1 > sx2 THEN SWAP sx1, sx2 + IF sx2 - sx1 > 0 THEN + _CLIPBOARD$ = MID$(a$, sx1 + 1, sx2 - sx1) + 'delete selection + a$ = LEFT$(a$, sx1) + RIGHT$(a$, LEN(a$) - sx2) + idesystem2.v1 = sx1 + idesystem2.issel = 0 + END IF + END IF + k = 255 + END IF + + IF k = 8 THEN + IF idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + IF sx1 > sx2 THEN SWAP sx1, sx2 + IF sx2 - sx1 > 0 THEN + 'delete selection + a$ = LEFT$(a$, sx1) + RIGHT$(a$, LEN(a$) - sx2) + idefindtext = a$ + idesystem2.v1 = sx1 + idesystem2.issel = 0 + END IF + ELSEIF idesystem2.v1 > 0 THEN + a1$ = LEFT$(a$, idesystem2.v1 - 1) + IF idesystem2.v1 <= LEN(a$) THEN a2$ = RIGHT$(a$, LEN(a$) - idesystem2.v1) ELSE a2$ = "" + a$ = a1$ + a2$: idesystem2.v1 = idesystem2.v1 - 1 + idefindtext = a$ + END IF + END IF + IF k = 27 THEN IdeSystem = 1 GOTO specialchar END IF - IF ASC(K$) = 13 THEN + IF k = 9 THEN + IdeSystem = 1 + GOTO specialchar + END IF + IF k = 13 THEN IF LEN(idefindtext) THEN IdeAddSearched idefindtext: GOTO idemf3 'F3 functionality GOTO specialchar END IF - IF ASC(K$) = 8 THEN - IF LEN(idefindtext) THEN idefindtext = LEFT$(idefindtext, LEN(idefindtext) - 1) - GOTO specialchar + IF k <> 8 AND k <> 9 AND k <> 0 AND k <> 10 AND k <> 13 AND k <> 26 AND k <> 255 THEN + IF idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + IF sx1 > sx2 THEN SWAP sx1, sx2 + IF sx2 - sx1 > 0 THEN + 'replace selection + a$ = LEFT$(a$, sx1) + RIGHT$(a$, LEN(a$) - sx2) + idefindtext = a$ + idesystem2.issel = 0 + idesystem2.v1 = sx1 + end if + end if + IF idesystem2.v1 > 0 THEN a1$ = LEFT$(a$, idesystem2.v1) ELSE a1$ = "" + IF idesystem2.v1 <= LEN(a$) THEN a2$ = RIGHT$(a$, LEN(a$) - idesystem2.v1) ELSE a2$ = "" + a$ = a1$ + K$ + a2$: idesystem2.v1 = idesystem2.v1 + 1 END IF - IF ASC(K$) < 32 THEN GOTO specialchar 'block control characters - - idefindtext = idefindtext + K$ - GOTO specialchar + idefindtext = a$ END IF + IF K$ = CHR$(0) + "S" THEN 'DEL + if idesystem2.issel THEN + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + if sx1 > sx2 then SWAP sx1, sx2 + if sx2 - sx1 > 0 then + 'delete selection + a$ = left$(a$, sx1) + right$(a$, len(a$) - sx2) + idefindtext = a$ + idesystem2.v1 = sx1 + idesystem2.issel = 0 + end if + else + IF idesystem2.v1 > 0 THEN a1$ = LEFT$(a$, idesystem2.v1) ELSE a1$ = "" + IF idesystem2.v1 < LEN(a$) THEN a2$ = RIGHT$(a$, LEN(a$) - idesystem2.v1 - 1) ELSE a2$ = "" + a$ = a1$ + a2$ + idefindtext = a$ + end if + END IF + + 'cursor control + if K$ = CHR$(0) + "K" THEN GOSUB selectcheck: idesystem2.v1 = idesystem2.v1 - 1 + IF K$ = CHR$(0) + "M" THEN GOSUB selectcheck: idesystem2.v1 = idesystem2.v1 + 1 + IF K$ = CHR$(0) + "G" THEN GOSUB selectcheck: idesystem2.v1 = 0 + IF K$ = CHR$(0) + "O" THEN GOSUB selectcheck: idesystem2.v1 = LEN(a$) + IF idesystem2.v1 < 0 THEN idesystem2.v1 = 0 + IF idesystem2.v1 > LEN(a$) THEN idesystem2.v1 = LEN(a$) + IF idesystem2.v1 = idesystem2.sx1 then idesystem2.issel = 0 + IF mCLICK or mCLICK2 THEN IF mX > 1 AND mX < idewx AND mY > 2 AND mY < (idewy - 5) THEN 'inside text box IdeSystem = 1 @@ -2795,8 +2930,13 @@ DO GOTO skipgosubs selectcheck: - IF KSHIFT AND ideselect = 0 THEN ideselect = 1: ideselectx1 = idecx: ideselecty1 = idecy - IF KSHIFT = 0 THEN ideselect = 0 + IF IdeSystem = 1 THEN + IF KSHIFT AND ideselect = 0 THEN ideselect = 1: ideselectx1 = idecx: ideselecty1 = idecy + IF KSHIFT = 0 THEN ideselect = 0 + ELSEIF IdeSystem = 2 THEN + IF KSHIFT AND idesystem2.issel = 0 THEN idesystem2.issel = -1: idesystem2.sx1 = idesystem2.v1 + IF KSHIFT = 0 THEN idesystem2.issel = 0 + END IF RETURN delselect: From 802899893910d3433e424a824a3c8353c32e26e3 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 14:55:12 -0200 Subject: [PATCH 03/18] Fix display of search term after ENTER --- source/ide/ide_methods.bas | 81 ++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 77e36ed9b..c8187f8bc 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -759,38 +759,7 @@ DO COLOR 1, 7: LOCATE 2, ((idewx / 2) - 1) - (LEN(a$) - 1) \ 2: PRINT a$; 'update search bar - LOCATE idewy - 4, idewx - (idesystem2.w + 10) - COLOR 7, 1: PRINT chr$(180); - COLOR 3, 1: PRINT "Find[" + SPACE$(idesystem2.w + 1) + chr$(18) + "]"; - COLOR 7, 1: PRINT chr$(195); - - a$ = idefindtext - tx = 1 - IF LEN(a$) > idesystem2.w THEN - IF IdeSystem = 2 THEN - tx = idesystem2.v1 - idesystem2.w + 1 - IF tx < 1 THEN tx = 1 - a$ = MID$(a$, tx, idesystem2.w) - ELSE - a$ = LEFT$(a$, idesystem2.w) - END IF - END IF - - sx1 = idesystem2.sx1: sx2 = idesystem2.v1 - if sx1 > sx2 then SWAP sx1, sx2 - - x = x + 2 - 'apply selection color change if necessary - IF idesystem2.issel = 0 or IdeSystem <> 2 THEN - COLOR 3, 1 - LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4: PRINT a$; - ELSE - FOR ColorCHAR = 1 to len(a$) - if ColorCHAR + tx - 2 >= sx1 AND ColorCHAR + tx - 2 < sx2 THEN COLOR 1, 3 ELSE COLOR 3, 1 - LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4 - 1 + ColorCHAR - PRINT mid$(a$, ColorCHAR, 1); - NEXT - END IF + GOSUB UpdateSearchBar 'alter cursor style to match insert mode IF ideinsert THEN LOCATE , , , 0, 31 ELSE LOCATE , , , 8, 8 @@ -1338,8 +1307,13 @@ DO IF KB = KEY_F3 THEN IF IdeSystem = 3 THEN IdeSystem = 1 idemf3: - IF idefindtext$ <> "" THEN - if IdeSystem = 2 then idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext): idesystem2.issel = -1 + IF idefindtext <> "" THEN + if IdeSystem = 2 then + idesystem2.sx1 = 0 + idesystem2.v1 = len(idefindtext) + idesystem2.issel = -1 + GOSUB UpdateSearchBar + end if IF KSHIFT THEN idefindinvert = 1 IdeAddSearched idefindtext idefindagain @@ -1651,7 +1625,10 @@ DO GOTO specialchar END IF IF k = 13 THEN - IF LEN(idefindtext) THEN IdeAddSearched idefindtext: GOTO idemf3 'F3 functionality + IF LEN(idefindtext) THEN + IdeAddSearched idefindtext + GOTO idemf3 'F3 functionality + END IF GOTO specialchar END IF IF k <> 8 AND k <> 9 AND k <> 0 AND k <> 10 AND k <> 13 AND k <> 26 AND k <> 255 THEN @@ -4208,7 +4185,41 @@ DO LOOP '-------------------------------------------------------------------------------- +EXIT FUNCTION +UpdateSearchBar: + LOCATE idewy - 4, idewx - (idesystem2.w + 10) + COLOR 7, 1: PRINT chr$(180); + COLOR 3, 1: PRINT "Find[" + SPACE$(idesystem2.w + 1) + chr$(18) + "]"; + COLOR 7, 1: PRINT chr$(195); + a$ = idefindtext + tx = 1 + IF LEN(a$) > idesystem2.w THEN + IF IdeSystem = 2 THEN + tx = idesystem2.v1 - idesystem2.w + 1 + IF tx < 1 THEN tx = 1 + a$ = MID$(a$, tx, idesystem2.w) + ELSE + a$ = LEFT$(a$, idesystem2.w) + END IF + END IF + + sx1 = idesystem2.sx1: sx2 = idesystem2.v1 + if sx1 > sx2 then SWAP sx1, sx2 + + x = x + 2 + 'apply selection color change if necessary + IF idesystem2.issel = 0 or IdeSystem <> 2 THEN + COLOR 3, 1 + LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4: PRINT a$; + ELSE + FOR ColorCHAR = 1 to len(a$) + if ColorCHAR + tx - 2 >= sx1 AND ColorCHAR + tx - 2 < sx2 THEN COLOR 1, 3 ELSE COLOR 3, 1 + LOCATE idewy - 4, idewx - (idesystem2.w + 8) + 4 - 1 + ColorCHAR + PRINT mid$(a$, ColorCHAR, 1); + NEXT + END IF +RETURN END FUNCTION SUB idebox (x, y, w, h) From 1ab0814e5e8a981fe3995de88a306f6e3fe2d67f Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 15:09:00 -0200 Subject: [PATCH 04/18] Fix to display and focus of quick search field --- source/ide/ide_methods.bas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index c8187f8bc..67e776bb7 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -3099,6 +3099,7 @@ startmenu: m = 1 startmenu2: altheld = 1 +if IdeSystem = 2 then IdeSystem = 1: GOSUB UpdateSearchBar DO @@ -3198,6 +3199,7 @@ LOOP showmenu: altheld = 1 +if IdeSystem = 2 then IdeSystem = 1: GOSUB UpdateSearchBar PCOPY 0, 2 SCREEN , , 1, 0 r = 1 From 59eb5b234ce59456bba623ac69bd30ccf8a01f60 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 18:24:52 -0200 Subject: [PATCH 05/18] UP and DOWN arrows invoke search history. - UP and DOWN arrow keys invoke search history in Find and Change dialogs. - Fix idesearchedbox$ crashing when no search history is found. --- source/ide/ide_methods.bas | 79 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 67e776bb7..195236fc0 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -4262,7 +4262,7 @@ END IF END SUB FUNCTION idechange$ - +REDIM SearchHistory(0) AS STRING '-------- generic dialog box header -------- PCOPY 0, 2 @@ -4294,6 +4294,23 @@ IF a2$ = "" THEN a2$ = idefindtext END IF +'retrieve search history +ln = 0 +fh = FREEFILE +OPEN ".\internal\temp\searched.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ +CLOSE #fh +a$ = RIGHT$(a$, LEN(a$) - 2) +DO WHILE LEN(a$) + ai = INSTR(a$, CRLF) + IF ai THEN + f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3) + ln = ln + 1 + REDIM _PRESERVE SearchHistory(1 to ln) + SearchHistory(ln) = f$ + END IF +LOOP +ln = 0 + i = 0 idepar p, 60, 12, "Change" i = i + 1 @@ -4425,8 +4442,25 @@ DO 'main loop EXIT FUNCTION END IF + if ubound(SearchHistory) > 0 then + IF K$ = CHR$(0) + CHR$(72) AND focus = 1 THEN 'Up + IF ln < ubound(SearchHistory) THEN + ln = ln + 1 + END IF + idetxt(o(1).txt) = SearchHistory(ln) + o(1).issel = -1: o(1).sx1 = 0: o(1).v1 = len(idetxt(o(1).txt)) + END IF - + IF K$ = CHR$(0) + CHR$(80) AND focus = 1 THEN 'Down + IF ln > 1 THEN + ln = ln - 1 + ELSE + ln = 1 + END IF + idetxt(o(1).txt) = SearchHistory(ln) + o(1).issel = -1: o(1).sx1 = 0: o(1).v1 = len(idetxt(o(1).txt)) + END IF + end if IF focus = 7 AND info <> 0 THEN 'change all idefindcasesens = o(3).sel @@ -5208,7 +5242,7 @@ END FUNCTION FUNCTION idefind$ - +REDIM SearchHistory(0) AS STRING '-------- generic dialog box header -------- PCOPY 0, 2 PCOPY 0, 1 @@ -5239,6 +5273,22 @@ IF a2$ = "" THEN a2$ = idefindtext END IF +'retrieve search history +ln = 0 +fh = FREEFILE +OPEN ".\internal\temp\searched.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ +CLOSE #fh +a$ = RIGHT$(a$, LEN(a$) - 2) +DO WHILE LEN(a$) + ai = INSTR(a$, CRLF) + IF ai THEN + f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3) + ln = ln + 1 + REDIM _PRESERVE SearchHistory(1 to ln) + SearchHistory(ln) = f$ + END IF +LOOP +ln = 0 i = 0 idepar p, 60, 9, "Find" @@ -5370,6 +5420,25 @@ DO 'main loop EXIT FUNCTION END IF + if ubound(SearchHistory) > 0 then + IF K$ = CHR$(0) + CHR$(72) AND focus = 1 THEN 'Up + IF ln < ubound(SearchHistory) THEN + ln = ln + 1 + END IF + idetxt(o(1).txt) = SearchHistory(ln) + o(1).issel = -1: o(1).sx1 = 0: o(1).v1 = len(idetxt(o(1).txt)) + END IF + + IF K$ = CHR$(0) + CHR$(80) AND focus = 1 THEN 'Down + IF ln > 1 THEN + ln = ln - 1 + ELSE + ln = 1 + END IF + idetxt(o(1).txt) = SearchHistory(ln) + o(1).issel = -1: o(1).sx1 = 0: o(1).v1 = len(idetxt(o(1).txt)) + END IF + end if 'end of custom controls @@ -9831,6 +9900,10 @@ DO WHILE LEN(a$) LOOP CLOSE #fh +if ln = 0 then + l$ = sep +end if + '72,19 h = idewy + idesubwindow - 9 From 79f1557986098d445770e6a735529053bb2f256b Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 18:57:03 -0200 Subject: [PATCH 06/18] Add "Clear search history..." to Search menu. --- source/ide/ide_methods.bas | 126 +++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 195236fc0..ba56426e9 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -209,6 +209,8 @@ IF idelaunched = 0 THEN menu$(m, i) = "#Repeat Last Find (Shift+) F3": i = i + 1 menu$(m, i) = "#Change...": i = i + 1 menu$(m, i) = "-": i = i + 1 + menu$(m, i) = "Clear search #history...": i = i + 1 + menu$(m, i) = "-": i = i + 1 menu$(m, i) = "Add/Remove #Bookmark Alt+Left": i = i + 1 menu$(m, i) = "#Next Bookmark Alt+Down": i = i + 1 menu$(m, i) = "#Previous Bookmark Alt+Up": i = i + 1 @@ -3979,6 +3981,18 @@ DO GOTO ideloop END IF '#Change... + IF menu$(m, s) = "Clear search #history..." THEN + PCOPY 2, 0 + r$ = ideclearsearch$ + IF r$ = "Y" THEN + fh = FREEFILE + OPEN ".\internal\temp\searched.bin" FOR OUTPUT AS #fh: CLOSE #fh + idefindtext = "" + END IF + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + IF menu$(m, s) = "#Repeat Last Find (Shift+) F3" THEN PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt GOTO idemf3 @@ -6370,6 +6384,118 @@ LOOP END FUNCTION +FUNCTION ideclearsearch$ + +'-------- generic dialog box header -------- +PCOPY 3, 0 +PCOPY 0, 2 +PCOPY 0, 1 +SCREEN , , 1, 0 +focus = 1 +DIM p AS idedbptype +DIM o(1 TO 100) AS idedbotype +DIM oo AS idedbotype +DIM sep AS STRING * 1 +sep = CHR$(0) +'-------- end of generic dialog box header -------- + +'-------- init -------- +i = 0 +'idepar p, 30, 6, "File already exists. Overwrite?" +idepar p, 48, 4, "" +i = i + 1 +o(i).typ = 3 +o(i).y = 4 +o(i).txt = idenewtxt("#Yes" + sep + "#No") +o(i).dft = 1 +'-------- end of init -------- + +'-------- generic init -------- +FOR i = 1 TO 100: o(i).par = p: NEXT 'set parent info of objects +'-------- end of generic init -------- + +DO 'main loop + + '-------- generic display dialog box & objects -------- + idedrawpar p + f = 1: cx = 0: cy = 0 + FOR i = 1 TO 100 + IF o(i).typ THEN + 'prepare object + o(i).foc = focus - f 'focus offset + o(i).cx = 0: o(i).cy = 0 + idedrawobj o(i), f 'display object + IF o(i).cx THEN cx = o(i).cx: cy = o(i).cy + END IF + NEXT i + lastfocus = f - 1 + '-------- end of generic display dialog box & objects -------- + + '-------- custom display changes -------- + COLOR 0, 7: LOCATE p.y + 2, p.x + 3: PRINT "This cannot be undone. Clear search history?"; + '-------- end of custom display changes -------- + + 'update visual page and cursor position + PCOPY 1, 0 + IF cx THEN SCREEN , , 0, 0: LOCATE cy, cx, 1: SCREEN , , 1, 0 + + '-------- read input -------- + change = 0 + DO + GetInput + IF mWHEEL THEN change = 1 + IF KB THEN change = 1 + IF mCLICK THEN mousedown = 1: change = 1 + IF mRELEASE THEN mouseup = 1: change = 1 + IF mB THEN change = 1 + alt = KALT: IF alt <> oldalt THEN change = 1 + oldalt = alt + _LIMIT 100 + LOOP UNTIL change + IF alt THEN idehl = 1 ELSE idehl = 0 + 'convert "alt+letter" scancode to letter's ASCII character + altletter$ = "" + IF alt THEN + IF LEN(K$) = 1 THEN + k = ASC(UCASE$(K$)) + IF k >= 65 AND k <= 90 THEN altletter$ = CHR$(k) + END IF + END IF + SCREEN , , 0, 0: LOCATE , , 0: SCREEN , , 1, 0 + '-------- end of read input -------- + + IF UCASE$(K$) = "Y" THEN altletter$ = "Y" + IF UCASE$(K$) = "N" THEN altletter$ = "N" + + '-------- generic input response -------- + info = 0 + IF K$ = "" THEN K$ = CHR$(255) + IF KSHIFT = 0 AND K$ = CHR$(9) THEN focus = focus + 1 + IF KSHIFT AND K$ = CHR$(9) THEN focus = focus - 1 + IF focus < 1 THEN focus = lastfocus + IF focus > lastfocus THEN focus = 1 + f = 1 + FOR i = 1 TO 100 + t = o(i).typ + IF t THEN + focusoffset = focus - f + ideobjupdate o(i), focus, f, focusoffset, K$, altletter$, mB, mousedown, mouseup, mX, mY, info, mWHEEL + END IF + NEXT + '-------- end of generic input response -------- + + IF info THEN + IF info = 1 THEN ideclearsearch$ = "Y" ELSE ideclearsearch$ = "N" + EXIT FUNCTION + END IF + + 'end of custom controls + mousedown = 0 + mouseup = 0 +LOOP + +END FUNCTION + SUB idesave (f$) OPEN f$ FOR OUTPUT AS #151 FOR i = 1 TO iden From 07c9c5442af8140b0ff550c6706c4bc03a38f021 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 20:05:57 -0200 Subject: [PATCH 07/18] Fix to quick search bar. - Fix updating the display after selecting an item in search history. - Add the ability to click the search field and unselect/position the cursor (overrides previous double-click to erase behavior). --- source/ide/ide_methods.bas | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index ba56426e9..b5ba1575f 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -1314,8 +1314,8 @@ DO idesystem2.sx1 = 0 idesystem2.v1 = len(idefindtext) idesystem2.issel = -1 - GOSUB UpdateSearchBar end if + GOSUB UpdateSearchBar IF KSHIFT THEN idefindinvert = 1 IdeAddSearched idefindtext idefindagain @@ -1487,6 +1487,7 @@ DO IF mX = idewx - 3 THEN showrecentlysearchedbox: PCOPY 0, 3 + GOSUB UpdateSearchBar f$ = idesearchedbox IF LEN(f$) THEN idefindtext = f$ PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt @@ -1496,9 +1497,22 @@ DO IF LEN(f$) THEN GOTO idemf3 'F3 functionality GOTO ideloop ELSE - IF IdeSystem = 2 THEN idefindtext = "" 'clicking on the text field again clears text - IdeSystem = 2 - if len(idefindtext) then idesystem2.issel = -1: idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext) + IF IdeSystem = 2 THEN + if idesystem2.issel then idesystem2.issel = 0 + + if len(idefindtext) <= idesystem2.w THEN + idesystem2.v1 = mX - (idewx - (idesystem2.w + 4)) + else + if idesystem2.v1 > idesystem2.w then + idesystem2.v1 = (mX - (idewx - (idesystem2.w + 4))) + (idesystem2.v1 - idesystem2.w) + else + idesystem2.v1 = mX - (idewx - (idesystem2.w + 4)) + end if + END IF + ELSE + IdeSystem = 2 + if len(idefindtext) then idesystem2.issel = -1: idesystem2.sx1 = 0: idesystem2.v1 = len(idefindtext) + END IF END IF END IF END IF From 47d5a0a4734329167c0330c92566ba4881635665 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 22:12:51 -0200 Subject: [PATCH 08/18] Limit contextual menu items to available ones. - Hides cut/copy/clear if no selection available. - Hides paste if _CLIPBOARD$ is empty --- source/ide/ide_methods.bas | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index b5ba1575f..39af47875 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -10474,10 +10474,13 @@ SUB IdeMakeContextualMenu menu$(m, i) = "-": i = i + 1 END IF - menu$(m, i) = "Cu#t Shift+Del or Ctrl+X": i = i + 1 - menu$(m, i) = "#Copy Ctrl+Ins or Ctrl+C": i = i + 1 - menu$(m, i) = "#Paste Shift+Ins or Ctrl+V": i = i + 1 - menu$(m, i) = "Cl#ear Del": i = i + 1 + if ideselect then menu$(m, i) = "Cu#t Shift+Del or Ctrl+X": i = i + 1 + if ideselect then menu$(m, i) = "#Copy Ctrl+Ins or Ctrl+C": i = i + 1 + + clip$ = _CLIPBOARD$ 'read clipboard + IF LEN(clip$) THEN menu$(m, i) = "#Paste Shift+Ins or Ctrl+V": i = i + 1 + + if ideselect then menu$(m, i) = "Cl#ear Del": i = i + 1 menu$(m, i) = "Select #All Ctrl+A": i = i + 1 menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Undo Ctrl+Z": i = i + 1 From 11e33dd3cb87e35312321490b5b4f2360e71def8 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Tue, 5 Jan 2016 23:14:51 -0200 Subject: [PATCH 09/18] Add disabled menu items and make Edit menu context-aware. - Menu items starting with a tilde ("~") are displayed with COLOR 8 and without hotkeys highlighted. Clicking on them does nothing, but closes the menu. - Edit menu is now context-aware. Cut, copy and clear are only enabled if there is a selection. Paste is only enabled if _CLIPBOARD$ is not empty. --- source/ide/ide_global.bas | 3 +- source/ide/ide_methods.bas | 73 ++++++++++++++++++++++++++++---------- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/source/ide/ide_global.bas b/source/ide/ide_global.bas index 87d1d9aaf..15781ea94 100644 --- a/source/ide/ide_global.bas +++ b/source/ide/ide_global.bas @@ -188,6 +188,7 @@ DIM SHARED ideautorun DIM SHARED menu$(1 TO 10, 0 TO 20) DIM SHARED menusize(1 TO 10) DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER +DIM SHARED ideeditmenuID AS INTEGER DIM SHARED menubar$, idecontextualSearch$ DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo DIM SHARED idealthighlight, ideentermenu @@ -198,4 +199,4 @@ DIM SHARED iderunmode DIM SHARED IdeAndroidMenu DIM SHARED IdeAndroidStartScript AS STRING -DIM SHARED IdeAndroidMakeScript AS STRING \ No newline at end of file +DIM SHARED IdeAndroidMakeScript AS STRING diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 39af47875..c443a50a7 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -181,22 +181,8 @@ IF idelaunched = 0 THEN IdeMakeFileMenu m = m + 1: i = 0 - menu$(m, i) = "Edit": i = i + 1 - menu$(m, i) = "Cu#t Shift+Del or Ctrl+X": i = i + 1 - menu$(m, i) = "#Copy Ctrl+Ins or Ctrl+C": i = i + 1 - menu$(m, i) = "#Paste Shift+Ins or Ctrl+V": i = i + 1 - menu$(m, i) = "Cl#ear Del": i = i + 1 - menu$(m, i) = "Select #All Ctrl+A": i = i + 1 - menu$(m, i) = "-": i = i + 1 - menu$(m, i) = "#Undo Ctrl+Z": i = i + 1 - menu$(m, i) = "#Redo Ctrl+Y": i = i + 1 - menu$(m, i) = "-": i = i + 1 - menu$(m, i) = "Comment (add ')": i = i + 1 - menu$(m, i) = "Uncomment (remove ')": i = i + 1 - menu$(m, i) = "-": i = i + 1 - menu$(m, i) = "New #SUB...": i = i + 1 - menu$(m, i) = "New #FUNCTION...": i = i + 1 - menusize(m) = i - 1 + ideeditmenuID = m + IdeMakeEditMenu m = m + 1: i = 0 menu$(m, i) = "View": i = i + 1 @@ -3220,6 +3206,7 @@ PCOPY 0, 2 SCREEN , , 1, 0 r = 1 IF idecontextualmenu = 1 THEN idectxmenuX = mX: idectxmenuY = mY: m = idecontextualmenuID +IdeMakeEditMenu oldmy = mY: oldmx = mX DO PCOPY 2, 1 @@ -3238,6 +3225,7 @@ DO m$ = menu$(m, i) l = LEN(m$) IF INSTR(m$, "#") THEN l = l - 1 + IF LEFT$(m$, 1) = "~" THEN l = l - 1 IF INSTR(m$, " ") THEN l = l + 2 'min 4 spacing IF l > w THEN w = l NEXT @@ -3257,6 +3245,16 @@ DO m$ = menu$(m, i) IF m$ = "-" THEN COLOR 0, 7: LOCATE i + yy, xx - 2: PRINT chr$(195) + STRING$(w + 2, chr$(196)) + chr$(180); + ELSEIF left$(m$, 1) = "~" THEN + m$ = right$(m$, len(m$) - 1) 'Remove the tilde before printing + IF r = i THEN LOCATE i + yy, xx - 1: COLOR 7, 0: PRINT SPACE$(w + 2); + LOCATE i + yy, xx + h = -1: x = INSTR(m$, "#"): IF x THEN h = x: m$ = LEFT$(m$, x - 1) + RIGHT$(m$, LEN(m$) - x) + x = INSTR(m$, " "): IF x THEN m1$ = LEFT$(m$, x - 1): m2$ = RIGHT$(m$, LEN(m$) - x - 1): m$ = m1$ + SPACE$(w - LEN(m1$) - LEN(m2$)) + m2$ + FOR x = 1 TO LEN(m$) + IF r = i THEN COLOR 8, 0 ELSE COLOR 8, 7 + PRINT MID$(m$, x, 1); + NEXT ELSE IF r = i THEN LOCATE i + yy, xx - 1: COLOR 7, 0: PRINT SPACE$(w + 2); LOCATE i + yy, xx @@ -3269,7 +3267,6 @@ DO IF r = i THEN COLOR 7, 0 ELSE COLOR 0, 7 END IF PRINT MID$(m$, x, 1); - NEXT @@ -4202,7 +4199,9 @@ DO PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt: GOTO ideloop END IF - + IF left$(menu$(m, s),1) = "~" THEN 'Ignore disabled items (starting with "~") + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt: GOTO ideloop + END IF SCREEN , , 0, 0 @@ -10494,6 +10493,44 @@ SUB IdeMakeContextualMenu menusize(m) = i - 1 END SUB +SUB IdeMakeEditMenu + m = ideeditmenuID: i = 0 + menu$(m, i) = "Edit": i = i + 1 + + if ideselect then + menu$(m, i) = "Cu#t Shift+Del or Ctrl+X": i = i + 1 + menu$(m, i) = "#Copy Ctrl+Ins or Ctrl+C": i = i + 1 + else + menu$(m, i) = "~Cu#t Shift+Del or Ctrl+X": i = i + 1 + menu$(m, i) = "~#Copy Ctrl+Ins or Ctrl+C": i = i + 1 + end if + + clip$ = _CLIPBOARD$ 'read clipboard + IF LEN(clip$) THEN + menu$(m, i) = "#Paste Shift+Ins or Ctrl+V": i = i + 1 + else + menu$(m, i) = "~#Paste Shift+Ins or Ctrl+V": i = i + 1 + end if + + if ideselect then + menu$(m, i) = "Cl#ear Del": i = i + 1 + else + menu$(m, i) = "~Cl#ear Del": i = i + 1 + end if + + menu$(m, i) = "Select #All Ctrl+A": i = i + 1 + menu$(m, i) = "-": i = i + 1 + menu$(m, i) = "#Undo Ctrl+Z": i = i + 1 + menu$(m, i) = "#Redo Ctrl+Y": i = i + 1 + menu$(m, i) = "-": i = i + 1 + menu$(m, i) = "Comment (add ')": i = i + 1 + menu$(m, i) = "Uncomment (remove ')": i = i + 1 + menu$(m, i) = "-": i = i + 1 + menu$(m, i) = "New #SUB...": i = i + 1 + menu$(m, i) = "New #FUNCTION...": i = i + 1 + menusize(m) = i - 1 +END SUB + SUB IdeAddRecent (f2$) f$ = CRLF + f2$ + CRLF fh = FREEFILE From 3b251e4e056d34fa7a2f821c7a694c755008bcaf Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 00:58:08 -0200 Subject: [PATCH 10/18] Add option to clear the list of recently opened files. - Add an option to the "Recent..." dialog. - Add a menu entry for when the list contains less than 4 items. --- source/ide/ide_methods.bas | 55 +++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index c443a50a7..7b478e1ae 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -3994,7 +3994,7 @@ DO IF menu$(m, s) = "Clear search #history..." THEN PCOPY 2, 0 - r$ = ideclearsearch$ + r$ = ideclearhistory$("SEARCH") IF r$ = "Y" THEN fh = FREEFILE OPEN ".\internal\temp\searched.bin" FOR OUTPUT AS #fh: CLOSE #fh @@ -4146,7 +4146,24 @@ DO IF menu$(m, s) = "#Recent..." THEN PCOPY 2, 0 + ideshowrecentbox: f$ = iderecentbox + IF f$ = "" THEN + f$ = "" + PCOPY 3, 4 + PCOPY 1, 3 + r$ = ideclearhistory$("FILES") + PCOPY 4, 3 + IF r$ = "Y" THEN + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh + IdeMakeFileMenu + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + ELSE + goto ideshowrecentbox + END IF + END IF IF LEN(f$) THEN IdeOpenFile$ = f$ GOTO directopen @@ -4155,6 +4172,20 @@ DO GOTO ideloop END IF + IF menu$(m, s) = "Clear #recent..." THEN + PCOPY 2, 0 + r$ = ideclearhistory$("FILES") + IF r$ = "Y" THEN + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh + IdeMakeFileMenu + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + IF menu$(m, s) = "#Open..." THEN IdeOpenFile$ = "" directopen: @@ -6397,7 +6428,7 @@ LOOP END FUNCTION -FUNCTION ideclearsearch$ +FUNCTION ideclearhistory$(WhichHistory$) '-------- generic dialog box header -------- PCOPY 3, 0 @@ -6445,7 +6476,11 @@ DO 'main loop '-------- end of generic display dialog box & objects -------- '-------- custom display changes -------- - COLOR 0, 7: LOCATE p.y + 2, p.x + 3: PRINT "This cannot be undone. Clear search history?"; + COLOR 0, 7: LOCATE p.y + 2, p.x + 3 + SELECT CASE WhichHistory$ + CASE "SEARCH": PRINT "This cannot be undone. Clear search history?"; + CASE "FILES": PRINT "This cannot be undone. Clear recent files?"; + END SELECT '-------- end of custom display changes -------- 'update visual page and cursor position @@ -6498,7 +6533,7 @@ DO 'main loop '-------- end of generic input response -------- IF info THEN - IF info = 1 THEN ideclearsearch$ = "Y" ELSE ideclearsearch$ = "N" + IF info = 1 THEN ideclearhistory$ = "Y" ELSE ideclearhistory$ = "N" EXIT FUNCTION END IF @@ -10273,7 +10308,7 @@ o(i).nam = idenewtxt("Recent Programs") i = i + 1 o(i).typ = 3 o(i).y = idewy + idesubwindow - 6 -o(i).txt = idenewtxt("#OK" + sep + "#Cancel") +o(i).txt = idenewtxt("#OK" + sep + "#Cancel" + sep + "Clea#r list") o(i).dft = 1 '-------- end of init -------- @@ -10354,12 +10389,17 @@ DO 'main loop EXIT FUNCTION END IF - IF K$ = CHR$(13) OR (focus = 2 AND info <> 0) OR (info = 1 AND focus = 1) THEN + IF (K$ = CHR$(13) AND focus = 1) OR (focus = 2 AND info <> 0) OR (info = 1 AND focus = 1) THEN f$ = idetxt(o(1).stx) iderecentbox$ = f$ EXIT FUNCTION END IF + IF (K$ = CHR$(13) AND focus = 4) OR (focus = 4 AND info <> 0) OR (info = 1 AND focus = 4) THEN + iderecentbox$ = "" + EXIT FUNCTION + END IF + 'end of custom controls mousedown = 0 mouseup = 0 @@ -10395,6 +10435,9 @@ FOR r = 1 TO 5 END IF NEXT CLOSE #fh +IF menu$(m, i - 1) <> "#Recent..." and menu$(m, i - 1) <> "Save #As..." THEN + menu$(m, i) = "Clear #recent...": i = i + 1 +END IF menu$(m, i) = "-": i = i + 1 menu$(m, i) = "E#xit": i = i + 1 menusize(m) = i - 1 From 4f8bb2634d7281884b853a21bbcf1c13e51c7678 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 02:10:00 -0200 Subject: [PATCH 11/18] Add clean invalid links in recent files list. - After a file error, the user is prompted to clean up the recent file list, removing invalid links. --- source/ide/ide_methods.bas | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 7b478e1ae..245ecd30d 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -107,6 +107,7 @@ STATIC MenuLocations as STRING STATIC idesystem2.issel AS _BYTE STATIC idesystem2.sx1 AS LONG STATIC idesystem2.v1 AS LONG +STATIC AttemptToLoadRecent AS _BYTE CONST idesystem2.w = 20 @@ -119,9 +120,54 @@ IF ideerror THEN IF ideerror = 2 THEN ideerrormessage "File not found" IF ideerror = 3 THEN ideerrormessage "File access error": CLOSE #150 IF ideerror = 4 THEN ideerrormessage "Path not found" - ideerrormessage str$(err) + "on line "+ str$(_errorline) + ideerrormessage str$(err) + " on line" + str$(_errorline) END IF + +IF (ideerror = 2 or ideerror = 3 or ideerror = 4) AND (AttemptToLoadRecent = -1) THEN + 'Offer to cleanup recent file list, removing invalid entries + PCOPY 2, 0 + r$ = ideclearhistory$("INVALID") + IF r$ = "Y" THEN + l$ = "": ln = 0 + REDIM RecentFilesList(0) AS STRING + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ + CLOSE #fh + a$ = RIGHT$(a$, LEN(a$) - 2) + DO WHILE LEN(a$) + ai = INSTR(a$, CRLF) + IF ai THEN + f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3) + IF _FILEEXISTS(f$) THEN + ln = ln + 1 + REDIM _PRESERVE RecentFilesList(1 to ln) + RecentFilesList(ln) = f$ + END IF + END IF + LOOP + + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh + + If ln > 0 THEN + f$ = "" + for ln = 1 to ubound(RecentFilesList) + f$ = f$ + CRLF + RecentFilesList(ln) + CRLF + next + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh + PUT #fh, 1, f$ + CLOSE #fh + END IF + + ERASE RecentFilesList + IdeMakeFileMenu + END IF + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt +END IF + ideerror = 1 'unknown IDE error +AttemptToLoadRecent = 0 IF LEFT$(c$, 1) = CHR$(12) THEN f$ = RIGHT$(c$, LEN(c$) - 1) @@ -4134,10 +4180,12 @@ DO GOTO ideloop END IF + AttemptToLoadRecent = 0 FOR ml = 1 TO 4 IF LEN(IdeRecentLink(ml, 1)) THEN IF menu$(m, s) = IdeRecentLink(ml, 1) THEN IdeOpenFile$ = IdeRecentLink(ml, 2) + AttemptToLoadRecent = -1 GOTO directopen END IF END IF @@ -4166,6 +4214,7 @@ DO END IF IF LEN(f$) THEN IdeOpenFile$ = f$ + AttemptToLoadRecent = -1 GOTO directopen END IF PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt @@ -6478,8 +6527,9 @@ DO 'main loop '-------- custom display changes -------- COLOR 0, 7: LOCATE p.y + 2, p.x + 3 SELECT CASE WhichHistory$ - CASE "SEARCH": PRINT "This cannot be undone. Clear search history?"; - CASE "FILES": PRINT "This cannot be undone. Clear recent files?"; + CASE "SEARCH": PRINT "This cannot be undone. Clear search history?"; + CASE "FILES": PRINT " This cannot be undone. Clear recent files?"; + CASE "INVALID": PRINT " Remove invalid links from recent files?"; END SELECT '-------- end of custom display changes -------- From 6493409400e5bb9be96fb98e695a2e2621b93500 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 02:25:03 -0200 Subject: [PATCH 12/18] Add "Remove broken links" to recent files dialog. --- source/ide/ide_methods.bas | 82 ++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 245ecd30d..6d0ec8504 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -128,40 +128,7 @@ IF (ideerror = 2 or ideerror = 3 or ideerror = 4) AND (AttemptToLoadRecent = -1) PCOPY 2, 0 r$ = ideclearhistory$("INVALID") IF r$ = "Y" THEN - l$ = "": ln = 0 - REDIM RecentFilesList(0) AS STRING - fh = FREEFILE - OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ - CLOSE #fh - a$ = RIGHT$(a$, LEN(a$) - 2) - DO WHILE LEN(a$) - ai = INSTR(a$, CRLF) - IF ai THEN - f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3) - IF _FILEEXISTS(f$) THEN - ln = ln + 1 - REDIM _PRESERVE RecentFilesList(1 to ln) - RecentFilesList(ln) = f$ - END IF - END IF - LOOP - - fh = FREEFILE - OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh - - If ln > 0 THEN - f$ = "" - for ln = 1 to ubound(RecentFilesList) - f$ = f$ + CRLF + RecentFilesList(ln) + CRLF - next - fh = FREEFILE - OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh - PUT #fh, 1, f$ - CLOSE #fh - END IF - - ERASE RecentFilesList - IdeMakeFileMenu + GOSUB CleanUpRecentList END IF PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt END IF @@ -4211,6 +4178,9 @@ DO ELSE goto ideshowrecentbox END IF + ELSEIF f$ = "" THEN + GOSUB CleanUpRecentList + GOTO ideshowrecentbox END IF IF LEN(f$) THEN IdeOpenFile$ = f$ @@ -4329,6 +4299,43 @@ UpdateSearchBar: NEXT END IF RETURN + +CleanUpRecentList: +l$ = "": ln = 0 +REDIM RecentFilesList(0) AS STRING +fh = FREEFILE +OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ +CLOSE #fh +a$ = RIGHT$(a$, LEN(a$) - 2) +DO WHILE LEN(a$) + ai = INSTR(a$, CRLF) + IF ai THEN + f$ = LEFT$(a$, ai - 1): IF ai = LEN(a$) - 1 THEN a$ = "" ELSE a$ = RIGHT$(a$, LEN(a$) - ai - 3) + IF _FILEEXISTS(f$) THEN + ln = ln + 1 + REDIM _PRESERVE RecentFilesList(1 to ln) + RecentFilesList(ln) = f$ + END IF + END IF +LOOP + +fh = FREEFILE +OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh + +If ln > 0 THEN + f$ = "" + for ln = 1 to ubound(RecentFilesList) + f$ = f$ + CRLF + RecentFilesList(ln) + CRLF + next + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh + PUT #fh, 1, f$ + CLOSE #fh +END IF + +ERASE RecentFilesList +IdeMakeFileMenu +RETURN END FUNCTION SUB idebox (x, y, w, h) @@ -10358,7 +10365,7 @@ o(i).nam = idenewtxt("Recent Programs") i = i + 1 o(i).typ = 3 o(i).y = idewy + idesubwindow - 6 -o(i).txt = idenewtxt("#OK" + sep + "#Cancel" + sep + "Clea#r list") +o(i).txt = idenewtxt("#OK" + sep + "#Cancel" + sep + "Clea#r list" + sep + "#Remove broken links") o(i).dft = 1 '-------- end of init -------- @@ -10450,6 +10457,11 @@ DO 'main loop EXIT FUNCTION END IF + IF (K$ = CHR$(13) AND focus = 5) OR (focus = 5 AND info <> 0) OR (info = 1 AND focus = 5) THEN + iderecentbox$ = "" + EXIT FUNCTION + END IF + 'end of custom controls mousedown = 0 mouseup = 0 From af4f9f3918f6b87aa5088a42c8911bb846eab57e Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 02:32:58 -0200 Subject: [PATCH 13/18] Update ide_methods.bas Mere naming convention: invalid links --> broken links. --- source/ide/ide_methods.bas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 6d0ec8504..c0b03a011 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -6536,7 +6536,7 @@ DO 'main loop SELECT CASE WhichHistory$ CASE "SEARCH": PRINT "This cannot be undone. Clear search history?"; CASE "FILES": PRINT " This cannot be undone. Clear recent files?"; - CASE "INVALID": PRINT " Remove invalid links from recent files?"; + CASE "INVALID": PRINT " Remove broken links from recent files?"; END SELECT '-------- end of custom display changes -------- From cc8f6605b5b7dfca2a824aa7de6c2129a9448c67 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 12:18:36 -0200 Subject: [PATCH 14/18] Show a message box when no broken links are found. --- source/ide/ide_methods.bas | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index c0b03a011..53db03cab 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -4165,10 +4165,7 @@ DO f$ = iderecentbox IF f$ = "" THEN f$ = "" - PCOPY 3, 4 - PCOPY 1, 3 r$ = ideclearhistory$("FILES") - PCOPY 4, 3 IF r$ = "Y" THEN fh = FREEFILE OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh @@ -4307,6 +4304,7 @@ fh = FREEFILE OPEN ".\internal\temp\recent.bin" FOR BINARY AS #fh: a$ = SPACE$(LOF(fh)): GET #fh, , a$ CLOSE #fh a$ = RIGHT$(a$, LEN(a$) - 2) +FoundBrokenLink = 0 DO WHILE LEN(a$) ai = INSTR(a$, CRLF) IF ai THEN @@ -4315,14 +4313,19 @@ DO WHILE LEN(a$) ln = ln + 1 REDIM _PRESERVE RecentFilesList(1 to ln) RecentFilesList(ln) = f$ + ELSE + FoundBrokenLink = -1 END IF END IF LOOP -fh = FREEFILE -OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh +If not FoundBrokenLink THEN + ideerrormessage "All files in the list are accessible." +END IF -If ln > 0 THEN +If ln > 0 AND FoundBrokenLink THEN + fh = FREEFILE + OPEN ".\internal\temp\recent.bin" FOR OUTPUT AS #fh: CLOSE #fh f$ = "" for ln = 1 to ubound(RecentFilesList) f$ = f$ + CRLF + RecentFilesList(ln) + CRLF From acee40bf724fc2ea6e1ef3a2e837d28c692244f1 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 22:57:11 -0200 Subject: [PATCH 15/18] Add increase/decrease block indent with TAB/Shift+TAB. - Available only when auto indent is turned off (Options/Code layout). - Also available from Edit menu and contextual right-click menu. Known issue: When auto spacing is on, if you try to indent the first line the file, it is immediately repositioned at the start of the line. Only happens to the first line. --- source/ide/ide_methods.bas | 172 ++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 3 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 53db03cab..60d48bd76 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -3059,9 +3059,118 @@ DO ideforceinput: IF K$ = CHR$(9) THEN - x = 4 - IF ideautoindent <> 0 AND ideautoindentsize <> 0 THEN x = ideautoindentsize - K$ = SPACE$(x - ((idecx - 1) MOD x)) + IF ideselect AND ideautoindent = 0 THEN + 'Block indentation code copied/adapted from block comment/uncomment: + IF KSHIFT THEN + IdeBlockDecreaseIndent: + BlockIndentLevel = 4 + IF ideautoindentsize <> 0 THEN BlockIndentLevel = ideautoindentsize + y1 = idecy + y2 = ideselecty1 + + IF y1 = y2 THEN 'single line selected + a$ = idegetline(idecy) + a2$ = "" + sx1 = ideselectx1: sx2 = idecx + IF sx2 < sx1 THEN SWAP sx1, sx2 + FOR x = sx1 TO sx2 - 1 + IF x <= LEN(a$) THEN a2$ = a2$ + MID$(a$, x, 1) ELSE a2$ = a2$ + " " + NEXT + IF a2$ = "" THEN + GOTO SkipBlockIndent + END IF + END IF + + IF y1 > y2 THEN SWAP y1, y2 + IF idecy > ideselecty1 AND idecx = 1 THEN y2 = y2 - 1 + 'calculate lhs + lhs = 10000000 + FOR y = y1 TO y2 + a$ = idegetline(y) + IF LEN(a$) THEN + ta$ = LTRIM$(a$) + t = LEN(a$) - LEN(ta$) + IF t < lhs THEN lhs = t + END IF + NEXT + 'edit lines + 'Unless any of the block lines already starts at the beginning of the line + IF lhs > 0 THEN + IF lhs < BlockIndentLevel then BlockIndentLevel = lhs + FOR y = y1 TO y2 + a$ = idegetline(y) + IF LEN(a$) THEN + a$ = right$(a$, LEN(a$) - BlockIndentLevel) + idesetline y, a$ + idechangemade = 1 + END IF + NEXT + END IF + if (y1 = y2) AND idechangemade then + ideselectx1 = ideselectx1 - BlockIndentLevel + idecx = idecx - BlockIndentLevel + if idecx < 1 then idecx = 1: ideselectx1 = idecx + end if + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + ELSE + IdeBlockIncreaseIndent: + BlockIndentLevel = 4 + IF ideautoindentsize <> 0 THEN BlockIndentLevel = ideautoindentsize + y1 = idecy + y2 = ideselecty1 + + IF y1 = y2 THEN 'single line selected + a$ = idegetline(idecy) + a2$ = "" + sx1 = ideselectx1: sx2 = idecx + IF sx2 < sx1 THEN SWAP sx1, sx2 + FOR x = sx1 TO sx2 - 1 + IF x <= LEN(a$) THEN a2$ = a2$ + MID$(a$, x, 1) ELSE a2$ = a2$ + " " + NEXT + IF a2$ = "" THEN + GOTO SkipBlockIndent + END IF + END IF + + IF y1 > y2 THEN SWAP y1, y2 + IF idecy > ideselecty1 AND idecx = 1 THEN y2 = y2 - 1 + 'calculate lhs + lhs = 10000000 + FOR y = y1 TO y2 + a$ = idegetline(y) + IF LEN(a$) THEN + ta$ = LTRIM$(a$) + t = LEN(a$) - LEN(ta$) + IF t < lhs THEN lhs = t + END IF + NEXT + 'edit lines + FOR y = y1 TO y2 + a$ = idegetline(y) + IF LEN(a$) THEN + a$ = LEFT$(a$, lhs) + SPACE$(BlockIndentLevel) + RIGHT$(a$, LEN(a$) - lhs) + idesetline y, a$ + idechangemade = 1 + END IF + NEXT + if (y1 = y2) AND idechangemade then + ideselectx1 = ideselectx1 + BlockIndentLevel + idecx = idecx + BlockIndentLevel + end if + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + ELSE + SkipBlockIndent: + IF KSHIFT = 0 THEN + x = 4 + IF ideautoindent <> 0 AND ideautoindentsize <> 0 THEN x = ideautoindentsize + K$ = SPACE$(x - ((idecx - 1) MOD x)) + ELSE + K$ = "" + END IF + END IF END IF 'standard character @@ -3506,6 +3615,14 @@ DO GOTO ideloop END IF + IF menu$(m, s) = "Increase indent TAB" THEN + IF ideselect AND ideautoindent = 0 THEN GOTO IdeBlockIncreaseIndent + END IF + + IF menu$(m, s) = "Decrease indent Shift+TAB" THEN + IF ideselect AND ideautoindent = 0 THEN GOTO IdeBlockDecreaseIndent + END IF + IF menu$(m, s) = "#Language..." THEN PCOPY 2, 0 retval = idelanguagebox @@ -10596,6 +10713,28 @@ SUB IdeMakeContextualMenu menu$(m, i) = "Comment (add ')": i = i + 1 menu$(m, i) = "Uncomment (remove ')": i = i + 1 menu$(m, i) = "-": i = i + 1 + IF ideselect AND ideautoindent = 0 THEN + y1 = idecy + y2 = ideselecty1 + IF y1 = y2 THEN 'single line selected + a$ = idegetline(idecy) + a2$ = "" + sx1 = ideselectx1: sx2 = idecx + IF sx2 < sx1 THEN SWAP sx1, sx2 + FOR x = sx1 TO sx2 - 1 + IF x <= LEN(a$) THEN a2$ = a2$ + MID$(a$, x, 1) ELSE a2$ = a2$ + " " + NEXT + IF a2$ <> "" THEN + menu$(m, i) = "Increase indent TAB": i = i + 1 + menu$(m, i) = "Decrease indent Shift+TAB": i = i + 1 + menu$(m, i) = "-": i = i + 1 + END IF + ELSE + menu$(m, i) = "Increase indent TAB": i = i + 1 + menu$(m, i) = "Decrease indent Shift+TAB": i = i + 1 + menu$(m, i) = "-": i = i + 1 + END IF + end if menu$(m, i) = "New #SUB...": i = i + 1 menu$(m, i) = "New #FUNCTION...": i = i + 1 menusize(m) = i - 1 @@ -10634,6 +10773,33 @@ SUB IdeMakeEditMenu menu$(m, i) = "Comment (add ')": i = i + 1 menu$(m, i) = "Uncomment (remove ')": i = i + 1 menu$(m, i) = "-": i = i + 1 + IF ideselect AND ideautoindent = 0 THEN + y1 = idecy + y2 = ideselecty1 + IF y1 = y2 THEN 'single line selected + a$ = idegetline(idecy) + a2$ = "" + sx1 = ideselectx1: sx2 = idecx + IF sx2 < sx1 THEN SWAP sx1, sx2 + FOR x = sx1 TO sx2 - 1 + IF x <= LEN(a$) THEN a2$ = a2$ + MID$(a$, x, 1) ELSE a2$ = a2$ + " " + NEXT + IF a2$ = "" THEN + menu$(m, i) = "~Increase indent TAB": i = i + 1 + menu$(m, i) = "~Decrease indent Shift+TAB": i = i + 1 + ELSE + menu$(m, i) = "Increase indent TAB": i = i + 1 + menu$(m, i) = "Decrease indent Shift+TAB": i = i + 1 + END IF + ELSE + menu$(m, i) = "Increase indent TAB": i = i + 1 + menu$(m, i) = "Decrease indent Shift+TAB": i = i + 1 + END IF + else + menu$(m, i) = "~Increase indent TAB": i = i + 1 + menu$(m, i) = "~Decrease indent Shift+TAB": i = i + 1 + end if + menu$(m, i) = "-": i = i + 1 menu$(m, i) = "New #SUB...": i = i + 1 menu$(m, i) = "New #FUNCTION...": i = i + 1 menusize(m) = i - 1 From 818764186262edda31f03ef1bfc082adf12f70ca Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 23:14:58 -0200 Subject: [PATCH 16/18] Add message box about the availability of manual block indent. --- source/ide/ide_methods.bas | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 60d48bd76..6b7760051 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -3623,6 +3623,17 @@ DO IF ideselect AND ideautoindent = 0 THEN GOTO IdeBlockDecreaseIndent END IF + IF menu$(m, s) = "~Decrease indent Shift+TAB" OR menu$(m, s) = "~Increase indent TAB" THEN + IF ideautoindent <> 0 THEN + ideerrormessage "Not available when auto indent is active (Options/Code Layout)." + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + ELSE + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + END IF + IF menu$(m, s) = "#Language..." THEN PCOPY 2, 0 retval = idelanguagebox From 96f450e2ff4dad744592ad3260f9f0fa8f1f0fd0 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Wed, 6 Jan 2016 23:28:22 -0200 Subject: [PATCH 17/18] Small modification to Edit menu. --- source/ide/ide_methods.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 6b7760051..3ab051919 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -10723,7 +10723,6 @@ SUB IdeMakeContextualMenu menu$(m, i) = "-": i = i + 1 menu$(m, i) = "Comment (add ')": i = i + 1 menu$(m, i) = "Uncomment (remove ')": i = i + 1 - menu$(m, i) = "-": i = i + 1 IF ideselect AND ideautoindent = 0 THEN y1 = idecy y2 = ideselecty1 @@ -10745,6 +10744,8 @@ SUB IdeMakeContextualMenu menu$(m, i) = "Decrease indent Shift+TAB": i = i + 1 menu$(m, i) = "-": i = i + 1 END IF + else + menu$(m, i) = "-": i = i + 1 end if menu$(m, i) = "New #SUB...": i = i + 1 menu$(m, i) = "New #FUNCTION...": i = i + 1 @@ -10783,7 +10784,6 @@ SUB IdeMakeEditMenu menu$(m, i) = "-": i = i + 1 menu$(m, i) = "Comment (add ')": i = i + 1 menu$(m, i) = "Uncomment (remove ')": i = i + 1 - menu$(m, i) = "-": i = i + 1 IF ideselect AND ideautoindent = 0 THEN y1 = idecy y2 = ideselecty1 From 261d6fc97de7d64c526218099ac6ea02e602a069 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Thu, 7 Jan 2016 00:20:29 -0200 Subject: [PATCH 18/18] Fix ESC deleting the current selection. --- source/ide/ide_methods.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 3ab051919..96e0f1bb4 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -3173,6 +3173,8 @@ DO END IF END IF + IF K$ = CHR$(27) AND NOT AltSpecial THEN GOTO specialchar 'Steve edit 07-04-2014 to stop ESC from printing chr$(27) in the IDE + 'standard character IF ideselect THEN GOSUB delselect idechangemade = 1 @@ -3195,8 +3197,6 @@ DO a$ = idegetline(idecy) IF LEN(a$) < idecx - 1 THEN a$ = a$ + SPACE$(idecx - 1 - LEN(a$)) - IF K$ = CHR$(27) AND NOT AltSpecial THEN GOTO specialchar 'Steve edit 07-04-2014 to stop ESC from printing chr$(27) in the IDE - IF ideinsert THEN a2$ = RIGHT$(a$, LEN(a$) - idecx + 1) IF LEN(a2$) THEN a2$ = RIGHT$(a$, LEN(a$) - idecx)