Page 1 of 1

Small feature request

Posted: Mon Jan 23, 2012 8:28 pm
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

Re: Small feature request

Posted: Mon Jan 23, 2012 8:46 pm
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.

Re: Small feature request

Posted: Sun Jan 06, 2013 11:40 am
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

Re: Small feature request

Posted: Mon Jan 07, 2013 8:24 am
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

Re: Small feature request

Posted: Mon Jan 07, 2013 6:15 pm
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

Re: Small feature request

Posted: Mon Jan 07, 2013 8:29 pm
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?

Re: Small feature request

Posted: Mon Jan 07, 2013 11:43 pm
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")