Can I have 2 times opened the same source?

Working on new editor enhancements?
AMpos
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Jun 05, 2020 12:47 am

Can I have 2 times opened the same source?

Post by AMpos »

I have a proyect, and I would like to have the same source file opened 2 times in the editor, as I have to check two parts of the source, and it is a pain to be jumping with markers.

Is it posible?
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Can I have 2 times opened the same source?

Post by Joris »

Open a new tab in the editor and ...
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Can I have 2 times opened the same source?

Post by BarryG »

Joris wrote:Open a new tab in the editor and ...
...nothing. That doesn't open a second copy for me. It just switches back to the old tab with the source. Tested with a default PureBasic install and with my existing Prefs file. I need to run PureBasic twice to have the same source open twice.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Can I have 2 times opened the same source?

Post by Marc56us »

Yes, you can't open the same file twice in the PB IDE.

In the Feature Request, it was asked if it was possible to add a horizontal splitter. This should not be possible easily because most Scintilla-based editors don't have this feature either.

In the meantime, personally, I open a read-only copy in Notepad++ with automatic synchronization of changes.

PS. In PB IDE, in addition to the markers you already use (F2) I also often use the return to the last position (CTRL+L) as well as the tool panel "Issue Browser" . Very useful.
User avatar
Demivec
Addict
Addict
Posts: 4085
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Can I have 2 times opened the same source?

Post by Demivec »

Marc56us wrote:In the Feature Request, it was asked if it was possible to add a horizontal splitter. This should not be possible easily because most Scintilla-based editors don't have this feature either.
jaPBe has this feature and had a Scintilla-based editor, though the source is a bit out dated. I think it would be possible to implement it in the the editor if jaPBe was used as an example (it was also open-source).
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Can I have 2 times opened the same source?

Post by Rinzwind »

Scintella supports it by connecting two Scintella gadgets.

Very raw example:

Code: Select all



Procedure Callback_Scintilla_0()
  
EndProcedure

Procedure Callback_Scintilla_1()
  
EndProcedure

;;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

InitScintilla()

Enumeration FormWindow
  #Window_0
EndEnumeration

Enumeration FormGadget
  #Scintilla_0
  #Scintilla_1
EndEnumeration


Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
  ScintillaGadget(#Scintilla_0, 10, 10, 578, 174, @Callback_Scintilla_0())
  ScintillaGadget(#Scintilla_1, 14, 190, 574, 194, @Callback_Scintilla_1())
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

;;

OpenWindow_0()

Define pdoc
pdoc = SendMessage_(GadgetID(#Scintilla_0), #SCI_GETDOCPOINTER, 0, 0)
Debug pdoc
SendMessage_(GadgetID(#Scintilla_1), #SCI_SETDOCPOINTER, 0, pdoc)

Repeat
  e = WaitWindowEvent()
  Window_0_Events(e)
Until e = #PB_Event_CloseWindow
PowerBasic example:
https://www.garybeene.com/code/gbsnippets_gbs_00644.htm

Can't even split tabs into multiple simultaneous views (left/right would be a start).

Kind of part workaround: disable "Run only one Instance" in Preferences/General

offtopic About the IDE github project: would be wise for PB to spend some time to get it to compile easy. Check out is one, getting it to run is quite hard from what I have read. Missing EnableExplicit in almost all sources is a shock for me personally. A source of bugs. Aah found an github issue about it: https://github.com/fantaisie-software/p ... /issues/26 . Seems they open sourced it without proper source cleanup/preparation and instructions which hinders community efforts.
Last edited by Rinzwind on Tue Jul 28, 2020 9:35 am, edited 2 times in total.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Can I have 2 times opened the same source?

Post by Marc56us »

Yes, it seems that Scintilla can open several views of the same file and synchronize them.

https://www.scintilla.org/ScintillaDoc. ... tipleViews
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Can I have 2 times opened the same source?

Post by Denis »

Sometime i opened the same project into 32 and 64 PB ide (i always work in 64 bit mode).
If I modify the code in one editor and switch to the other, the modified file will be displayed on the same line because of the PB ide synchronization, so i still have to jump to the part i want to see ...
If you want to see another part of the file in the second editor, that's not the right way to do it.
That's why I do like Marc56us, I use NotePad++ to do the job (sometimes i modify the code in notepad ++ and it works fine when i'm back to PB ide.)
Last edited by Denis on Tue Jul 28, 2020 11:59 am, edited 1 time in total.
A+
Denis
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Can I have 2 times opened the same source?

Post by BarryG »

RSBasic created a tool to do split-view -> viewtopic.php?f=27&t=73110

But it had a data-losing bug and was discontinued. A shame.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Can I have 2 times opened the same source?

Post by Joris »

BarryG wrote:
Joris wrote:Open a new tab in the editor and ...
...nothing. That doesn't open a second copy for me. It just switches back to the old tab with the source. Tested with a default PureBasic install and with my existing Prefs file. I need to run PureBasic twice to have the same source open twice.
I haven't try that yet, but can't you do a copy past then ?
It works with different sources, so...
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Can I have 2 times opened the same source?

Post by spikey »

Give NotePad++ a try https://notepad-plus-plus.org/. It supports dual views - select "Clone to other view" from the document's tab context menu. It automatically synchronises edits across both so it doesn't matter if you edit in the wrong view by mistake.

If you supply "%FILE" (include the quotes) as the arguments you can set it up as a custom tool in the PB IDE and have the current file opened directly in NPP from within the IDE.
User avatar
Shardik
Addict
Addict
Posts: 1988
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Can I have 2 times opened the same source?

Post by Shardik »

Rinzwind wrote:offtopic About the IDE github project: would be wise for PB to spend some time to get it to compile easy. Check out is one, getting it to run is quite hard from what I have read.
For MacOS it can't be much easier: copy my bash script from GitHub directly into TextEdit, save it and start it from your Terminal. It downloads the purebasic-master from GitHub automagically, compiles it and directly launches the newly compiled IDE...:wink:
AMpos
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Jun 05, 2020 12:47 am

Re: Can I have 2 times opened the same source?

Post by AMpos »

In the end I cut/copy one procedure to another source, so I have only to switch between source tabs.
Post Reply