Repository: NationalSecurityAgency/ghidra
File: Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/interpreters/AbstractDebuggerWrappedConsoleConnection.java (Java)

Code before:

		@Override
		public void consoleOutput(TargetObject console, Channel channel, byte[] out) {
			OutputStream os;
			switch (channel) {
				case STDOUT:
					os = stdOut;
					break;
				case STDERR:
					os = stdErr;
					break;
				default:
					throw new AssertionError();
			}
			// It's possible stdOut/Err was not initialized, yet
			if (os == null) {
				return;
			}
			/**
			 * NB: yes, the extra space is lame... The InterpreterPanel's repositionScrollPane
			 * method subtracts 1 from the text length to compute the new position causing it to
			 * scroll to the last character printed. We want it to scroll to the next line, so...
			 */
			try {
				os.write(out);
				os.write(' ');
			}
			catch (IOException e) {
				Msg.error(this, "Cannot write to interpreter window: ", e);
			}
		}

		@AttributeCallback(TargetObject.DISPLAY_ATTRIBUTE_NAME)
		public void displayChanged(TargetObject object, String display) {
			// TODO: Add setSubTitle(String) to InterpreterConsole
			if (guiConsole == null) {
				/**
				 * Can happen during init. setSubTitle will get called immediately after guiConsole
				 * is initialized.
				 */
				return;
			}
			InterpreterComponentProvider provider = (InterpreterComponentProvider) guiConsole;
			Swing.runLater(() -> provider.setSubTitle(display));
		}

		@AttributeCallback(TargetInterpreter.PROMPT_ATTRIBUTE_NAME)
		public void promptChanged(TargetObject interpreter, String prompt) {
			if (guiConsole == null) {
				/**
				 * Can happen during init. setPrompt will get called immediately after guiConsole is

Review comment (suggestion):
I'm all for removing this code, if it's actually no longer needed. I see a corresponding change in `InterpreterPanel.java` below.... Good, but that might be there for a reason.

Code after:

		@Override
		public void consoleOutput(TargetObject console, Channel channel, byte[] out) {
			OutputStream os;
			switch (channel) {
				case STDOUT:
					os = stdOut;
					break;
				case STDERR:
					os = stdErr;
					break;
				default:
					throw new AssertionError();
			}
			// It's possible stdOut/Err was not initialized, yet
			if (os == null) {
				return;
			}
			try {
				os.write(out);
			}
			catch (IOException e) {
				Msg.error(this, "Cannot write to interpreter window: ", e);
			}
		}

		@AttributeCallback(TargetObject.DISPLAY_ATTRIBUTE_NAME)
		public void displayChanged(TargetObject object, String display) {
			// TODO: Add setSubTitle(String) to InterpreterConsole
			if (guiConsole == null) {
				/**
				 * Can happen during init. setSubTitle will get called immediately after guiConsole
				 * is initialized.
				 */
				return;
			}
			InterpreterComponentProvider provider = (InterpreterComponentProvider) guiConsole;
			Swing.runLater(() -> provider.setSubTitle(display));
		}

		@AttributeCallback(TargetInterpreter.PROMPT_ATTRIBUTE_NAME)
		public void promptChanged(TargetObject interpreter, String prompt) {
			if (guiConsole == null) {
				/**
				 * Can happen during init. setPrompt will get called immediately after guiConsole is
				 * initialized. NB. It happens in DebuggerWrappedInterpreterConnection
				 */
				return;
			}
			Swing.runLater(() -> guiConsole.setPrompt(prompt));
		}