perf map browser: Exit just on well known key presses
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 Mar 2013 14:47:17 +0000 (11:47 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 1 Apr 2013 15:23:55 +0000 (12:23 -0300)
Initial motivation was to avoid the confusing exit when when '/' is
pressed in non verbose mode, as specified in the help line searches
are only available in verbose mode.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-20xezxim2y4agmkx7f3sucll@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/browsers/map.c

index 10b549c0eefb5f9f503c6357bdaaf5335195345f..95c7cfb8f2c60577d75df489ea2ef1382375720d 100644 (file)
@@ -80,12 +80,20 @@ static int map_browser__run(struct map_browser *self)
        while (1) {
                key = ui_browser__run(&self->b, 0);
 
-               if (verbose && key == '/')
-                       map_browser__search(self);
-               else
+               switch (key) {
+               case '/':
+                       if (verbose)
+                               map_browser__search(self);
+               default:
                        break;
+                case K_LEFT:
+                case K_ESC:
+                case 'q':
+                case CTRL('c'):
+                        goto out;
+               }
        }
-
+out:
        ui_browser__hide(&self->b);
        return key;
 }