On 10/25/2012 3:27 PM, Jens Mueller wrote:
Anybody an idea how to this on Linux?
Much of this is implemented in one way or another as part of the source code for
MicroEmacs, downloadable from digitalmars.com.
https://github.com/DigitalMars/me
Adam D. Ruppe wrote:
Here we go, some more basic functions:
http://arsdnet.net/dcode/terminal.d
The unix stuff is more implemented than the windows.
Let's walk through main and I'll discuss why I'm doing things the
way I am. I'm throwing this out just to show one possible way this
Tobias Pankrath wrote:
On Tuesday, 23 October 2012 at 22:47:40 UTC, Walter Bright wrote:
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12
9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one
to make a
decision. The core Phobos developers
Adam D. Ruppe wrote:
It now can translate most PC keyboard input sequences into char or
non-char key events, including requesting UTF-8 input for chars:
http://arsdnet.net/dcode/terminal.d
We could just about start writing real apps with this now. Biggest
problem left is it doesn't
If you can add an event loop on top that would be great. What
do I need
to make sure that you can add the event handling on top?
Jens
I don't think that this needs any special consideration. If you
look at Adams code samples in this thread, he's building his own
event loop on input.getch.
On Sunday, 28 October 2012 at 10:44:58 UTC, Jens Mueller wrote:
How?
The file /etc/termcap has the data too so opening it and quickly
parsing should give the same result as the environment variable.
It looks like this:
vg|vt-generic|Generic VT entries:\
:bs:mi:ms:pt:xn:xo:it#8:\
Adam D. Ruppe wrote:
On Sunday, 28 October 2012 at 10:44:58 UTC, Jens Mueller wrote:
How?
The file /etc/termcap has the data too so opening it and quickly
parsing should give the same result as the environment variable.
I'm running Debian. It doesn't have such a file.
It looks like this:
On Sunday, 28 October 2012 at 14:09:09 UTC, Jens Mueller wrote:
I'm running Debian. It doesn't have such a file.
They must just depend on terminfo. That's more complicated to
read though - it isn't a plain text file anymore, so doing it
without a library is going to be more of a pain.
I
On Sun, Oct 28, 2012 at 03:15:46PM +0100, Adam D. Ruppe wrote:
On Sunday, 28 October 2012 at 14:09:09 UTC, Jens Mueller wrote:
I'm running Debian. It doesn't have such a file.
They must just depend on terminfo. That's more complicated to read
though - it isn't a plain text file anymore, so
On Sunday, 28 October 2012 at 14:53:31 UTC, H. S. Teoh wrote:
Why not use a library? Terminfo is designed precisely for this.
Sometimes linking in external libraries in Phobos can be a
problem for licensing or Just Works portability.
idk about terminfo, I haven't really looked at it. (tbh I
Robik let me add my code to his repository with the plan to merge
the two files later, but for now I just pushed my file up there.
https://github.com/robik/ConsoleD/blob/master/terminal.d
It now has /etc/termcap support, a builtin termcap to work in a
pinch if the system doesn't have one, and
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font styles such as
underline and strikethrough(Posix feature
On Friday, 26 October 2012 at 18:58:20 UTC, Adam D. Ruppe wrote:
I think this is another benefit of capturing the input with a
special type and method.
I've implemented the basic events for linux now:
http://arsdnet.net/dcode/terminal.d
Still need to check more of the input sequences, but it
It now can translate most PC keyboard input sequences into char
or non-char key events, including requesting UTF-8 input for
chars:
http://arsdnet.net/dcode/terminal.d
We could just about start writing real apps with this now.
Biggest problem left is it doesn't actually scan the termcap
On Sun, Oct 28, 2012 at 04:49:03AM +0100, Adam D. Ruppe wrote:
It now can translate most PC keyboard input sequences into char or
non-char key events, including requesting UTF-8 input for chars:
http://arsdnet.net/dcode/terminal.d
We could just about start writing real apps with this now.
On Friday, 26 October 2012 at 01:35:43 UTC, Adam D. Ruppe wrote:
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller
wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you do it on xterm:
writefln(\033]0;%s\007, title);
Yeah, the problem is it does
H. S. Teoh wrote:
On Fri, Oct 26, 2012 at 12:27:38AM +0200, Jens Mueller wrote:
Walter Bright wrote:
[...]
A module that only sets the console color is a little too light to
be a phobos entry.
A more comprehensive module that included:
1. getting mouse input
Anybody an
Adam D. Ruppe wrote:
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you do it on xterm:
writefln(\033]0;%s\007, title);
On Windows it is an api function:
On Friday, 26 October 2012 at 03:28:43 UTC, H. S. Teoh wrote:
I don't think you can assume X11 calls will work. You may be
running on GNU screen, or on a remote SSH connection.
Yeah. Vim does it though, if it can connect to a display, it does
and enhances its copy/paste ability. If it can't,
On Tuesday, 23 October 2012 at 22:47:40 UTC, Walter Bright wrote:
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12
9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one
to make a
decision. The core Phobos developers should decide.
Hopefully
On Friday, 26 October 2012 at 06:08:39 UTC, Robik wrote:
Yeah, the problem is it does not work in all terminals.
Yeah, but neither will any other feature. But virtually every one
used in practice nowadays supports it though.
On Fri, Oct 26, 2012 at 08:08:36AM +0200, Robik wrote:
On Friday, 26 October 2012 at 01:35:43 UTC, Adam D. Ruppe wrote:
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you do it on xterm:
H. S. Teoh wrote:
On Fri, Oct 26, 2012 at 08:08:36AM +0200, Robik wrote:
On Friday, 26 October 2012 at 01:35:43 UTC, Adam D. Ruppe wrote:
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you
On Fri, Oct 26, 2012 at 04:46:26PM +0200, Jens Mueller wrote:
H. S. Teoh wrote:
On Fri, Oct 26, 2012 at 08:08:36AM +0200, Robik wrote:
On Friday, 26 October 2012 at 01:35:43 UTC, Adam D. Ruppe wrote:
[...]
writefln(\033]0;%s\007, title);
Yeah, the problem is it does not work in
I'm slapping together a minimal termcap reader for D now.
Here we go, some more basic functions:
http://arsdnet.net/dcode/terminal.d
The unix stuff is more implemented than the windows.
Let's walk through main and I'll discuss why I'm doing things the
way I am. I'm throwing this out just to show one possible way
this can be done and to explain why
On Fri, Oct 26, 2012 at 10:06:38AM +0200, Jens Mueller wrote:
H. S. Teoh wrote:
On Fri, Oct 26, 2012 at 12:27:38AM +0200, Jens Mueller wrote:
Walter Bright wrote:
[...]
[...]
1. getting mouse input
Anybody an idea how to this on Linux?
You can only do this in terminals that
On Fri, Oct 26, 2012 at 01:56:28PM +0200, Tobias Pankrath wrote:
On Tuesday, 23 October 2012 at 22:47:40 UTC, Walter Bright wrote:
[...]
A more comprehensive module that included:
1. getting mouse input
2. getting size of the console
3. moving the cursor around
4. drawing boxes in the
On Friday, 26 October 2012 at 18:05:09 UTC, H. S. Teoh wrote:
If we implement an event loop, I think it should be optional.
I think this is another benefit of capturing the input with a
special type and method.
auto input = terminal.captureInput(ConsoleInputFlags.raw |
Walter Bright wrote:
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12 9:47
AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading this.
Off the top of
On Fri, Oct 26, 2012 at 12:27:38AM +0200, Jens Mueller wrote:
Walter Bright wrote:
[...]
A module that only sets the console color is a little too light to
be a phobos entry.
A more comprehensive module that included:
1. getting mouse input
Anybody an idea how to this on Linux?
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you do it on xterm:
writefln(\033]0;%s\007, title);
On Windows it is an api function:
On Fri, Oct 26, 2012 at 03:35:42AM +0200, Adam D. Ruppe wrote:
On Thursday, 25 October 2012 at 22:27:52 UTC, Jens Mueller wrote:
5. setting the contents of the title bar
The title bar of what?
Here's how you do it on xterm:
writefln(\033]0;%s\007, title);
On Windows it is an api
On Tuesday, 23 October 2012 at 22:47:40 UTC, Walter Bright wrote:
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12
9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one
to make a
decision. The core Phobos developers should decide.
Hopefully
Chad J wrote:
On 10/22/2012 03:47 AM, Jens Mueller wrote:
Chad J wrote:
There is no weakness to this. The only shred of a counterargument I
can think of is that it makes the format strings more difficult to
learn. Other than that, it is possible to detect the destination of
the formatter,
On 10/23/2012 03:51 AM, Jens Mueller wrote:
Chad J wrote:
On 10/22/2012 03:47 AM, Jens Mueller wrote:
Chad J wrote:
There is no weakness to this. The only shred of a counterargument I
can think of is that it makes the format strings more difficult to
learn. Other than that, it is possible to
writefln(The %c(red,white)(widgetometer%) is a device formeasuring); //
for writing red on white
Would something like the following be possible?
// col is a string-accepting function that returns a correctly formatted string
// red and white are from a general Color enum
alias col!(Color.red,
On 10/23/2012 03:56 PM, Philippe Sigaud wrote:
writefln(The %c(red,white)(widgetometer%) is a device formeasuring); //
for writing red on white
Would something like the following be possible?
// col is a string-accepting function that returns a correctly formatted string
// red and white are
Chad J wrote:
On 10/23/2012 03:51 AM, Jens Mueller wrote:
Chad J wrote:
On 10/22/2012 03:47 AM, Jens Mueller wrote:
Chad J wrote:
There is no weakness to this. The only shred of a counterargument I
can think of is that it makes the format strings more difficult to
learn. Other than that,
Jens Mueller wrote:
Chad J wrote:
On 10/23/2012 03:51 AM, Jens Mueller wrote:
Chad J wrote:
On 10/22/2012 03:47 AM, Jens Mueller wrote:
Chad J wrote:
There is no weakness to this. The only shred of a counterargument I
can think of is that it makes the format strings more difficult to
On 10/23/2012 04:42 PM, Jens Mueller wrote:
Jens Mueller wrote:
Chad J wrote:
That's a reasonable suggestion. The only thing that can't be solved
is the trailing ) enclosing the text to be formatted. That needs a
% before it to prevent ambiguity with parentheses in the text
itself. So I
Chad J wrote:
On 10/23/2012 04:42 PM, Jens Mueller wrote:
Jens Mueller wrote:
Chad J wrote:
That's a reasonable suggestion. The only thing that can't be solved
is the trailing ) enclosing the text to be formatted. That needs a
% before it to prevent ambiguity with parentheses in the text
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12 9:47 AM, Jens
Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading this.
Off the top of my head something that is
On Tuesday, 23 October 2012 at 22:47:40 UTC, Walter Bright wrote:
On 10/22/2012 3:55 AM, Andrei Alexandrescu wrote: On 10/22/12
A module that only sets the console color is a little too light
to be a phobos entry.
A more comprehensive module that included:
1. getting mouse input
2. getting
On Tue, Oct 23, 2012 at 03:46:37PM -0700, Walter Bright wrote:
[...]
A module that only sets the console color is a little too light to be
a phobos entry.
A more comprehensive module that included:
1. getting mouse input
2. getting size of the console
3. moving the cursor around
4.
On Tuesday, 23 October 2012 at 23:07:18 UTC, H. S. Teoh wrote:
try, esp. if you're dealing with Unix terminals, which are many
and varied, and have all sorts of idiosyncrasies that make it a
pain to write a generic library that works for everything.
Does anybody really care about everything?
On Wed, Oct 24, 2012 at 01:16:38AM +0200, Adam D. Ruppe wrote:
On Tuesday, 23 October 2012 at 23:07:18 UTC, H. S. Teoh wrote:
try, esp. if you're dealing with Unix terminals, which are many
and varied, and have all sorts of idiosyncrasies that make it a
pain to write a generic library that
Chad J wrote:
On 10/21/2012 06:55 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 06:11 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
It seems to have a hard ncurses/termcap/etc dependency.
Yes. I think you cannot make it portable without. Please
This could be improved, the example you give
writeln(Colors.Red, Foo Bar, Colors.Reset);
imply that if you forget to put Colors.Reset at the end of
writeln then all the following call will be made in Colors.Red
which I don't like, IMHO writeln(Colors.Red, Foo Bar); is
better and at
On Sunday, 21 October 2012 at 22:32:35 UTC, Walter Bright wrote:
On 10/21/2012 12:28 PM, Robik wrote:
Simple example:
import std.stdio, colord;
void main()
{
setConsoleColors(Fg.red, Bg.blue);
writeln(Red text on blue background.);
resetConsoleColors(); // Bring back
On 10/22/12 9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading this.
Off the top of my head something that is specific for only certain
systems (Unixen in this
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font styles such as
underline and strikethrough(Posix feature
Andrei Alexandrescu wrote:
On 10/22/12 9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading this.
Off the top of my head something that is specific for only
Robik wrote:
On Sunday, 21 October 2012 at 22:32:35 UTC, Walter Bright wrote:
On 10/21/2012 12:28 PM, Robik wrote:
Simple example:
import std.stdio, colord;
void main()
{
setConsoleColors(Fg.red, Bg.blue);
writeln(Red text on blue background.);
On Monday, 22 October 2012 at 12:30:38 UTC, Jens Mueller wrote:
But my research concluded that there is no such way on Posix.
Yeah, if there was a way to get current colors, you wouldn't have
to set environment variables for programs like vi to know if the
background is light or dark.
It's
On 10/22/12 8:24 AM, Jens Mueller wrote:
Andrei Alexandrescu wrote:
On 10/22/12 9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading this.
Off the top of my head
Andrei Alexandrescu wrote:
On 10/22/12 8:24 AM, Jens Mueller wrote:
Andrei Alexandrescu wrote:
On 10/22/12 9:47 AM, Jens Mueller wrote:
This is probably interesting for Phobos. But I'm not the one to make a
decision. The core Phobos developers should decide.
Hopefully somebody is reading
On Monday, 22 October 2012 at 12:26:29 UTC, Jens Mueller wrote:
It also works on Windows.
It's still more of a linux tradition. Implementing it as a
separate package will be also a good exercise of writing a layer
over Phobos I/O system.
On Mon, 22 Oct 2012 06:04:51 -0500, Dejan Lekic dejan.le...@gmail.com
wrote:
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to simply
manipulate console output colors, both on Windows and Posix operating
On 10/22/2012 03:47 AM, Jens Mueller wrote:
Chad J wrote:
There is no weakness to this. The only shred of a counterargument I
can think of is that it makes the format strings more difficult to
learn. Other than that, it is possible to detect the destination of
the formatter, so color codes
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font styles such as
underline and strikethrough(Posix feature only).
Simple example:
import std.stdio, colord;
void
Robik wrote:
I would like to introduce ColorD, small library that allows to simply
manipulate console output colors, both on Windows and Posix operating
systems.
GitHub: https://github.com/robik/ColorD
On windows I got an error:
Not a property EnumTypedef!color,fg.opDispatch
Same for
On Sunday, 21 October 2012 at 20:19:54 UTC, Peter Sommerfeld
wrote:
Robik wrote:
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems.
GitHub: https://github.com/robik/ColorD
On windows I got
Robik:
GitHub: https://github.com/robik/ColorD
Maybe it'ìs better to call it ConsoleColorsD, or something.
ColorD seems more fit for a (handy) library about color theory,
color space conversions, etc.
Bye,
bearophile
Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font styles such as
underline and strikethrough(Posix feature only).
It might be nice to have a
On Sunday, 21 October 2012 at 20:39:31 UTC, bearophile wrote:
Robik:
GitHub: https://github.com/robik/ColorD
Maybe it'ìs better to call it ConsoleColorsD, or something.
ColorD seems more fit for a (handy) library about color theory,
color space conversions, etc.
Bye,
bearophile
Moved
Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and Posix
operating systems. It also supports font styles such as underline
and strikethrough(Posix feature only).
Simple example:
import
On Sunday, 21 October 2012 at 21:01:21 UTC, Jens Mueller wrote:
Interesting looks solid to me.
Some nit-picks:
* Coloring on Posix depends a ANSI terminal. Can you check that
a terminal is ANSI compatible?
Sure, why not.
* There are some magic numbers in the code. These may be
difficult to
Robik wrote:
On Sunday, 21 October 2012 at 21:01:21 UTC, Jens Mueller wrote:
Interesting looks solid to me.
Some nit-picks:
* Coloring on Posix depends a ANSI terminal. Can you check that a
terminal is ANSI compatible?
Sure, why not.
Do you know how to do this?
* There are some magic
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font styles such as
underline and strikethrough(Posix feature only).
Era Scarecrow wrote:
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and Posix
operating systems. It also supports font styles such as underline
and
On Sunday, 21 October 2012 at 21:25:14 UTC, Era Scarecrow wrote:
On Sunday, 21 October 2012 at 19:28:21 UTC, Robik wrote:
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and
Posix operating systems. It also supports font
On 10/21/2012 05:01 PM, Jens Mueller wrote:
Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and Posix
operating systems. It also supports font styles such as underline
and strikethrough(Posix feature
Am 21.10.2012, 22:24 Uhr, schrieb Robik szad...@gmail.com:
On Sunday, 21 October 2012 at 20:19:54 UTC, Peter Sommerfeld wrote:
Robik wrote:
I would like to introduce ColorD, small library that allows to simply
manipulate console output colors, both on Windows and Posix operating
systems.
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
Robik wrote:
Hello,
I would like to introduce ColorD, small library that allows to
simply manipulate console output colors, both on Windows and Posix
operating systems. It also supports font styles such as underline
and
On 10/21/2012 12:28 PM, Robik wrote:
Simple example:
import std.stdio, colord;
void main()
{
setConsoleColors(Fg.red, Bg.blue);
writeln(Red text on blue background.);
resetConsoleColors(); // Bring back initial state
}
Need a method to get the current state, and reset the
On 10/21/2012 06:11 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
It seems to have a hard ncurses/termcap/etc dependency.
Yes. I think you cannot make it portable without. Please proof me wrong
and I'll fix this.
Well, traditionally it's done with
Additionally note that the format syntax handles Walter's concerns here:
http://forum.dlang.org/post/k61t63$pi4$1...@digitalmars.com
The color format syntax uses a pair of matched parentheses, and thus
makes it impossible to leave the console in a different state than when
the formatting call
Chad J wrote:
On 10/21/2012 06:11 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
It seems to have a hard ncurses/termcap/etc dependency.
Yes. I think you cannot make it portable without. Please proof me wrong
and I'll fix this.
Well, traditionally
Walter Bright wrote:
On 10/21/2012 12:28 PM, Robik wrote:
Simple example:
import std.stdio, colord;
void main()
{
setConsoleColors(Fg.red, Bg.blue);
writeln(Red text on blue background.);
resetConsoleColors(); // Bring back initial state
}
Need a method to get
On 10/21/2012 06:55 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 06:11 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
It seems to have a hard ncurses/termcap/etc dependency.
Yes. I think you cannot make it portable without. Please proof me wrong
On Sun, 21 Oct 2012 17:32:41 -0500, Chad J
chadjoan@__spam.is.bad__gmail.com.is.bad__gmail.com.com wrote:
On 10/21/2012 06:11 PM, Jens Mueller wrote:
Chad J wrote:
On 10/21/2012 05:01 PM, Jens Mueller wrote:
It seems to have a hard ncurses/termcap/etc dependency.
Yes. I think you cannot
82 matches
Mail list logo