gparted r895 - in trunk: . include src
- From: gedakc svn gnome org
- To: svn-commits-list gnome org
- Subject: gparted r895 - in trunk: . include src
- Date: Thu, 4 Sep 2008 16:36:14 +0000 (UTC)
Author: gedakc
Date: Thu Sep 4 16:36:14 2008
New Revision: 895
URL: http://svn.gnome.org/viewvc/gparted?rev=895&view=rev
Log:
Fixed display problem with percent complete messages
Modified:
trunk/AUTHORS
trunk/ChangeLog
trunk/include/Utils.h
trunk/src/Utils.cc
Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS (original)
+++ trunk/AUTHORS Thu Sep 4 16:36:14 2008
@@ -12,6 +12,7 @@
We need to keep track of copyright (see the Maintainer HOWTO on www.gnu.org).
Curtis Gedak <gedakc users sourceforge net>
+ * Wrote Utils::cleanup_cursor() function
* Rewrote get_label functionality for hfs
* Wrote create, get_label, and check_repair functionality for hfs+
* Wrote get_label functionality for fat16 and fat32 filesystems
Modified: trunk/include/Utils.h
==============================================================================
--- trunk/include/Utils.h (original)
+++ trunk/include/Utils.h Thu Sep 4 16:36:14 2008
@@ -140,9 +140,10 @@
const char drive_letter, const Glib::ustring & device_path ) ;
static Glib::ustring delete_mtoolsrc_file( const char file_name[] ) ;
static Glib::ustring trim( const Glib::ustring & src, const Glib::ustring & c = " \t\r\n" ) ;
+ static Glib::ustring cleanup_cursor( const Glib::ustring & text ) ;
};
-
+
}//GParted
Modified: trunk/src/Utils.cc
==============================================================================
--- trunk/src/Utils.cc (original)
+++ trunk/src/Utils.cc Thu Sep 4 16:36:14 2008
@@ -254,7 +254,7 @@
return -1 ;
}
- output = std_out ;
+ output = Utils::cleanup_cursor( std_out ) ;
error = std_error ;
return exit_status ;
@@ -331,4 +331,29 @@
return src.substr(p1, (p2-p1)+1);
}
+Glib::ustring Utils::cleanup_cursor( const Glib::ustring & text )
+{
+ //Clean up text for commands that use cursoring to display progress.
+ Glib::ustring str = text;
+ //remove backspace '\b' and delete previous character. Used in mke2fs output.
+ for ( unsigned int index = str .find( "\b" ) ; index < str .length() ; index = str .find( "\b" ) ) {
+ if ( index > 0 )
+ str .erase( index - 1, 2 ) ;
+ else
+ str .erase( index, 1 ) ;
+ }
+
+ //remove carriage return and line up to previous line feed. Used in ntfsclone output.
+ //NOTE: Normal linux line end is line feed. DOS uses CR + LF.
+ for ( unsigned int index1 = str .find( "\r") ; index1 < str .length() ; index1 = str .find( "\r" ) ) {
+ if ( str .at(index1 + 1) != '\n') { //Only process if next character is not a LF
+ unsigned int index2 = str .rfind( "\n", index1 ) ;
+ if ( index2 <= index1 )
+ str .erase( index2 + 1, index1 - index2 ) ;
+ }
+ }
+ return str;
+}
+
+
} //GParted..
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]