OSX prompt limit
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 3 20:31:38 PDT 2015
On Friday, 4 September 2015 at 02:17:57 UTC, Joel wrote:
> In Mac OS, when typing with readln etc. I can't use the cursor
> keys. Works in Windows though.
That's normal, line editing on Unix terminals is a kinda advanced
library feature. The most common lib to do it, GNU readline, is
actually a big thing that pushed the GPL because of how useful it
was and it happened to use that license.
I wrote one too though it is a bit bulky.
https://github.com/adamdruppe/arsd/blob/master/terminal.d
import terminal;
void main() {
auto terminal = Terminal(ConsoleOutputMode.linear);
auto line = terminal.getline("your prompt: ");
terminal.writeln("You wrote: ", line);
}
compile:
dmd yourapp.d terminal.d
More information about the Digitalmars-d-learn
mailing list