New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch 'console' #127

Closed
ccoupe opened this Issue Jun 2, 2015 · 9 comments

Comments

Projects
None yet
2 participants
@ccoupe
Contributor

ccoupe commented Jun 2, 2015

Since adding a low level console (Gtk/Cocoa) is experimental and is going to take a week or two or more to find out if it works, I've created a new branch for all the changes - they are many.

Basically it creates a shoes command 'show_console'. Not many user apps are expected to use that. That vectors off (evenutally) to shoes_native_console, a ruby singleton in gtk.c and cocoa.m.

@ccoupe ccoupe added the Enhancement label Jun 2, 2015

@ccoupe ccoupe self-assigned this Jun 2, 2015

ccoupe added a commit that referenced this issue Jun 2, 2015

Initial checkin for #127, branch 'console'
* shoes_native_console Stubs for gtk (win and linux) are called properly
* Windows creates new console if needed.

ccoupe added a commit that referenced this issue Jun 3, 2015

Another checkin for #127 - includes the terminal code
* and a working prompt/echo loop when you select Debug an App from splash
  screen. Demonstates thats it does replace stdin/stdout/stderr
* Will byebug freeze gtk? Still need to hook it up properly to find out.
* doesn't fix scrolling problems.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jun 16, 2015

Contributor

