Page 1 of 1

[Implemented] More Scintilla IDE shortcuts

Posted: Sun Nov 18, 2012 4:02 am
by kenmo
Scintilla has a lot of useful shortcuts, such as Ctrl+D for Duplicate which the PB IDE supports but does not list in the Shortcuts preferences.

Now that Scintilla has been updated in PB recently, I would like to see a few more shortcuts supported that I like to use in other editors such as Notepad++:

- Move Selection Up (SCI_MOVESELECTEDLINESUP) Ctrl+Shift+Up
- Move Selection Down (SCI_MOVESELECTEDLINESDOWN) Ctrl+Shift+Down
- Delete Lines (SCI_LINEDELETE) maybe Ctrl+L although this key combo is set to "Recent Line" by default
- Find Previous (SCI_SEARCHPREV) Shift+F3 to complement the already-supported F3 Find Next

There may be other useful ones too.

Re: More Scintilla IDE shortcuts

Posted: Mon Jan 07, 2013 6:38 pm
by skywalk
The following code crashes my v5 IDE :(
IDE wrote: An error has been detected in the IDE!
Error: Invalid memory access

IDE build on 11/05/2012 [16:05] by Fred
Branch: v4.70 Revision: 1361

Code: Select all

; Compile & assign ct_sci_kybd_FindPrev.exe --> Shorcut = [Shift+F3]
; This becomes the opposite of Find Forward via Shorcut = [F3]
Define.i ri, hSci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
If hSci
  SendMessageTimeout_(hSci,#SCI_SEARCHPREV,0,0,#SMTO_ABORTIFHUNG,2000,@ri)
EndIf

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 3:25 pm
by kenmo
Marking my own post from 2012 as Implemented :)

Find Previous was added in PB 5.60

Move Lines Up/Down, and Delete Line, merged in Pull Request #54 for upcoming 5.72
https://github.com/fantaisie-software/purebasic/pull/54

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 3:58 pm
by skywalk
Good deal.
Since [Crtl+D] = duplicate line, please enable or allow user hotkey choice for [Ctrl+Shift+D] = delete line.

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 4:10 pm
by kenmo
They will be user configurable (assuming they make it into 5.72 Final)

I kept Ctrl+D as the default for Duplicate, but did not assign a default to Delete Line(s).

Ctrl+Shift+D is not currently used for anything..... but I think Fred and Timo get the final decision on default mappings.

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 5:31 pm
by oreopa
I don't know if this is in your remit - I'm not sure if Scintilla has this functionality built in, but...

1. Selection to uppercase
2. Selection to lowercase
3. Invert case of selection

...would be nice.

I have this already as a self built tool, but it would be nicer native.

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 6:04 pm
by kenmo
Scintilla has built-in UPPERCASE and LOWERCASE function:

Code: Select all

If OpenWindow(0, 0, 0, 330, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  If InitScintilla()
    ScintillaGadget(0, 10, 10, 320, 70, 0)
    
    *Text=UTF8("Hello World")
    ScintillaSendMessage(0, #SCI_SETTEXT, 0, *Text)
    FreeMemory(*Text)
    
    ScintillaSendMessage(0, #SCI_SETSEL, 0, 5)
    ScintillaSendMessage(0, #SCI_UPPERCASE)
    ScintillaSendMessage(0, #SCI_SETSEL, 6, 11)
    ScintillaSendMessage(0, #SCI_LOWERCASE)
    ScintillaSendMessage(0, #SCI_SETSEL, 0, 0)
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
EndIf
For invert case, you mean "Hello" --> "hELLO" ? That would be easy too:

Code: Select all

Procedure.s InvertCase(Text.s)
  Protected *C.CHARACTER = @Text
  While (*C\c)
    If (*C\c = Asc(LCase(Chr(*C\c))))
      *C\c = Asc(UCase(Chr(*C\c)))
    Else
      *C\c = Asc(LCase(Chr(*C\c)))
    EndIf
    *C + SizeOf(CHARACTER)
  Wend
  ProcedureReturn Text
EndProcedure

Debug InvertCase("123 Hello!")
Debug InvertCase(InvertCase("123 Hello!"))

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 6:31 pm
by skywalk
Nice, where do we submit our IDE tool code to be converted to Native IDE?
Here on the forum or in the github?
I have several other functions I use.

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Mon Feb 10, 2020 6:51 pm
by oreopa
kenmo wrote:Scintilla has built-in UPPERCASE and LOWERCASE function...
Actually I don't believe I forgot that, because its those functions I use in my usertool :)))
kenmo wrote:For invert case, you mean "Hello" --> "hELLO" ?
Exactly.

Anyway, IDE native would be great if possible ;)

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Tue Feb 11, 2020 3:32 pm
by kenmo
I think you can request IDE features on the forum or GitHub... I started a GitHub topic for new shortcuts / menu actions...
https://github.com/fantaisie-software/p ... /issues/46

I can't guarantee they'll get done... right now I'm converting my own IDE tools to native features... and starting with the easier ones like Scintilla shortcuts.

You are also free to download the IDE project and experiment yourself (it's fun and good practice!) :)


Funny, about UPPERCASE and LOWERCASE, I just tried them in the IDE thinking it would be simple.

It works on variables, comments, etc.
But because of the IDE's Very Aggressive CaseCorrection, it does not change keywords or built-in functions.

Case Correction is currently built into the highlighting, not just typing events.

So it goes UPPERCASE action --> rehighlight --> case correct --> instantly back to regular case!

Re: [Implemented] More Scintilla IDE shortcuts

Posted: Tue Feb 11, 2020 4:59 pm
by skywalk
Unfortunately, no time to load and review the IDE flow.
These are some of my goto tools.
I can PM you the source code if you think they are worthy of adding to the repo?
FINDDEF - is still a work in progress.

Code: Select all

; ToolName                Arguments               Shortcut          Description
; ----------------------  ----------------------  ----------------- -----------------------------------------------------------
; CLOSE_EXTRA_PB_WINDOWS  CLOSE_EXTRA_PB_WINDOWS  [Ctrl+0]          Close extra windows like debug,help,variable,etc.
; INDENTALL               INDENTALL               [Ctrl+Shift+i]    Select All characters, then trigger indent function.
; PASTECOMMENT            PASTECOMMENT            [Ctrl+Shift+v]    Paste text as comment to avoid syntax changes.
; COPYALL                 COPYALL                 [Ctrl+Shift+k]    Select All characters, then copy to clipboard.
; UCASE                   UCASE                   [Ctrl+u]
; LCASE                   LCASE                   [Ctrl+Shift+u]    Opposite of UCase line = [Ctrl+u]
; LINEDEL                 LINEDEL                 [Ctrl+Shift+d]    Opposite of duplicate line = [Ctrl+d]
; MVLINESUP               MVLINESUP               [Ctrl+Shift+Up]
; MVLINESDN               MVLINESDN               [Ctrl+Shift+Down]
; TRIM_LINES              NONE                    [Ctrl+t]          Trim whitespace only lines and trailing whitespace.
; ECHO                    ECHO                    [Ctrl+Shift+1]    Reports word under cursor
; HILITE                  HILITE                  [Ctrl+`]          Unhilite works by applying shortcut to white space.
; WORDCOUNT_THISLINE      WORDCOUNT_THISLINE      [Ctrl+1]          Count of specific character in current line.
; FINDDEF                 FINDDEF                 [Ctrl+2]          Jump to best guess at keyword(kw) definition/instantiation:
; GETASM-X86              GETASM-X86 %FILE        None              %FILE = full path + filename. Adds a datetime stamp to end to avoid overwrites.
; GETASM-X64              GETASM-X64 %FILE        None              %FILE = full path + filename. Adds a datetime stamp to end to avoid overwrites.
; GETENV                  GETENV                  None