Prevented window write overflow, added Save functionality to the displayed action key list Mantis: 2691

git-svn-id: file:///srv/svn/scanner/trunk@9 a0501263-5b7a-4423-a8ba-1edf086583e7
This commit is contained in:
Correl Roush 2008-02-28 16:57:39 +00:00
parent 570f8aaa65
commit d165b90574
2 changed files with 4 additions and 2 deletions

View file

@ -94,9 +94,10 @@ class NcWindow {
} }
function write( $y, $x, $text, $update = true ) { function write( $y, $x, $text, $update = true ) {
$y = $y < 0 ? $this->height + $y : $y; $y = $y < 0 ? $this->height + $y : $y;
$x = $x < 0 ? $this->width + $x: $x; $x = $x < 0 ? $this->width + $x : $x;
$lines = preg_split( '/\r?(\n|\r)/', $text ); $lines = preg_split( '/\r?(\n|\r)/', $text );
foreach( $lines as $id => $line ) { foreach( $lines as $id => $line ) {
$line = substr( $line, 0, $this->width - $x );
ncurses_mvwaddstr( $this->window, $y + $id, $x, $line ); ncurses_mvwaddstr( $this->window, $y + $id, $x, $line );
} }
if( $update ) { if( $update ) {

View file

@ -294,7 +294,7 @@ if( $curses ) {
); );
$nc_faults = new NcTableView( $nc_main, -5, 0, 4, 0, array( 'columns' => $nc_faults_columns ) ); $nc_faults = new NcTableView( $nc_main, -5, 0, 4, 0, array( 'columns' => $nc_faults_columns ) );
$nc_faults->title( 'Faults' ); $nc_faults->title( 'Faults' );
$nc_main->write( -1, 0, '[Q] Quit | [Return] Fault Info' ); $nc_main->write( -1, 0, '[Q] Quit | [S] Save Output file | [Return] Fault Info' );
} }
// Dig into the modules folder and load up what we find // Dig into the modules folder and load up what we find
@ -365,6 +365,7 @@ if( $curses ) {
$nc_fault_info->write_centered( 0, 'Fault Information' ); $nc_fault_info->write_centered( 0, 'Fault Information' );
$nc_fault_info->write( 3, 0, "Module:\nLevel:\nFilename:\nLine Number:\nAuthor:\nRevision:\nReason:\n\nContext:" ); $nc_fault_info->write( 3, 0, "Module:\nLevel:\nFilename:\nLine Number:\nAuthor:\nRevision:\nReason:\n\nContext:" );
$nc_fault_info->attribute_off( NCURSES_A_BOLD ); $nc_fault_info->attribute_off( NCURSES_A_BOLD );
$fault['object']['context'] = trim( $fault['object']['context'] );
$nc_fault_info->write( 3, 20, "{$fault['module']}\n{$fault['level']}\n{$fault['file']}\n{$fault['line']}\n{$fault['author']}\n{$fault['revision']}\n{$fault['reason']}\n\n{$fault['object']['context']}" ); $nc_fault_info->write( 3, 20, "{$fault['module']}\n{$fault['level']}\n{$fault['file']}\n{$fault['line']}\n{$fault['author']}\n{$fault['revision']}\n{$fault['reason']}\n\n{$fault['object']['context']}" );
$nc_fault_info->get_char(); $nc_fault_info->get_char();
$nc_fault_info->hide(); $nc_fault_info->hide();