Jump to page: 1 2
Thread overview
OSX prompt limit
Sep 04, 2015
Joel
Sep 04, 2015
Adam D. Ruppe
Sep 08, 2015
Joel
Sep 08, 2015
Adam D. Ruppe
Sep 08, 2015
Adam D. Ruppe
Sep 09, 2015
Joel
Sep 09, 2015
Joel
Sep 09, 2015
Adam D. Ruppe
Sep 09, 2015
Adam D. Ruppe
Sep 09, 2015
Joel
Sep 09, 2015
Adam D. Ruppe
September 04, 2015
In Mac OS, when typing with readln etc. I can't use the cursor keys. Works in Windows though.

September 04, 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
September 08, 2015
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.

September 08, 2015
On Tuesday, 8 September 2015 at 06:24:12 UTC, Joel wrote:
> arsd/terminal.d(1268): Error: undefined identifier 'SIGWINCH'


There's a missing value in the signal header for OSX !

Could you run this little C program for me on your Mac and let me know the output?

---
#include<stdio.h>
#include<signal.h>

int main() {
	printf("%d\n", SIGWINCH);
}
---


I can't find the numeric value online either and I don't have a mac myself to check the headers :( ugh.
September 08, 2015
On Tuesday, 8 September 2015 at 13:02:35 UTC, Adam D. Ruppe wrote:
> On Tuesday, 8 September 2015 at 06:24:12 UTC, Joel wrote:
>> arsd/terminal.d(1268): Error: undefined identifier 'SIGWINCH'
>
>
> There's a missing value in the signal header for OSX !
>
> Could you run this little C program for me on your Mac and let me know the output?
>
> ---
> #include<stdio.h>
> #include<signal.h>
>
> int main() {
> 	printf("%d\n", SIGWINCH);
> }
> ---
>
>
> I can't find the numeric value online either and I don't have a mac myself to check the headers :( ugh.

     28    SIGWINCH     discard signal       Window size change

September 08, 2015
Or just take it from the man page:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html
September 08, 2015
On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote:
> Or just take it from the man page:
>
> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html

ah excellent. My web search came up with https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html which didn't give the value!


anyway the git is updated now
September 08, 2015
On 9/8/15 9:20 AM, Adam D. Ruppe wrote:
> On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote:
>> Or just take it from the man page:
>>
>> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html
>>
>
> ah excellent. My web search came up with
> https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html
> which didn't give the value!

That's because it's iOS. You have to be careful with apple documentation, they look the same for both MacOS and ios, but often they are slightly different.

-Steve
September 09, 2015
On Tuesday, 8 September 2015 at 13:20:20 UTC, Adam D. Ruppe wrote:
> On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote:
>> Or just take it from the man page:
>>
>> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html
>
> ah excellent. My web search came up with https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html which didn't give the value!
>
>
> anyway the git is updated now

Now I get the error:
object.Exception@terminal.d(2745): too narrow terminal to draw

It has a negative number in it.

Thanks for working on it.

September 09, 2015
On Wed, Sep 09, 2015 at 12:05:52AM +0000, Joel via Digitalmars-d-learn wrote:
> Now I get the error:

What is your code calling the function? The prompt might just be too long.

« First   ‹ Prev
1 2