On Friday, 4 September 2015 at 03:31:40 UTC, Adam D. Ruppe wrote:
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

I get these errors with terminal.d (on OSX):

Joels-MacBook-Pro:small joelcnz$ rdmd term.d
arsd/terminal.d(1268): Error: undefined identifier 'SIGWINCH'
arsd/terminal.d(1381): Error: undefined identifier 'SIGWINCH'
Joels-MacBook-Pro:small joelcnz$

Note: I've got term.d as the main file, I've got terminal.d in arsd folder

I've put up an issue on your github site.

  • OSX prompt limit Joel via Digitalmars-d-learn
    • Re: OSX prompt limit Adam D. Ruppe via Digitalmars-d-learn
      • Re: OSX prompt limit Joel via Digitalmars-d-learn
        • Re: OSX prompt l... Adam D. Ruppe via Digitalmars-d-learn
          • Re: OSX prom... via Digitalmars-d-learn
            • Re: OSX... via Digitalmars-d-learn
              • Re:... Adam D. Ruppe via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... Joel via Digitalmars-d-learn
                • ... via Digitalmars-d-learn
                • ... Joel via Digitalmars-d-learn
                • ... Adam D. Ruppe via Digitalmars-d-learn
                • ... Adam D. Ruppe via Digitalmars-d-learn

Reply via email to