-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrections to the rename dialog #9278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instat/dlgName.vb
Outdated
If rdoRenameWith.Checked Then | ||
If rdoReplace.Checked Then | ||
clsDefaultRFunction.AddParameter("type", Chr(34) & "rename_with" & Chr(34), iPosition:=1) | ||
clsDefaultRFunction.AddParameter(".fn", "stringr::str_replace", iPosition:=2) | ||
clsDefaultRFunction.AddParameter("pattern", Chr(34) & ucrInputReplace.GetText() & Chr(34), iPosition:=4) | ||
clsDefaultRFunction.RemoveParameterByName("label") | ||
clsDefaultRFunction.AddParameter("replacement", Chr(34) & ucrInputBy.GetText() & Chr(34), iPosition:=5) | ||
If ucrInputEdit.GetText = "Starts With" Then | ||
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsStartwithFunction, iPosition:=3) | ||
ElseIf ucrInputEdit.GetText = "Ends With" Then | ||
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsEndswithFunction, iPosition:=3) | ||
ElseIf ucrInputEdit.GetText = "Matches" Then | ||
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsMatchesFunction, iPosition:=3) | ||
ElseIf ucrInputEdit.GetText = "Contains" Then | ||
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsContainsFunction, iPosition:=3) | ||
End If | ||
Else | ||
clsDefaultRFunction.RemoveParameterByName("pattern") | ||
clsDefaultRFunction.RemoveParameterByName("replacement") | ||
clsDefaultRFunction.RemoveParameterByName(".cols") | ||
End If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we improve this as follow?
If rdoRenameWith.Checked AndAlso rdoReplace.Checked Then
clsDefaultRFunction.AddParameter("type", Chr(34) & "rename_with" & Chr(34), iPosition:=1)
clsDefaultRFunction.AddParameter(".fn", "stringr::str_replace", iPosition:=2)
clsDefaultRFunction.AddParameter("pattern", Chr(34) & ucrInputReplace.GetText() & Chr(34), iPosition:=4)
clsDefaultRFunction.RemoveParameterByName("label")
clsDefaultRFunction.AddParameter("replacement", Chr(34) & ucrInputBy.GetText() & Chr(34), iPosition:=5)
Select Case ucrInputEdit.GetText
Case "Starts With"
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsStartwithFunction, iPosition:=3)
Case "Ends With"
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsEndswithFunction, iPosition:=3)
Case "Matches"
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsMatchesFunction, iPosition:=3)
Case "Contains"
clsDefaultRFunction.AddParameter(".cols", clsRFunctionParameter:=clsContainsFunction, iPosition:=3)
End Select
Else
' Remove all related parameters if conditions are not met
clsDefaultRFunction.RemoveParameterByName("pattern")
clsDefaultRFunction.RemoveParameterByName("replacement")
clsDefaultRFunction.RemoveParameterByName(".cols")
End If
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rdstern over to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. We are having ambitious ideas about extensions, so I'm happy with the partially. But let's get this merged!
@N-thony you have approved, so just the merge to do.
Fixes issue #9265 partially,
@rdstern , @N-thony , @lilyclements and @rachelkg this is ready for review