Skip to content

Commit

Permalink
Prevent random names from removing range prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
koho authored Feb 17, 2024
1 parent e4822ac commit 5b5939c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/editproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func (pd *EditProxyDialog) View() Dialog {
Children: []Widget{
LineEdit{AssignTo: &pd.nameView, Text: Bind("Name", consts.ValidateNonEmpty)},
PushButton{Text: i18n.SprintfLSpace("Random"), Image: loadResourceIcon(consts.IconRefresh, 16), OnClicked: func() {
pd.nameView.SetText(funk.RandomString(8))
rs := funk.RandomString(8)
if strings.HasPrefix(pd.nameView.Text(), consts.RangePrefix) {
rs = consts.RangePrefix + rs
}
pd.nameView.SetText(rs)
}},
},
},
Expand Down

0 comments on commit 5b5939c

Please sign in to comment.