From d165b90574c63bbc035ecf8c0a0eff78afd29d7c Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 28 Feb 2008 16:57:39 +0000 Subject: [PATCH] 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 --- ncurses/ncurses.php | 3 ++- scanner.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ncurses/ncurses.php b/ncurses/ncurses.php index 19aa919..2cc6e27 100644 --- a/ncurses/ncurses.php +++ b/ncurses/ncurses.php @@ -94,9 +94,10 @@ class NcWindow { } function write( $y, $x, $text, $update = true ) { $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 ); foreach( $lines as $id => $line ) { + $line = substr( $line, 0, $this->width - $x ); ncurses_mvwaddstr( $this->window, $y + $id, $x, $line ); } if( $update ) { diff --git a/scanner.php b/scanner.php index ff9133c..66be9bb 100644 --- a/scanner.php +++ b/scanner.php @@ -294,7 +294,7 @@ if( $curses ) { ); $nc_faults = new NcTableView( $nc_main, -5, 0, 4, 0, array( 'columns' => $nc_faults_columns ) ); $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 @@ -365,6 +365,7 @@ if( $curses ) { $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->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->get_char(); $nc_fault_info->hide();