hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

Remove error on cygwin emulator #37

Closed thehawk970 closed 9 years ago

thehawk970 commented 9 years ago

Its related to issue #36 and the error

Uncaught exception (Hoa\Console\Exception):
Hoa\Console\Tput::parse(): (0) Terminfo file (null) does not exist.
in C:\www\Console\Tput.php at line 615.

On cygwin emulator, we use default term as "windows-ansi"

Hywan commented 9 years ago

Well, I am not sure to understand. If $TERM is equal to cygwin, we should select the windows-ansi file? Cygwin does not provide any terminfo file?

thehawk970 commented 9 years ago

I dont find it ^^ i search it in the next week

Envoyé de mon iPad

Le 7 févr. 2015 à 14:25, Ivan Enderlin notifications@github.com a écrit :

Well, I am not sure to understand. If $TERM is equal to cygwin, we should select the windows-ansi file? Cygwin does not provide any terminfo file?

— Reply to this email directly or view it on GitHub.

thehawk970 commented 9 years ago

Hi, I found this : http://mirrors.sonic.net/cygwin/x86/release/ncurses/terminfo-extra/terminfo-extra-5.7_20091114-14.tar.bz2, in directory usr\share\terminfo\63

You got cygwin terminfo, but i don't know how to use with Hoa\Console :)

Hywan commented 9 years ago

Place it in your terminfo\63 directory and then see if it used with:

$ hoa console:termcap --file
Hywan commented 9 years ago

Also, what is the result of:

$ hoa console:termcap --terminal

?

thehawk970 commented 9 years ago

I have two terminfo : cygwinB19 and cygwinDBG

I change in Tput.php for use it instead of windows-ansi

cywinB19

λ vendor\bin\hoa console:termcap --file
hoa://Library/Console/Terminfo\63\cygwinB19
λ vendor\bin\hoa console:termcap --terminal
cygwinB19

cygwinDBG

λ vendor\bin\hoa console:termcap --file
hoa://Library/Console/Terminfo\63\cygwinDBG
λ vendor\bin\hoa console:termcap --terminal
cygwinDBG

I test with \Hoa\Console\Cursor::getPosition(), and nothing change xD

thehawk970 commented 9 years ago

Have we got UNICODE char like Carriage Return, but for the other way to go on the right ?

thehawk970 commented 9 years ago
C:\www\launchee-cli (master)
λ vendor\bin\hoa console:termcap -n
columns             : 80
init_tabs           : 8
lines               : 24
lines_of_memory     : -1
magic_cookie_glitch : -1
padding_baud_rate   : -1
virtual_terminal    : -1
width_status_line   : -1
num_labels          : -1
label_height        : -1
label_width         : -1
max_attributes      : -1
maximum_windows     : -1
max_colors          : 8
max_pairs           : 64
no_color_video      : 3

