Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling echo with zero arguments prints undefined #467

Closed
BenHormann-Intergen opened this issue Feb 15, 2019 · 6 comments
Closed

Calling echo with zero arguments prints undefined #467

BenHormann-Intergen opened this issue Feb 15, 2019 · 6 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@BenHormann-Intergen
Copy link

Expected behavior

term.echo(); should result in output of one blank line.

Actual behavior

term.echo(); outputs a line with 'undefined'.

Steps to reproduce

https://jsfiddle.net/pjn54s6f/1/embedded/js,result

Browser and OS

Any. (Open the jsfiddle result in IE to highlight my issue with using term.echo('');).

@jcubic
Copy link
Owner

jcubic commented Feb 15, 2019

I think that it should just do nothing or just throw exception, you're echo nothing, it's definitely users error that should be ignored or user should be notified. I don't think that echo() and echo('') should act the same.

jcubic added a commit that referenced this issue Feb 16, 2019
@jcubic
Copy link
Owner

jcubic commented Feb 16, 2019

I've decided that this is correct behavior, now if you echo undefined or empty string you will have single blank like. But if empty string left after extended command got removed and executed it will be ignored.

@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Feb 16, 2019
@BenHormann-Intergen
Copy link
Author

I forgot to say echo(undefined) should still print undefined. Probably?
You'd have to check the length of arguments to differentiate the two.

@jcubic
Copy link
Owner

jcubic commented Feb 16, 2019

Updated the code it now prints undefined when using echo(undefined) as suggested I've used arguments.length

@jcubic jcubic added the Bug label Feb 16, 2019
@BenHormann-Intergen
Copy link
Author

Good job (and so quick!), thanks. Cool project, keep it up.

@jcubic jcubic closed this as completed Feb 17, 2019
@jcubic
Copy link
Owner

jcubic commented Feb 17, 2019

In version 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

2 participants