[erlang-questions] : Deleting last line in the Erlang Shell

Jordan Wilberding diginux@REDACTED
Thu Apr 26 18:46:48 CEST 2007


That idea does not seem to work either. Once enter has been hit, it
seems like it can't go back to erase that line.

Maybe there is a way to catch the enter key?

Thanks!
Jordan Wilberding

Raimo Niskanen wrote:
> How about:
>
>     io:get_line("\r"++lists:duplicate(80, $ )++"\rinput> ")
>
>
> On Wed, Apr 25, 2007 at 04:19:53PM -0500, Jordan Wilberding wrote:
>   
>> That still doesn't quite do what I want to do, I want to have an input 
>> line, then when you hit
>> enter, get the input, you just clear the prompt and start over.
>>
>> This is kind of what I want, but instead of writing over the previous 
>> line, it writes over prompt.
>>
>> -module(abc).
>> -export([start/0]).
>> start() ->
>>   io:get_line('input> '),
>>   io:format([13|"      "], []),
>>   start().
>>
>> So I want something like this
>>
>> input> test (hit enter)
>>
>> then I just get:
>>
>> input>
>>
>> instead I get:
>>
>> input> test
>> input>
>>
>> Thanks!
>> Jordan Wilberding
>>
>> Torbjorn Tornkvist wrote:
>>     
>>> Jordan Wilberding wrote:
>>>   
>>>       
>>>> The \r doesn't seem to do anything in Erlang. Any other ideas?
>>>>     
>>>>         
>>> Try this program, like this: erl -noshell -s abc
>>> -------------------------------------------
>>> -module(abc).
>>> -export([start/0]).
>>> start() ->
>>>      [print(integer_to_list(I)) || I <- [1,2,3,4,5,6,7,8,9]], erlang:halt().
>>> print(S) -> io:format([13|S], []), timer:sleep(1000).
>>> ---------------------------------------------
>>>
>>> Cheers, Tobbe
>>>
>>>
>>>
>>>   
>>>       
>>>> Thanks!
>>>> Jordan Wilberding
>>>>
>>>> Mazen Harake wrote:
>>>>     
>>>>         
>>>>> This reply is getting ugly... sorry for spaming your inboxes!
>>>>>
>>>>> the correct line should be
>>>>>
>>>>> io:format("\r")
>>>>>
>>>>> Cheers!
>>>>>
>>>>> Mazen wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Maybe an ugly way of doing it but on top of my head you can do
>>>>>>
>>>>>> io:format("r")
>>>>>>
>>>>>> which will bring you back on the same line (which you can then overwrite). Don't know if the there is a special way to do it. I have never actually done an command line interactive program in Erlang myself :)
>>>>>>
>>>>>>
>>>>>> Guest wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I have a simple program that takes input via io:get_line/1 in a loop.
>>>>>>
>>>>>> However, when I hit enter I would like for it to just clear the line
>>>>>> instead of printing a new input line. Is there any way to do this with
>>>>>> in the erlang shell?
>>>>>>
>>>>>> Thanks!
>>>>>> Jordan Wilberding
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> erlang-questions@REDACTED
>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>>>>  Post recived from mailinglist
>>>>>> (end of quote)
>>>>>>
>>>>>> _________________________________________________________
>>>>>> Post sent from http://www.trapexit.org
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> erlang-questions@REDACTED
>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>>>>   
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>> erlang-questions@REDACTED
>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>>>   
>>>>>       
>>>>>           
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>   
>>>       
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>     
>
>   




More information about the erlang-questions mailing list