Enhancements
itskevinsam opened this issue · 20 comments
Hoa\Console\Cursor::move('← ← ← ↑ ↑');
Hoa\Console\Cursor::move('↓'); // move below
Hoa\Console\Cursor::clear('↔'); // clear the line
Can you guys please change (←,↑,↔) to use words than using symbols. There is no way i can find those keys in my keyboard. I dont use a Mac.
Edit: My mistake, didnt check "For example, we can use l, left or ← to move the cursor on the left column. Thus we move the cursor to the left 3 times and then to the top 2 times:"
Hello :-),
Maybe the explanations are not correctly highlighted? What do you think?
↑ ↑ ↓ ↓ ← → ← → B A ?
@CedCannes What?
Nothing, sorry , just all these arrows have reminded me konami code :)
Haha, nice idea for an easter egg !
Hoa\Console\Cursor::move('← ← ← ↑ ↑');
Hoa\Console\Cursor::move('↓'); // move below
Hoa\Console\Cursor::clear('↔'); // clear the line
it would be better if you could change the examples to use [l/left] instead of the symbols (it scared me first)
Its not like i don't like the syntax, but is there any possibility for having a syntax like
Hoa\Console\Cursor::move->left(1)->up(2)->down(1) //This would make more sense (at-least for me:-) )
@itskevinsam What about a mix or two examples (the same one but with litteral symbols instead of unicode ones)?
"(the same one but with litteral symbols instead of unicode ones)?" <-- that would be great..
Let's have some other feedbacks. ping @hoaproject/hoackers
@Hywan 👍 for examples without unicode chars as it will be less scary for newcomers and also avoid such debates ;)
I also like @itskevinsam proposal : Hoa\Console\Cursor::move->left(1)->up(2)->down(1)
👍
from my point of view, unicode is fun, but not easy to use for everybody, so I think we should support these 3 notations:
- [l/left], [r/right], etc. should be the preferred one for small count of move
Hoa\Console\Cursor::move->left(10)->up(5)->down(15)
makes sense when you move far from the start point, and should also be shown in examples, and presented as an alias- ←↑→↓ can be supported for those knowing how to type these chars easily
edit: I know notations 1 and 3 are already supported, my point is 1. should be the preferred one and then we should show it as reference in examples
@itskevinsam
You can already use ASCII/litteral symbols. Take a look at:
https://github.com/hoaproject/Console/blob/master/Cursor.php#L62-79
https://github.com/hoaproject/Console/blob/master/Cursor.php#L266-280
And I'm agree with @CircleCode: Unicode is fun!
We probably not create methods like left
, up
etc., it is too much complicated for nothing :-/ (it needs to create a dumb object just to get the ability to have a fluid interface…).
Strings like left
, right
and shorcuts are already supported. @itskevinsam didn't read the documentation well. My question is the following: is the documentation hard to read, or, whether @itskevinsam has read the documentation too fast? I quote the README:
For example, we can use
l
,left
or←
to move the cursor on the left column. Thus we move the cursor to the left 3 times and then to the top 2 times:Hoa\Console\Cursor::move('← ← ← ↑ ↑');
Thoughts?
"You can already use ASCII/litteral symbols" <-- agree with that. Checked the examples and saw
Hoa\Console\Cursor::move('← ← ← ↑ ↑'); // it would be better to replace that with another example which makes use of literal symbols.
and regarding the syntax "Hoa\Console\Cursor::move('← ← ← ↑ ↑');" <-- i wont say that its bad but "Hoa\Console\Cursor::move->left(10)->up(5)->down(15)" would make things easier to understand.
PS: "Hoa\Console\Cursor::move('l l l l l l l l l l u u u u u d d d d d...')" <-- that might make things complicated. For small use cases the syntax is good.
"documentation hard to read" <-- well no, documentation is not hard to read. But i do believe that people look for examples first (me at-least)
In this case, perhaps moveTo()
is better? getPosition()
should be helpful.
Or keep move( str_repeat('l ', 10) . str_repeat('u ', 5) . str_repeat('d ', 15) )
...
Thoughts?
Cursor::move('left', 10);
works perfectly also.
I will update the README
to add the same example but with literals instead of symbols.
"I will update the README to add the same example but with literals instead of symbols" <-- that would be great
and any alternatives for "clear('↔')"
line
@itskevinsam RTFM :-p. This is a README
, not an exhaustive documentation. At this point, users understand that there is an alternative syntax. Please, see http://hoa-project.net/Literature/Hack/Console.html#Cursor, thanks :-).