1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-24 06:04:04 +03:00
This commit is contained in:
Eugene Pankov 2021-03-15 08:59:22 +01:00
parent e1980a6611
commit 62b1538462
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -329,15 +329,16 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
throw new Error('Frontend not ready')
}
const percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
if (!this.alternateScreenActive && percentageMatch && this.config.store.terminal.detectProgress) {
const percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
if (percentage > 0 && percentage <= 100) {
this.setProgress(percentage)
// this.logger.debug('Detected progress:', percentage)
if (this.config.store.terminal.detectProgress) {
const percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data)
if (!this.alternateScreenActive && percentageMatch) {
const percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2])
if (percentage > 0 && percentage <= 100) {
this.setProgress(percentage)
}
} else {
this.setProgress(null)
}
} else {
this.setProgress(null)
}
this.frontend.write(data)
}