Error in String:newTextWindow?

The definition of newTextWindow in StringPlusGui.sc sets the default-value of the makeListener-argument to ‘false’ and then uses makeListener as the third argument in Document.new, where an Enviroment is expected (see Document | SuperCollider 3.14.0 Help).

newTextWindow { arg title="Untitled", makeListener=false;
		Document.new(title, this, makeListener);
	}

This creates a problem when using NdefGuis.

// 1. create a NdefGui
Ndef(\1).gui;

// 2. Click Button "doc" in GUI "NdefGui_1"

// 3. Click into the newly created Document-Window "document-Ndef_1"

// 4. Click Button "doc" again in GUI "NdefGui_1"

ERROR: Message 'use' not understood.
Perhaps you misspelled 'cs', or meant to call 'use' on another receiver?
RECEIVER:
   false
ARGS:
Instance of Function {    (0x141090868, gc=6C, fmt=00, flg=00, set=02)
  instance variables [2]
    def : instance of FunctionDef in Method NodeProxy:asCode
    context : Frame (0x170073d98) of NodeProxy:asCode
}
KEYWORD ARGUMENTS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = false
		arg selector = 'use'
		arg args = [*1]
		arg kwargs = [*0]
	NodeProxy:asCode
		arg this = <instance of Ndef>
		arg includeSettings = true
		arg includeMonitor = true
		arg envir = false
		var nameStr = nil
		var srcStr = nil
		var str = nil
		var docStr = nil
		var accessStr = "a"
		var space = nil
		var spaceCS = nil
		var isAnon = nil
		var isSingle = nil
		var isInCurrent = nil
		var isOnDefault = nil
		var isMultiline = nil
	NodeProxy:document
		arg this = <instance of Ndef>
		arg includeSettings = true
		arg includeMonitor = true
		var nameStr = "Ndef_1"
	Button:doAction
		arg this = <instance of Button>
		arg modifiers = 0
	Button:prDoAction
		arg this = <instance of Button>
		arg mods = 0
^^ ERROR: Message 'use' not understood.
Perhaps you misspelled 'cs', or meant to call 'use' on another receiver?
RECEIVER: false

Because envir = false Nodeproxy.asCode errors when sending it the message use.

Anybody knows what the function of makeListener in 'String:newTextWindow` should be?
Is it safe to change newTextWindow like so (this solves the described Problem with NdefGui)?

newTextWindow { arg title="Untitled";
		Document.new(title, this);
	}

hm, seems like makeListener could be savely removed as it only occurs in newTextWindow. But maybe i-m using grep wrong here?

mstep@mstep-mbpro ~ % grep -re makeListener /Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/*
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:	// newTextWindow { arg title="Untitled", makeListener=false;
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:	// 	Document.new(title, this, makeListener);

Another option would be to change the default value of makeListener to currentEnvironment.

newTextWindow { arg title="Untitled", makeListener=currentEnvironment;
		Document.new(title, this, makeListener);
	}

hm, also searching through downloaded quarks reveals that makeListener is used in scel-quark and makeListener = false appears several times. So this seems to be a more complex issue.

mstep@mstep-mbpro ~ % grep -re makeListener /Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/* ~/Library/Application\ Support/SuperCollider/downloaded-quarks/*
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:	// newTextWindow { arg title="Untitled", makeListener=false;
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:	// 	Document.new(title, this, makeListener);
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:	newTextWindow { arg title="Untitled", makeListener=currentEnvironment;
/Applications/SuperCollider/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc:		Document.new(title, this, makeListener);
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/ScelDocument.sc:	*new{ | title = "Untitled", string = "", makeListener = false, toFront=true |
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/ScelDocument.sc:		^super.prBasicNew.init( title, string, makeListener, toFront );
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/ScelDocument.sc:	init{ |title, string, makeListener, toFront|
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/ScelDocument.sc:		EmacsDocument.prNewFromString(title, string, makeListener, { |doc| thisdoc = doc; thisdoc.sceld = this; cFuncs.do{ |it| it.value(doc)} });
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/Document.sc:	*new { | title="Untitled", string="", makeListener=false, envir |
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/Document.sc:		var doc = Document.implementationClass.new(title, string, makeListener);
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/Document.sc:	initByString{ | argTitle, str, makeListener |
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/Document.sc:		this.prinitByString(argTitle, str, makeListener);
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/Document.sc:	prinitByString { | title, str, makeListener |
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/EmacsDocument.sc:	*prNewFromString { | name, str, makeListener, completionFunc |
/Users/mstep/Library/Application Support/SuperCollider/downloaded-quarks/quarks/scel/sc/scide_scel/EmacsDocument.sc:			[name, str, makeListener],

one last thing:
i think String.newTextWindow should be changed because "Test".newTextWindow creates a Document whose currentEnvironment returns false and that seems wrong to me.

ok, seems like makeListener is a leftover from old times an could be removed

here is some info what makeListener was doing:

btw. if you-re an emacs-user you don-t have those problems, probably because then your definition of Document.new is this:

	*new { | title="Untitled", string="", makeListener=false, envir |
		var doc = Document.implementationClass.new(title, string, makeListener);
		if (envir.notNil and: { doc.notNil }) { doc.envir_(envir) };
		^doc
	}

coming from /scel/sc/scide_scel/Document.sc

I now overwrite String:newTextWindow like this on my System:

+ String {
	newTextWindow { arg title="Untitled", envir;
		Document.new(title, this, envir);
	}
}

if anybody thinks making a PR also would be a good idea i would be willing to learn how to do it.