C:\www\launchee-cli (master)
λ vendor\bin\hoa console:termcap -s
back_tab               : \e[Z
bell                   :
carriage_return        : \r
clear_all_tabs         : \e[3g
clear_screen           : \e[H\e[J
clr_eol                : \e[K
clr_eos                : \e[J
column_address         : \e[%i%p1%dG
cursor_address         : \e[%i%p1%d;%p2%dH
cursor_down            : \e[B
cursor_home            : \e[H
cursor_left            : \e[D
cursor_normal          : \e[?25h
cursor_right           : \e[C
cursor_up              : \e[A
delete_character       : \e[P
delete_line            : \e[M
enter_alt_charset_mode : \e(0
enter_blink_mode       : \e[5m
enter_bold_mode        : \e[1m
enter_dim_mode         : \e[2m
enter_insert_mode      : \e[4h
enter_secure_mode      : \e[8m
enter_reverse_mode     : \e[7m
enter_standout_mode    : \e[7m
enter_underline_mode   : \e[4m
exit_alt_charset_mode  : \e(B
exit_attribute_mode    : \e[0;10m
exit_insert_mode       : \e[4l
exit_standout_mode     : \e[m
exit_underline_mode    : \e[m
flash_screen           : \e[?5h\e[?5l$<200/>
insert_character       : \e[@
insert_line            : \e[L
key_backspace          : ⌂
key_dc                 : \e[3~
key_down               : \e[B
key_f1                 : \e[[A
key_f10                : \e[21~
key_f2                 : \e[[B
key_f3                 : \e[[C
key_f4                 : \e[[D
key_f5                 : \e[[E
key_f6                 : \e[17~
key_f7                 : \e[18~
key_f8                 : \e[19~
key_f9                 : \e[20~
key_home               : \e[1~
key_ic                 : \e[2~
key_left               : \e[D
key_npage              : \e[6~
key_ppage              : \e[5~
key_right              : \e[C
key_up                 : \e[A
newline                : \r\n
parm_dch               : \e[%p1%dP
parm_delete_line       : \e[%p1%dM
parm_down_cursor       : \e[%p1%dB
parm_ich               : \e[%p1%d@
parm_insert_line       : \e[%p1%dL
parm_left_cursor       : \e[%p1%dD
parm_right_cursor      : \e[%p1%dC
parm_up_cursor         : \e[%p1%dA
reset_1string          : \ec\e]R
restore_cursor         : \e8
row_address            : \e[%i%p1%dd
save_cursor            : \e7
scroll_forward         : \n
scroll_reverse         : \eM
set_attributes         : \e[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m
set_tab                : \eH
tab                    :
key_b2                 : \e[G
acs_chars              : +►,◄-↑.↓0█`♦a▒f°g±h░j┘k┐l┌m└n┼o~p─q─r─s_t├u┤v┴w┬x│y¾z‗{Ò|Ï}£~■
key_btab               : \e[Z
key_end                : \e[4~
key_suspend            : →
key_snext              : \e[6$
key_sprevious          : \e[5$
key_f11                : \e[23~
key_f12                : \e[24~
key_f13                : \e[25~
key_f14                : \e[26~
key_f15                : \e[28~
key_f16                : \e[29~
key_f17                : \e[31~
key_f18                : \e[32~
key_f19                : \e[33~
key_f20                : \e[34~
clr_bol                : \e[1K
user6                  : \e[%i%d;%dR
user7                  : \e[6n
user8                  : \e[?6c
user9                  : \e[c
orig_pair              : \e[39;\lm
set_a_foreground       : \e[3%p1%dm
set_a_background       : \e[4%p1%dm
enter_pc_charset_mode  : \e[11m
exit_pc_charset_mode   : \e[10m

C:\www\launchee-cli (master)
λ

I don't know if is good or not

Hywan commented 9 years ago

I don't understand your question. What are you trying to achieve?

thehawk970 commented 9 years ago

I want to get all functionnaly of Hoa\Console under windows ^^ and as i understand terminfo is the graal to me, and i don't have unix and windows functionnality in same time ^^

thehawk970 commented 9 years ago

I do some test (I follow exemple on documentation)

This is with terminfo cygwinDBG

Window

Cursor

$rl = new Hoa\Console\Readline\Readline();
do {
    $line = $rl->readLine('> ');            // BUG here Output : [Hello]\n > < Hello
    echo '< ', $line, "\n\n";
} while(false !== $line && 'quit' !== $line);

$rl  = new Hoa\Console\Readline\Password();   // No hide !
$pwd = $rl->readLine('Password: ');

echo 'Your password is: ', $pwd, "\n";*

$rl = new Hoa\Console\Readline\Readline();
$rl->setAutocompleter(new Hoa\Console\Readline\Autocompleter\Word();

I will try to take time to test cygwinB19

Hywan commented 9 years ago

@camael24 I think you should try with cygwinB19 because cygwinDBG seems to be used for debugging only (and not used widely).

thehawk970 commented 9 years ago

I ever found a terminfo cygwin but impossible to retrieve that ^^ its maybe a mirage :-p

Envoyé de mon iPad

Le 10 févr. 2015 à 09:10, Ivan Enderlin notifications@github.com a écrit :

@camael24 I think you should try with cygwinB19 because cygwinDBG seems to be used for debugging only (and not used widely).

— Reply to this email directly or view it on GitHub.

Hywan commented 9 years ago

@camael24 Any news :heart:?

thehawk970 commented 9 years ago

This is with terminfo cygwin

Window

Cursor

Its really long to test that :( i do a pastebin with all the output of each function but my firefox crash and loose all :(

So in my term emylator (cmder) i found a line which configure the "name" of the term, and i delete this line and its works well now (so this PR is useless)

Hywan commented 9 years ago

@camael24 Could you please tell me what this line is? We could provide this information inside the hack book.

thehawk970 commented 9 years ago

Its this line https://github.com/bliker/cmder/blob/master/vendor/init.bat#L28

Hywan commented 9 years ago

Hmm ok. @camael24 Do you think we need to mention it somewhere?

thehawk970 commented 9 years ago

Hummm its will be usefull for windows user (in custom console like cmder)

Hywan commented 9 years ago

So… ? :-)