Use common v0.8.0 UI, transport, and translation APIs
This commit is contained in:
1 parent
317303adb7
commit
92fd479336
344 files changed
+4102
-4973
No files matched your search
@@ -80,7 +80,7 @@ func (m *Monitor) Update(previous, next screen.Snapshot, editingRow int) {
|
||||
changedCount = len(changedRows)
|
||||
scrollStart, scrollEnd := 0, 0
|
||||
if len(changedRows) > 1 {
|
||||
scrollStart, scrollEnd = screen.Scrolled_overlap(previous, next)
|
||||
scrollStart, scrollEnd = screen.ScrolledOverlap(previous, next)
|
||||
}
|
||||
var lines []string
|
||||
length := 0
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestWholeRowThrottlingAndFinalValue(t *testing.T) {
|
||||
t.Fatal(value, ok)
|
||||
}
|
||||
for percentage := 51; percentage <= 100; percentage++ {
|
||||
next := snapshot("Download "+format_percent(percentage), "")
|
||||
next := snapshot("Download "+formatPercent(percentage), "")
|
||||
m.Update(after, next, -1)
|
||||
after = next
|
||||
}
|
||||
@@ -152,4 +152,4 @@ func TestMultilineLongRowsAndActivity(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func format_percent(value int) string { return fmt.Sprint(value) + "%" }
|
||||
func formatPercent(value int) string { return fmt.Sprint(value) + "%" }
|
||||
@@ -58,7 +58,7 @@ var (
|
||||
const sizeField = `\d+(?:\.\d+)?(?:[kKmMgGtT](?:i?[bB])?)?`
|
||||
const clockField = `(?:(?:\d+:)?\d{2}:\d{2}|--:--:--)`
|
||||
|
||||
func curl_percentage(text string) (float64, bool) {
|
||||
func curlPercentage(text string) (float64, bool) {
|
||||
match := curlPattern.FindStringSubmatch(text)
|
||||
if match == nil {
|
||||
return 0, false
|
||||
@@ -69,7 +69,7 @@ func curl_percentage(text string) (float64, bool) {
|
||||
return total, total <= 100 && total == received && uploaded <= 100
|
||||
}
|
||||
|
||||
func status_fields(text string) bool {
|
||||
func statusFields(text string) bool {
|
||||
names := make(map[string]bool)
|
||||
for _, match := range fieldPattern.FindAllStringSubmatch(text, -1) {
|
||||
switch name := strings.ToLower(match[1]); name {
|
||||
@@ -86,10 +86,10 @@ func explicit(text string) bool {
|
||||
if urlPattern.MatchString(text) {
|
||||
return false
|
||||
}
|
||||
if _, ok := curl_percentage(text); ok {
|
||||
if _, ok := curlPercentage(text); ok {
|
||||
return true
|
||||
}
|
||||
return status_fields(text) || percentPattern.MatchString(text) && (barPattern.MatchString(text) || ratePattern.MatchString(text))
|
||||
return statusFields(text) || percentPattern.MatchString(text) && (barPattern.MatchString(text) || ratePattern.MatchString(text))
|
||||
}
|
||||
|
||||
// Detect ports Python's screen-update detector. Prefer measured progress, then
|
||||
@@ -105,10 +105,10 @@ func Detect(text string) (Indicator, bool) {
|
||||
}
|
||||
return Indicator{}, false
|
||||
}
|
||||
if value, ok := curl_percentage(text); ok {
|
||||
if value, ok := curlPercentage(text); ok {
|
||||
return Indicator{Percentage: value}, true
|
||||
}
|
||||
if transferPattern.MatchString(text) || status_fields(text) {
|
||||
if transferPattern.MatchString(text) || statusFields(text) {
|
||||
return activity(2 * time.Second), true
|
||||
}
|
||||
if match := fractionPattern.FindStringSubmatch(text); match != nil && !fractionNoise.MatchString(text) {
|
||||
|
||||
Reference in new issue
Block a user