diff --git a/pcap/loader.go b/pcap/loader.go index 8cb24cc..bfc23fe 100644 --- a/pcap/loader.go +++ b/pcap/loader.go @@ -432,14 +432,6 @@ func (c *PacketLoader) NewFilter(newfilt string, cb interface{}, app gowid.IApp) if c.DisplayFilter() == newfilt { log.Infof("No operation - same filter applied ('%s').", newfilt) - // This is a hack to avoid displaying an error in the following situation. The user loads - // a pcap and applies a filter. Then they hit clear-packets. The filter is still shown. - // Then they run clear-filter. That will attempt to apply a new filter, but the loader's - // record of the filter is cleared, and the new filter to apply is also clear, so they - // are the same, so this error is shown. - if newfilt != "" { - HandleError(NoneCode, app, fmt.Errorf("Same filter - nothing to do."), cb) - } } else { c.stopTail() c.stopLoadPsml() diff --git a/ui/ui.go b/ui/ui.go index ba9deae..8894474 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -2933,7 +2933,11 @@ func Build() (*gowid.App, error) { }) validFilterCb := gowid.MakeWidgetCallback("cb", func(app gowid.IApp, w gowid.IWidget) { - RequestNewFilter(FilterWidget.Value(), app) + if Loader.DisplayFilter() == FilterWidget.Value() { + OpenError("Same filter - nothing to do", app) + } else { + RequestNewFilter(FilterWidget.Value(), app) + } }) // Will only be enabled to click if filter is valid