Sublime Forum

Input panel with console output

#1

I think it would be useful to be able to create an input panel with an ouput pane like the console,

It doesn’t necessarily need to be it’s own buffer, maybe just the ability to showInputPanel(*args, console=True) so we can throw a few lines of output there.

It might also be advantageous to be able to set a scratch buffer to occupy that space instead of sharing the regular console output

Anyone else think this might be handy?

  • toothrot
0 Likes

#2

[quote=“toothrot”]I think it would be useful to be able to create an input panel with an ouput pane like the console,

It doesn’t necessarily need to be it’s own buffer, maybe just the ability to showInputPanel(*args, console=True) so we can throw a few lines of output there.

It might also be advantageous to be able to set a scratch buffer to occupy that space instead of sharing the regular console output

Anyone else think this might be handy?

  • toothrot[/quote]

You can already have scratch buffers. view.setScratch(True)

0 Likes

#3

I don’t think you read my post correctly. :wink:

I don’t want a regular scratch buffer in the file viewing area…I want to have a scratch buffer in the console area with an input attached

  • toothrot
0 Likes

#4

[quote=“toothrot”]I don’t think you read my post correctly. :wink:

I don’t want a regular scratch buffer in the file viewing area…I want to have a scratch buffer in the console area with an input attached

  • toothrot[/quote]

Oh… the only way I have gotten stuff to output to console is using stdout/stdin. Like if you do **print “hello world” **in a python script, the output will show in the console. But +1 on the console=True argument

0 Likes

#5

Thinking more on it, this mode would also be good with making the input a little more persistent…

I guess when it comes down to it what I’d like is the ability to have a custom console, or able to intercept input to the existing console and veto (perhaps by returning False) sending it to the REPL. Our own output could then be directed to the console. In addition to not obscuring the current view for a few lines of output, this would allow custom commands (commands not in python syntax), and a little interaction if desired.

0 Likes

#6

This might be useful?

[code]import sublime, sublimeplugin, functools, sys

class testing(sublimeplugin.TextCommand):
def run(self, view, args):
window = view.window()
window.showInputPanel(‘Type something:’,‘boo’,
functools.partial(self.doConsole, window, view),None,None)

def doConsole(self, window, view, inputText):
	sys.stdout.write(inputText)[/code]
0 Likes

#7

Yes, I know you can write to console a couple different ways, and in fact, if you call windomw.showInputPanel again in the handler for the input , you can’t tell that the input panel was ever gone (though it would be nice if this could be avoided with some kind of persistent=True)

The only problem is the console being shown with the input, so it seems that just adding console=True, or otherwise allowing the console to be displayed with the input panel, would make what I’m wanting to do possible

0 Likes