Recent

Author Topic: Lazarus devs, is it the time to add a vte now?  (Read 3193 times)

guest64953

  • Guest
Lazarus devs, is it the time to add a vte now?
« on: December 06, 2019, 05:57:25 pm »
Develop console app with Lazarus on Unix-like OS is a pain in the ass. If you can't proper call xterm, gnome-terminal, lxterminal or xfce4-terminal or sth... could you embedded a vte (virtual terminal emulator) into Lazarus? It will help the life of people like us easier.

You could see an example of an embedded vte, please look at Geany. If you don't want to said about Geany, Cudatext, an application developed by Lazarus itself, also has a working vte. You could keep it as reference to implement one for Lazarus.

p/s: I know Lazarus is mostly about GUI. But please improve the IDE for console app, too. I'm not intended to develop console app forever but you should now newbie wanted to learn the Pascal language firstly have to play with console app to familar with it first, before moving to GUI. It's really discourage new comers like me alot :'(

MarkMLl

  • Hero Member
  • *****
  • Posts: 1244
Re: Lazarus devs, is it the time to add a vte now?
« Reply #1 on: December 06, 2019, 06:05:16 pm »
What /exactly/ are you asking for here? A component that you can put on a form into which a shell or some other command-line processor can be embedded?

MarkMLl

Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8734
  • FPC developer.
Re: Lazarus devs, is it the time to add a vte now?
« Reply #2 on: December 06, 2019, 06:06:57 pm »
Yes, too much steering to a "solution" with pointers to "others" without actually narrowingly defining the real problem

guest64953

  • Guest
Re: Lazarus devs, is it the time to add a vte now?
« Reply #3 on: December 06, 2019, 06:11:34 pm »
What /exactly/ are you asking for here? A component that you can put on a form into which a shell or some other command-line processor can be embedded?

MarkMLl

Embedded a VTE to Lazarus itself, to display output and input from console app, not a component  :o

guest64953

  • Guest
Re: Lazarus devs, is it the time to add a vte now?
« Reply #4 on: December 06, 2019, 06:12:29 pm »
Yes, too much steering to a "solution" with pointers to "others" without actually narrowingly defining the real problem

I think I write a different dialect of English than the rest of the world  %)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6631
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus devs, is it the time to add a vte now?
« Reply #5 on: December 06, 2019, 06:21:59 pm »
As far as I can tell this is about debugging console apps.

The Lazarus "console output" window is plain text. Terminal/Ansi/Escape sequences have no effect.

Adding a vte, is a question of manpower. Or in other words: Patches welcome.
The "terminal output" window is a single unit (somewhere in the debugger directory). It has one event, that is called with any data from stdout, and one method it can call to send to the apps stdin. There is also already example code to send signals to the app (window size changed).
So to write a patch all you need is to know how to to the vte.

There are some workarounds too, but they are lacking a lot of comfort:
https://wiki.lazarus.freepascal.org/Debugger_Console_App
You can use the gdbserver trick.
Or you can redirect to a pty (see the bottom of the page "ConsoleTty" option in the debugger properties)

Of course no workaround replaces the need for a proper solution. But as I said: manpower...
« Last Edit: December 06, 2019, 06:36:22 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 2000
Re: Lazarus devs, is it the time to add a vte now?
« Reply #6 on: December 06, 2019, 06:22:28 pm »
I think I write a different dialect of English than the rest of the world  %)
That's probably true.

you should now newbie wanted to learn the Pascal language firstly have to play with console app to familar with it first, before moving to GUI. It's really discourage new comers like me alot :'(
If all you are interested in is to learn the Pascal language in a "simple" environment, which is quite understandable, specifying {$APPTYPE CONSOLE} seems to be all you need.

If you want features specific to a particular terminal emulator, it's quite likely there are units out there to emulate specific terminals, you're free to choose whichever you like best from those available.

FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Handoko

  • Hero Member
  • *****
  • Posts: 3775
  • My goal: build my own game engine using Lazarus
Re: Lazarus devs, is it the time to add a vte now?
« Reply #7 on: December 06, 2019, 06:23:05 pm »
@hunghung

I really appreciate that you want Lazarus/FPC to be better. But as you already knew Lazarus/FPC aren't financial supported by any big company, most or maybe all of the users and the developers can only spend their free time to improving it.

Lazarus/FPC are awesome but not perfect. Have many bugs and lack of some features that we need. Instead of criticizing - which usually won't change anything, you can help make it better by submitting bug reports on the bug tracker. Or join the mailling list and become a developer fixing bugs and writing new features.

Don't forget, the more you show us the red angry faces, it only harms you more than doing good.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1244
Re: Lazarus devs, is it the time to add a vte now?
« Reply #8 on: December 06, 2019, 06:53:24 pm »
What /exactly/ are you asking for here? A component that you can put on a form into which a shell or some other command-line processor can be embedded?

Embedded a VTE to Lazarus itself, to display output and input from console app, not a component  :o

At least on Linux, fairly easily done with a TProcess. At least until you want decent cursor control (termcap/curses etc.), although there might also be pitfalls regarding keeping the overall form responsive at the same time as the child process is being handled.

Noting Martin's comments, I did some work on the console I/O window a few months ago. It /might/ be possible to hook cursor positioning sequences etc., but I don't know to what extent they're likely to get messed up by the fact that everything's going via gdb. I certainly got it to the state where all of the control sequences could be seen (hex output formatting etc.) although I suspect that some of that might have regressed (somebody fixed Unicode output which I couldn't work out, and it might have had side effects although I've not tested thoroughly).

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3830
  • I like bugs.
Re: Lazarus devs, is it the time to add a vte now?
« Reply #9 on: December 06, 2019, 08:53:49 pm »
... Cudatext, an application developed by Lazarus itself, also has a working vte. You could keep it as reference to implement one for Lazarus.
Could it be used directly? It would make sense to reuse such code.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8734
  • FPC developer.
Re: Lazarus devs, is it the time to add a vte now?
« Reply #10 on: December 06, 2019, 08:59:27 pm »
Yes, too much steering to a "solution" with pointers to "others" without actually narrowingly defining the real problem

I think I write a different dialect of English than the rest of the world  %)

Not really. Simple cause and effect. Describe more (and more narrowly) what your problems are, and less what you think the solution should be. Proposing solutions and comparisons without thorough investigations are dangerous.

dbannon

  • Hero Member
  • *****
  • Posts: 1153
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus devs, is it the time to add a vte now?
« Reply #11 on: December 07, 2019, 12:41:07 am »
I think I write a different dialect of English than the rest of the world  %)

yeah, probably but that really does not matter. People here want to help ...

hunghung, if all you want to do at this stage is console apps and you are already a Unix user, then maybe you don't need the Lazarus IDE at all ?    You probably already use vi or vim and love its lightening fast responses, why not look at its ability to set up commands to shell out, run the compiler and then execute your code ?   Debugging is a bit harder, probably easier in the Lazarus but maybe a mix ?

I am sure there will be some EMACS user chime in saying EMACS is better still, more lines of code than you average operating system ....

Davo 
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

guest64953

  • Guest
Re: Lazarus devs, is it the time to add a vte now?
« Reply #12 on: December 07, 2019, 02:47:17 am »
I know to be able to bind gdb and the output terminal window is hard, on other IDE I think they are utilizing a library to directly call gdb API but not just the gdb binary itself. But it's about Run with debug. Most of them also offer Run without debugging. It's simply as calling the terminal emulator program via TProcess.

Most arguments here also applied for other terminal emulator program as well: https://www.mankier.com/1/xfce4-terminal

It's the easiest way for you, being lacked of man power. Sometime it's just good enough to see the app running on a pretty looking terminal emulator window  :D

p/s: I didn't said about the VTE on this post but about calling a terminal emulator program via TProcess to run the console app.

guest64953

  • Guest
Re: Lazarus devs, is it the time to add a vte now?
« Reply #13 on: December 07, 2019, 02:53:22 am »
... Cudatext, an application developed by Lazarus itself, also has a working vte. You could keep it as reference to implement one for Lazarus.
Could it be used directly? It would make sense to reuse such code.

I didn't check the code of Cudatext but it developer also on this forum, Alextp, you could ask him. But I think it's not a ready to use component you could drag into a form and use immediately. The code just to be a reference, demonstrated that such thing is already possible with a Lazarus based program so it would be also possible with Lazarus itself.

guest64953

  • Guest
Re: Lazarus devs, is it the time to add a vte now?
« Reply #14 on: December 07, 2019, 03:01:26 am »
I think I write a different dialect of English than the rest of the world  %)

yeah, probably but that really does not matter. People here want to help ...

hunghung, if all you want to do at this stage is console apps and you are already a Unix user, then maybe you don't need the Lazarus IDE at all ?    You probably already use vi or vim and love its lightening fast responses, why not look at its ability to set up commands to shell out, run the compiler and then execute your code ?   Debugging is a bit harder, probably easier in the Lazarus but maybe a mix ?

I am sure there will be some EMACS user chime in saying EMACS is better still, more lines of code than you average operating system ....

Davo

OMG I'm the later generation of sysadmin. I hate vi/vim with a passion and prefer to use nano/joe. The first thing I do on a Unix-like server is install nano and set EDITOR=nano. Luckily, on Linux based system nano is already installed by default  :D

Of course I could just use Geany or Cudatext and compile with fpc  :D

 

TinyPortal © 2005-2018