Small feature request

Working on new editor enhancements?
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Small feature request

Post by uwekel »

Hi,

after working some time with PB, i would like to place three requests from my wishlist:

1. Coming from VB.NET, i would like a command to cut a whole line to the clipboard (the keystroke is Ctrl+Del). That way it is easy to move a single line to another place.

2. As far as i know, the Undo and Redo commands are working on a single character change. In VB.NET, these commands are working on line a basis. From my opinion it is easier to restore a line to its previous value (you must not to do dozents of undos but only one per line).

3. If you try to open a file from the recent files list in VB.NET and the file does not exists anymore, the IDE ask whether or not it should remove the item from the list. This is very convenient and cleans up the recent document list on-the-fly.

That's it - thanks for reading :-)

Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Small feature request

Post by skywalk »

uwekel wrote:1. Coming from VB.NET, i would like a command to cut a whole line to the clipboard (the keystroke is Ctrl+Del). That way it is easy to move a single line to another place.
If only the IDE would utilize more of the built-in shortcuts of Scintilla. :(
http://www.purebasic.fr/english/viewtop ... 78#p315578
For example: Line Cut = [Ctrl+L], then move cursor where you like and paste with [Ctrl+V].
Currently, [Ctrl+L] is next to useless since it does not span all files and does not reverse or return to the top of its list.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: Small feature request

Post by uwekel »

Hi,

I just wanted to start a new request when i saw this one :-)
Is there a chance to get the "Delete Current Line" command soon?
I think it's not a major thing, is it?

Best regards
Uwe
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Small feature request

Post by Michael Vogel »

Would think about using AutoHotkey doing this job, something like this could do what you like to have:

#IfWinActive PureBasic
^Del::SendInput, {Home}+{Down}+{Del}

Otherwise a PB-Tool could do such jobs for you, but as it needs some execution time to read (and rewrite) the source code file, it is just a workaround. The following example pops up a tooltip to show the procedure name of the actual cursor position and copies the cursor line text into the clipboard:

Code: Select all

;{ ShowInformation by Michael Vogel Vo.o1}

	; INSTALLATION:
	;
	; •	copy the compiled exe file into the directory "...\Purbasic\Catalogs"
	; •	set up the tool using "Configure Tools..." with the following parameters (from top to bottom):
	;
	;	%COMPILEFILE\..\Catalogs\Tool ShowInfo.exe
	;	"%TEMPFILE" %CURSOR
	;	%COMPILEFILE\..
	;	Show I&nformation
	;	Menu Or Shortcut
	;	Alt+N
	;
	; 	[_]	Wait until tool quits
	; 	[_]	Reload Source after tool has quit
	; 	[_]	into the current source

;}
; Define

	#Programtitle="Show Information"

	Enumeration
		#CopyNothing
		#CopyProcedureLine
		#CopyCursorText
		;
		#Source
		#Window
		#Info
	EndEnumeration

	#CopyMode=#CopyCursorText;	GetKeyState_(#VK_MENU)&128

	If CountProgramParameters()<>2
		MessageBox_(0,"'Show Information' needs two parameters!"+#CR$+"(''%TEMPFILE'' %CURSOR)","Error",#MB_ICONERROR|#MB_OK)
		End
	EndIf

	Global SourceFile.s=ProgramParameter()
	Global Zeile.s=ProgramParameter()
	Global Info.s
	Global Cursor.i=Val(StringField(Zeile,1,"x"))
	Global Count.i
	Global n

	; MessageBox_(0,"Filename: "+SourceFile+#CR$+"Cursor-Position: "+Str(Cursor),"Ok",#MB_ICONINFORMATION|#MB_OK)

	If OpenFile(#Source,SourceFile)

		While Eof(#Source)=#Null And Cursor
			Count+1
			Zeile=Trim(ReadString(#Source))
			If LCase(Left(Zeile,9))="procedure"
				Info=StringField(Zeile,2," ")
				n=Count
			EndIf
			Cursor-1
		Wend
		CloseFile(#Source)

		CompilerSelect #CopyMode
		CompilerCase #CopyProcedureLine
			SetClipboardText(Str(n))
		CompilerCase #CopyCursorText
			SetClipboardText(Zeile)
		CompilerEndSelect

		n=Len(Info)
		If n
			n*6+10
			GetCursorPos_(Mouse.POINT)
			OpenWindow(#Window,Mouse\x+10,Mouse\y-15,n,18,#Programtitle,#PB_Window_BorderLess|#PB_Window_Invisible)
			SetWindowColor(#Window,#Black)
			StickyWindow(#Window,#True)
			TextGadget(#Info,1,1,n-2,16," "+Info,#SS_NOPREFIX|#SS_LEFTNOWORDWRAP)
			SetGadgetColor(#Info,#PB_Gadget_BackColor,#Yellow)
			SetGadgetColor(#Info,#PB_Gadget_FrontColor,#Black)
			HideWindow(#Window,#Null)
			AddWindowTimer(#Window,#Null,250)

			n=ElapsedMilliseconds()+1500
			Repeat
				WaitWindowEvent()
			Until ElapsedMilliseconds()>n
			End

		EndIf

	Else
		MessageBox_(0,"The source code file '"+GetFilePart(SourceFile)+"' is locked!"+#CR$,"Error",#MB_ICONERROR|#MB_OK)
		End
	EndIf

; EndDefine
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Small feature request

Post by skywalk »

Yeah, I am using at least 5 or 6 IDE tools that happen instantly in Windows. No need to reload the source file :?: :?
Is that because no linux equivalent of SendMessage()?
Danilo's scintilla messages

Code: Select all

; Compile & assign ct_sci_kybd_lineDel.exe --> Shorcut = [Ctrl+Shift+D]
; This becomes the opposite of duplicate line via Shorcut = [Ctrl+D]
Define.i ri, hSci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
If hSci
  SendMessageTimeout_(hSci,#SCI_LINEDELETE,0,0,#SMTO_ABORTIFHUNG,2000,@ri)
EndIf
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

Re: Small feature request

Post by uwekel »

AutoHotkey is a tool for Windows only.
All PB_TOOL... environment variables do not exist on my system (Fedora) :(

Does anyone know how to get the scintilla id of the PB IDE current editor?
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Small feature request

Post by Josh »

uwekel wrote:All PB_TOOL... environment variables do not exist on my system (Fedora) :(

Does anyone know how to get the scintilla id of the PB IDE current editor?
Are you sure, you are using PB_TOOL... in a external tool?

Code: Select all

GetEnvironmentVariable ("PB_TOOL_Scintilla")
sorry for my bad english
Post Reply