After some gdb and head scratching I can see that running byebug with a Shoes 'console' is going to be damn near impossible. (gtk main loop thread is a ruby thread which byebug will stop and moving ruby to another gthread is not a brilliant idea and no help for Cocoa. Therefore, no need for 'C' code.

Issue #17, #110 could be solved by using the pure ruby 'console' implemented in branch 'console', debugger.rb. There is a conflict in 'purpose' or duplication with log.rb and irb.rb that we need to think about.

Still mulling the design specs. Just mimic io.getc and io.putc for $stdin/$stdout/$stderr. For sure we want the 'copy' button so we need a button for that. And a scrollbar and it always scrolls. And a clear button. Mimic/handle history/rb-readline/io-console things? And --console cmd line flag to show it at startup.

Contributor

ccoupe commented Jun 16, 2015

After some gdb and head scratching I can see that running byebug with a Shoes 'console' is going to be damn near impossible. (gtk main loop thread is a ruby thread which byebug will stop and moving ruby to another gthread is not a brilliant idea and no help for Cocoa. Therefore, no need for 'C' code.

Issue #17, #110 could be solved by using the pure ruby 'console' implemented in branch 'console', debugger.rb. There is a conflict in 'purpose' or duplication with log.rb and irb.rb that we need to think about.

Still mulling the design specs. Just mimic io.getc and io.putc for $stdin/$stdout/$stderr. For sure we want the 'copy' button so we need a button for that. And a scrollbar and it always scrolls. And a clear button. Mimic/handle history/rb-readline/io-console things? And --console cmd line flag to show it at startup.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jun 17, 2015

Contributor

I think I want to pursue the Gtk & Cocoa 'C' solution for Linux and OSX (maybe Windows but that already works), Here's a screen shot of the very early Gtk console when you start shoes with --console. - it runs a test loop
gtkconsole

Button panel layout is incorrect, It's not pretty. It Scrolls incorrectly. Doesn't do readline editing ... But it's wired up to stdin/out and doesn't have to de construct Shoes formatted textblocks and the cmdline editing can be added with io-console and and or rbreadline. I think.

Contributor

ccoupe commented Jun 17, 2015

I think I want to pursue the Gtk & Cocoa 'C' solution for Linux and OSX (maybe Windows but that already works), Here's a screen shot of the very early Gtk console when you start shoes with --console. - it runs a test loop
gtkconsole

Button panel layout is incorrect, It's not pretty. It Scrolls incorrectly. Doesn't do readline editing ... But it's wired up to stdin/out and doesn't have to de construct Shoes formatted textblocks and the cmdline editing can be added with io-console and and or rbreadline. I think.

ccoupe added a commit that referenced this issue Jun 17, 2015

@ccoupe ccoupe added this to the 3.2.24 milestone Jun 17, 2015

ccoupe added a commit that referenced this issue Jun 20, 2015

Linux #127 --console flag on command line works.
* redirects stdin/out/err to Gtk2 window. Can read from stdin (keypress)
* short circuts most of the tesi escape handling. TODO
* still need to handle ^H line editing
* mostly only works if script is given
  dist/shoes --console foo.rb
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jun 21, 2015

Contributor

It's looking and acting 'not that bad' on Linux:
linux console

Information at https://github.com/Shoes3/shoes3/wiki/Design:-New-Shoes-Console.

Contributor

ccoupe commented Jun 21, 2015

It's looking and acting 'not that bad' on Linux:
linux console

Information at https://github.com/Shoes3/shoes3/wiki/Design:-New-Shoes-Console.

ccoupe added a commit that referenced this issue Jun 21, 2015

For #127, It's working OK enough. Still needs to
* Look pretty (background on the button panel and spacing)
* readline and io-console line editing problems with ^H

ccoupe added a commit that referenced this issue Jun 26, 2015

Fixed line editing #127 for Linux (^H only)
* works with io/console raw and cooked (as documented, you don't want cooked)
  and with readline (recommended)
* samples/expert-console.rb to show what you need to do to read the console
* updated wiki https://github.com/Shoes3/shoes3/wiki/Design:-New-Shoes-Console
* cocoa.m stubbed out. For now. Might merge 'console' branch with master soon.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jun 30, 2015

Contributor

Started on the OSX --console. This is has almost nothing to do with Ruby or Shoes. The Linux pty/backend compiles and should work pretty much as it does on Linux.
osx-console

Still have to hook up an NSScrollView to something Text Handling (NSTextView?) and handle the keyboard.

Contributor

ccoupe commented Jun 30, 2015

Started on the OSX --console. This is has almost nothing to do with Ruby or Shoes. The Linux pty/backend compiles and should work pretty much as it does on Linux.
osx-console

Still have to hook up an NSScrollView to something Text Handling (NSTextView?) and handle the keyboard.

ccoupe added a commit that referenced this issue Jun 30, 2015

Start work on OSX console #127.
* much work to do with NSScrollView and ?widget (view/control)
* keyboard shouldn't be too hard.
* copy/clear buttons are called but depends on the ?widget

ccoupe referenced this issue Jul 8, 2015

* deleted comments and unused code. More to do.
* DON'T call NSLog() - it resets stderr/stdout - dont ask me how but it does
* Keyboard input works is some situations.
* need to handle \b when read from stdout

ccoupe added a commit that referenced this issue Jul 9, 2015

OSX: getting closer for #127. Almost good enoug.
* backspace works.
* clear button works.
* subclass NSTextView to handle key press. Good but should pass events
  up the the view chain.
* fprintf(stderr.. works, fprintf(stdout.. not so much) Deep OSX voodoo.
* Getting near the finish line. (snort)
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 13, 2015

Contributor

Status report. The OSX code does the important things correctly for this 'feature'. The less important things are - setting the correct font on the NSTextView and some odd behaviour if you manually drag the scroll thumb up. Yes, those bugs do need to be fixed before closing the issue.

It's also usable on all three platforms if your expectations are lowered to what was proposed (not much). I'd really like to merge the console branch into master. The feature is mostly isolated to new files (.h., .c ,.m) - no need to change anything more in base Shoes - other than update the manual and changelog saying there is now Shoes::show_console command and fixing the OSX and Linux packagers to support --console and maybe allowing it to be an option when packaging from the GUI. All of those are better done after merging to master.

Contributor

ccoupe commented Jul 13, 2015

Status report. The OSX code does the important things correctly for this 'feature'. The less important things are - setting the correct font on the NSTextView and some odd behaviour if you manually drag the scroll thumb up. Yes, those bugs do need to be fixed before closing the issue.

It's also usable on all three platforms if your expectations are lowered to what was proposed (not much). I'd really like to merge the console branch into master. The feature is mostly isolated to new files (.h., .c ,.m) - no need to change anything more in base Shoes - other than update the manual and changelog saying there is now Shoes::show_console command and fixing the OSX and Linux packagers to support --console and maybe allowing it to be an option when packaging from the GUI. All of those are better done after merging to master.

ccoupe pushed a commit that referenced this issue Jul 18, 2015

Cecil Coupe
osx: fixes
* fix #138 (no icon in ask()
* draw icon in console #127
* tweak bug119.rb
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 24, 2015

Contributor

Getting near the 'good enough for me' point. blog post http://walkabout.mvmanila.com/2015/07/24/need-a-console/

Contributor

ccoupe commented Jul 24, 2015

Getting near the 'good enough for me' point. blog post http://walkabout.mvmanila.com/2015/07/24/need-a-console/

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 24, 2015

Contributor

👍 excellent job :-)

Contributor

passenger94 commented Jul 24, 2015

👍 excellent job :-)

ccoupe added a commit that referenced this issue Jul 26, 2015

For #127, osx
* pixel positioning tweaks. Grrr.
* Add a static text label widget  to btn panel.
* page up/down keys work
* done with this until someone uses it and complains.
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 26, 2015

Contributor

I'll leave this open for a while, but I'm done with this feature. It does have to be converted to gtk3 with some #ifdefs and the gtk version should draw the icon like OSX does but it really doesn't matter.
osx-console

Contributor

ccoupe commented Jul 26, 2015

I'll leave this open for a while, but I'm done with this feature. It does have to be converted to gtk3 with some #ifdefs and the gtk version should draw the icon like OSX does but it really doesn't matter.
osx-console

ccoupe added a commit that referenced this issue Aug 7, 2015

Issue #127 - console
* compile the console for Tight Shoes
* Console code needs a gtk3 conversion someday
* gtk should draw an icon in the button panel so OSX folks don't sneer at us

ccoupe added a commit that referenced this issue Aug 7, 2015

Finish #127 - half baked as it is
* update the Shoes manual. Furthermore->Hidden (there's a lot we could add
  that section)
@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Aug 12, 2015

Contributor

closing issue. 3.2.24 has a 'console' on all platforms. use Shoes::show_console. No where near perfect - lowest common denominator and there are many denominators.

Contributor

ccoupe commented Aug 12, 2015

closing issue. 3.2.24 has a 'console' on all platforms. use Shoes::show_console. No where near perfect - lowest common denominator and there are many denominators.

@ccoupe ccoupe closed this Aug 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment