terminal: update return value load configuration when it changes (#1602)
Fixes #1598
This commit is contained in:
parent
a8b8f30d39
commit
1758823429
14
_fixtures/issue1598.go
Normal file
14
_fixtures/issue1598.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
a := x()
|
||||||
|
println(a) //break here
|
||||||
|
}
|
||||||
|
|
||||||
|
func x() string {
|
||||||
|
return `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
||||||
|
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
||||||
|
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
||||||
|
officia deserunt mollit anim id est laborum.`
|
||||||
|
}
|
@ -913,3 +913,17 @@ func TestIssue1493(t *testing.T) {
|
|||||||
func findStarFile(name string) string {
|
func findStarFile(name string) string {
|
||||||
return filepath.Join(test.FindFixturesDir(), name+".star")
|
return filepath.Join(test.FindFixturesDir(), name+".star")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue1598(t *testing.T) {
|
||||||
|
test.MustSupportFunctionCalls(t, testBackend)
|
||||||
|
withTestTerminal("issue1598", t, func(term *FakeTerminal) {
|
||||||
|
term.MustExec("break issue1598.go:5")
|
||||||
|
term.MustExec("continue")
|
||||||
|
term.MustExec("config max-string-len 500")
|
||||||
|
r := term.MustExec("call x()")
|
||||||
|
t.Logf("result %q", r)
|
||||||
|
if !strings.Contains(r, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut \\nlabore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut") {
|
||||||
|
t.Fatalf("wrong value returned")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -20,7 +20,15 @@ func configureCmd(t *Term, ctx callContext, args string) error {
|
|||||||
case "":
|
case "":
|
||||||
return fmt.Errorf("wrong number of arguments to \"config\"")
|
return fmt.Errorf("wrong number of arguments to \"config\"")
|
||||||
default:
|
default:
|
||||||
return configureSet(t, args)
|
err := configureSet(t, args)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if t.client != nil { // only happens in tests
|
||||||
|
lcfg := t.loadConfig()
|
||||||
|
t.client.SetReturnValuesLoadConfig(&lcfg)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,10 +84,6 @@ func New(client service.Client, conf *config.Config) *Term {
|
|||||||
w = getColorableWriter()
|
w = getColorableWriter()
|
||||||
}
|
}
|
||||||
|
|
||||||
if client != nil {
|
|
||||||
client.SetReturnValuesLoadConfig(&LongLoadConfig)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf.SourceListLineColor > ansiWhite &&
|
if (conf.SourceListLineColor > ansiWhite &&
|
||||||
conf.SourceListLineColor < ansiBrBlack) ||
|
conf.SourceListLineColor < ansiBrBlack) ||
|
||||||
conf.SourceListLineColor < ansiBlack ||
|
conf.SourceListLineColor < ansiBlack ||
|
||||||
@ -105,6 +101,11 @@ func New(client service.Client, conf *config.Config) *Term {
|
|||||||
stdout: w,
|
stdout: w,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if client != nil {
|
||||||
|
lcfg := t.loadConfig()
|
||||||
|
client.SetReturnValuesLoadConfig(&lcfg)
|
||||||
|
}
|
||||||
|
|
||||||
t.starlarkEnv = starbind.New(starlarkContext{t})
|
t.starlarkEnv = starbind.New(starlarkContext{t})
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user