Re: [Lazarus] Xterm, konsole etc.
2013/6/15 Mark Morgan Lloyd markmll.laza...@telemetry.co.uk What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I never used it, but what about: http://wiki.freepascal.org/CmdLine Vincent -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On 06/17/2013 11:23 PM, Mark Morgan Lloyd wrote: I don't claim to have anything like the expertise to do all of the work (I've never tackled a component in either Delphi or Lazarus), but it might be worthwhile kicking ideas around. The ICS (overbyte) package has an open source VT terminal emulator which is rather complete. Has anybody tried to port this to Lazarus? It is fairly windows centric though. Ludo -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
Hans-Peter Diettrich wrote: Mattias Gaertner schrieb: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Please specify: do you want a terminal (e.g. VT-52) or a shell window? I think it's necessary to separate shell (e.g. Bash on Linux) and window for the purpose of discussion. The interesting case there is where a shell running in e.g. Xterm or Konsole, which normally appends output to the last line and scrolls, switches to running a text editor such as Vi where scrolling is inhibited. There's also the issue of keeping the environment variables that tell a child process the window size (in character units) up to date, and sending a WINCH signal when appropriate. Once there's a control that can handle character-addressable output (and ideally can scroll as well), implementing VT-100 (or -52, or 3270, or whatever legacy command set one's lumbered with) is comparatively simple. It also depends somewhat on the underlying communications mechanism, i.e. serial, telnet, tn3270 or whatever turns you on. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On 18-6-2013 10:44, Mark Morgan Lloyd wrote: Hans-Peter Diettrich wrote: Mattias Gaertner schrieb: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: Once there's a control that can handle character-addressable output (and ideally can scroll as well), implementing VT-100 (or -52, or 3270, or whatever legacy command set one's lumbered with) is comparatively simple. It also depends somewhat on the underlying communications mechanism, i.e. serial, telnet, tn3270 or whatever turns you on. Yummy, tn3270. I wouldn't mind a Lazarus implementation of a 3270 client... goes well with the Hercules emulator ;) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
Reinier Olislagers wrote: On 18-6-2013 10:44, Mark Morgan Lloyd wrote: Hans-Peter Diettrich wrote: Mattias Gaertner schrieb: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: Once there's a control that can handle character-addressable output (and ideally can scroll as well), implementing VT-100 (or -52, or 3270, or whatever legacy command set one's lumbered with) is comparatively simple. It also depends somewhat on the underlying communications mechanism, i.e. serial, telnet, tn3270 or whatever turns you on. Yummy, tn3270. I wouldn't mind a Lazarus implementation of a 3270 client... goes well with the Hercules emulator ;) :-) I was using that as a particular example, since I suspect that at the lower levels it's fairly distinct from standard telnet (and at the higher levels it's a law unto itself). I've written an emulator for a 2741 but that was straight telnet, talking to VM on Hercules. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On 17/06/2013 17:13, Mattias Gaertner wrote: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Count me in (for wanting to have), would be nice for the debugger (linux) (and Mac, if someone knows how to simulate a tty) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
Am Montag, den 17.06.2013, 19:02 +0100 schrieb Martin: On 17/06/2013 17:13, Mattias Gaertner wrote: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Count me in (for wanting to have), would be nice for the debugger (linux) (and Mac, if someone knows how to simulate a tty) Only a thought: Isn't that exactly what any editor window does? Maybe a stripped down SynEdit would do? If using (n)curses is no option, writing or reusing a char interpreting component would be [the|one] way to go. -- Marc Santhoff m.santh...@web.de -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
Martin wrote: On 17/06/2013 17:13, Mattias Gaertner wrote: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Count me in (for wanting to have), would be nice for the debugger (linux) (and Mac, if someone knows how to simulate a tty) I don't claim to have anything like the expertise to do all of the work (I've never tackled a component in either Delphi or Lazarus), but it might be worthwhile kicking ideas around. Almost everything I do ends up having at least one terminal pane, at the very least for status/debugging output. This needs to be scrollable, with a limit on the number of history lines, and (optionally) for the insertion point to be forced visible when there's fresh output. Copy to clipboard, save as text etc. are desirable, paste etc. not. I've hooked into TSynEdit.KeyDown to get full control of the keyboard, and injected Unicode characters using IntfUTF8KeyPress(). This allowed me to put APL characters etc. into text I was editing, there was nothing from a tty line etc. in this case and I didn't need colour. For an actual terminal emulator (emulating an old IBM electromechanical terminal), I've experimented with TMemo and TListBox, with the option of using TRichMemo if available; I also tried basing something on TCmdBox but it didn't really suit. In all cases I hooked the KeyDown event translating it to 8-bit ASCII rather than Unicode, I found a few detail differences between Qt and GTK keycodes. Output was done by rather painfully tacking onto the stringlist etc. that underlay the control, with colour (black/red) handling in some cases- this used custom escape sequences, since the thing I was emulating long preceded ANSI/VT100. Something else I've done displays terminal output from a protocol analyzer, this includes serial control line transitions, graphical control characters and possibly things like Prestel/Minitel which I don't think are in Unicode. The current thing I'm looking at is a number of programs (APL systems) which require custom 8-bit keyboard and screen handling which would correctly by done by tweaking the X configuration. Unfortunately this is system-wide so I'm wondering whether it could be done by a Lazarus (and/or text-mode FPC) wrapper around the program. A twist in this case is that one of these systems wants to shell out to an editor. One approach- the one I'm using at the moment- would be to simply run vi (or whatever) in a shell, but it would be nicer to be able to pass full control back to the terminal and have it save just the edited lines. As Marc says, some tweak to Synedit might be viable provided that it was able to handle colours etc. properly. The basic control would probably have two modes (cell-addressable and extensible) with provision for attaching keyboard and escape-sequence handlers. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On 17/06/2013 22:23, Mark Morgan Lloyd wrote: I don't claim to have anything like the expertise to do all of the work (I've never tackled a component in either Delphi or Lazarus), but it might be worthwhile kicking ideas around. Almost everything I do ends up having at least one terminal pane, at the very least for status/debugging output. This needs to be scrollable, with a limit on the number of history lines, and (optionally) for the insertion point to be forced visible when there's fresh output. Copy to clipboard, save as text etc. are desirable, paste etc. not. I've hooked into TSynEdit.KeyDown to get full control of the keyboard, and injected Unicode characters using IntfUTF8KeyPress(). This allowed me to put APL characters etc. into text I was editing, there was nothing from a tty line etc. in this case and I didn't need colour. . As Marc says, some tweak to Synedit might be viable provided that it was able to handle colours etc. properly. The basic control would probably have two modes (cell-addressable and extensible) with provision for attaching keyboard and escape-sequence handlers. From memory: I would (if I had time) start a new component, not inheriting, but starting on a copy of SynEdit Or even throwing out most of it, except Keeping - the textbuffer (keep bidi-view, but get rid of folding and trim space [those are wrappers around the textbuffer]) - LazSynSurface (which paints the text) - caret - create a markup module for highlight (must also store the color info) then copy stuff for selection and clipboard, if needed Some of that code is still under redesign in SynEdit, so that may mean some maintenance later. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
On 17/06/2013 23:30, Martin wrote: From memory: I would (if I had time) start a new component, not inheriting, but starting on a copy of SynEdit Or even throwing out most of it, except Keeping - the textbuffer (keep bidi-view, but get rid of folding and trim space [those are wrappers around the textbuffer]) - LazSynSurface (which paints the text) - caret - create a markup module for highlight (must also store the color info) then copy stuff for selection and clipboard, if needed Some of that code is still under redesign in SynEdit, so that may mean some maintenance later. Attached is what it takes to start. Just a rough draft, but it already draws the text. And has the buffer. Add your own keyboard... Also needs to add support for doublewidth (Japanese) chars (that is just a wrapper for the buffer. Search SynEdit for ScreenCaret (the actual | ) and caret... There will be some issues, because some things expect a TSynEdit and this is not pack_syn_cmd.rar Description: Binary data -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Xterm, konsole etc.
Mattias Gaertner schrieb: On Sat, 15 Jun 2013 13:46:57 + Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. I'm interested in a terminal LCL control as well. Please specify: do you want a terminal (e.g. VT-52) or a shell window? A shell IMO should run in a platform process window, possibly embedded into some container (control, form...). DoDi -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Xterm, konsole etc.
What's the easiest way to implement something like xterm or konsole, that has minimal escape decoding for e.g. cursor control but under normal circumstances buffers output lines in scrollable form? What I'm trying to do is implement some special 8-bit codepage mapping for programs run inside a window, but it would be desirable to be able to run a (unix) shell and a standard editor such as vi. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus