mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 02:36:18 +08:00 
			
		
		
		
	Sort threads by ID
This commit is contained in:
		| @ -153,6 +153,12 @@ func (c *Commands) help(client service.Client, args ...string) error { | |||||||
| 	return w.Flush() | 	return w.Flush() | ||||||
| } | } | ||||||
|  |  | ||||||
|  | type byID []*api.Thread | ||||||
|  |  | ||||||
|  | func (a byID) Len() int           { return len(a) } | ||||||
|  | func (a byID) Swap(i, j int)      { a[i], a[j] = a[j], a[i] } | ||||||
|  | func (a byID) Less(i, j int) bool { return a[i].ID < a[j].ID } | ||||||
|  |  | ||||||
| func threads(client service.Client, args ...string) error { | func threads(client service.Client, args ...string) error { | ||||||
| 	threads, err := client.ListThreads() | 	threads, err := client.ListThreads() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -162,6 +168,7 @@ func threads(client service.Client, args ...string) error { | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  | 	sort.Sort(byID(threads)) | ||||||
| 	for _, th := range threads { | 	for _, th := range threads { | ||||||
| 		prefix := "  " | 		prefix := "  " | ||||||
| 		if state.CurrentThread != nil && state.CurrentThread.ID == th.ID { | 		if state.CurrentThread != nil && state.CurrentThread.ID == th.ID { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Ilia Choly
					Ilia Choly