php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21068 ncurses_getch and ncurses_wgetch diff
Submitted: 2002-12-17 11:33 UTC Modified: 2002-12-18 04:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: maillist at pnpitalia dot it Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.0RC3 OS: SuSE 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: maillist at pnpitalia dot it
New email:
PHP Version: OS:

 

 [2002-12-17 11:33 UTC] maillist at pnpitalia dot it
<?php
// francesco riosa, ncurses test, 20021217
// telnet client = putty
// use "e" = exit ; "w" window
// see the difference of the function keys inside and outside the window

putenv("TERM=linux");
ncurses_init();
$i=0;
ncurses_move($i++, 1);
ncurses_addstr("NCURSES_KEY_F1=" . NCURSES_KEY_F1 );

while ($ch <> ord('e')) {
	$ch = ncurses_getch();
	ncurses_move($i++, 1);
	ncurses_addstr("key --$ch--");
	if ($ch == ord('w')) {
		$winhandle = ncurses_newwin( 20, 40, $i++, 4);
		$j=1;
		ncurses_wborder($winhandle,0,0,0,0,0,0,0,0);
		while ($ch <> ord('e')) {
			$ch = ncurses_wgetch($winhandle);
			ncurses_wmove($winhandle, $j++, 1);
			ncurses_waddstr($winhandle, "key --$ch--");
		}
	}

}
ncurses_end();

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-17 11:40 UTC] maillist at pnpitalia dot it
maybe this is not a bug, maybe if it is it's not related to php but to ncurses 5.3 which I use, in this case anyone know a workaround (not to rewrite a php getch which can handle different key sequences).
Now the result is correct if I don't use window ($ch=265), wgetch return the sequence $ch=(27, 91, 91, 65)
 [2002-12-18 04:54 UTC] georg@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Note that not all function keys are supported on any particular terminal. If you need F-Keys remove your putenv(...)

 [2002-12-18 04:59 UTC] georg@php.net
Forgot to say that you have to enable keypad for wgetch via ncurses_keypad($win, TRUE);

Georg
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 01 19:01:30 2024 UTC