Commits

Denilson Sá committed d6396eb

prettyping.sh: Use ".oO" as latency indicators for --nounicode mode.

Comments (0)

Files changed (1)

 
 # block_index is just a local variable.
 function print_response_legend(i) {
-	if( '"${USE_UNICODE}"' ) {
+	if( BLOCK_LEN > 1 ) {
 		printf( BLOCK[0] ESC_DEFAULT "%4d ", 0)
 		for( i=1 ; i<BLOCK_LEN ; i++ ) {
 			printf( BLOCK[i] ESC_DEFAULT "%4d ",
 
 # block_index is just a local variable.
 function print_received_response(rtt, block_index) {
-	if( '"${USE_UNICODE}"' ) {
-		if( rtt < BLOCK_RTT_MIN ) {
-			block_index = 0
-		} else if( rtt >= BLOCK_RTT_MAX ) {
-			block_index = BLOCK_LEN - 1
-		} else {
-			block_index = 1 + int((rtt - BLOCK_RTT_MIN) * (BLOCK_LEN - 2) / BLOCK_RTT_RANGE)
-		}
-		printf( BLOCK[block_index] )
+	if( rtt < BLOCK_RTT_MIN ) {
+		block_index = 0
+	} else if( rtt >= BLOCK_RTT_MAX ) {
+		block_index = BLOCK_LEN - 1
 	} else {
-		printf( ESC_GREEN "." )
+		block_index = 1 + int((rtt - BLOCK_RTT_MIN) * (BLOCK_LEN - 2) / BLOCK_RTT_RANGE)
 	}
+	printf( BLOCK[block_index] )
 }
 
 function print_missing_response(rtt) {
 			BLOCK_RTT_MIN = 25
 			BLOCK_RTT_MAX = 175
 		}
+	} else {
+		BLOCK[ 0] = ESC_GREEN "."
+		BLOCK[ 1] = ESC_GREEN "o"
+		BLOCK[ 2] = ESC_GREEN "O"
+		# Simple version:
+		BLOCK_LEN = 3
+		BLOCK_RTT_MIN = 75
+		BLOCK_RTT_MAX = 225
+	}
 
-		if( int('"${RTT_MIN}"') > 0 && int('"${RTT_MAX}"') > 0 ) {
-			BLOCK_RTT_MIN = int('"${RTT_MIN}"')
-			BLOCK_RTT_MAX = int('"${RTT_MAX}"')
-		} else if( int('"${RTT_MIN}"') > 0 ) {
-			BLOCK_RTT_MIN = int('"${RTT_MIN}"')
-			BLOCK_RTT_MAX = BLOCK_RTT_MIN * (BLOCK_LEN - 1)
-		} else if( int('"${RTT_MAX}"') > 0 ) {
-			BLOCK_RTT_MAX = int('"${RTT_MAX}"')
-			BLOCK_RTT_MIN = int(BLOCK_RTT_MAX / (BLOCK_LEN - 1))
-		}
+	if( int('"${RTT_MIN}"') > 0 && int('"${RTT_MAX}"') > 0 ) {
+		BLOCK_RTT_MIN = int('"${RTT_MIN}"')
+		BLOCK_RTT_MAX = int('"${RTT_MAX}"')
+	} else if( int('"${RTT_MIN}"') > 0 ) {
+		BLOCK_RTT_MIN = int('"${RTT_MIN}"')
+		BLOCK_RTT_MAX = BLOCK_RTT_MIN * (BLOCK_LEN - 1)
+	} else if( int('"${RTT_MAX}"') > 0 ) {
+		BLOCK_RTT_MAX = int('"${RTT_MAX}"')
+		BLOCK_RTT_MIN = int(BLOCK_RTT_MAX / (BLOCK_LEN - 1))
+	}
 
-		BLOCK_RTT_RANGE = BLOCK_RTT_MAX - BLOCK_RTT_MIN
-		print_response_legend()
-	}
+	BLOCK_RTT_RANGE = BLOCK_RTT_MAX - BLOCK_RTT_MIN
+	print_response_legend()
 }
 
 ############################################################
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.