commit - 57668c86437fcb90f5f22d11227c117189edb641
commit + b7d58e0bff4eab3865592066a660901f10368f9a
blob - a64352e4f8f4970ab9d19185414dd8e85d6d7194
blob + ca129b383abc105a42724fdc1cfd3cc6950a9a1f
--- Makefile.am
+++ Makefile.am
help.c \
hist.c \
keymap.c \
+ keymap.h \
mime.c \
minibuffer.c \
minibuffer.h \
blob - 3a75c29e16e96a2fa4512edc1d9ca56b500fcd2a
blob + b52162bc2e5a1d8081c9ed272cf33facc11e821f
--- keymap.c
+++ keymap.c
#include <curses.h>
#include <stdlib.h>
+#include "keymap.h"
#include "telescope.h"
#define CTRL(n) ((n)&0x1F)
blob - /dev/null
blob + 3b1ca4e8c8e72b9764f5845bffdefefd794966b8 (mode 644)
--- /dev/null
+++ keymap.h
+/*
+ * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef KEYMAP_H
+#define KEYMAP_H
+
+#include "compat.h"
+
+#include <stdint.h>
+
+struct buffer;
+
+struct kmap {
+ TAILQ_HEAD(map, keymap) m;
+ void (*unhandled_input)(void);
+};
+extern struct kmap global_map, minibuffer_map;
+
+typedef void(interactivefn)(struct buffer *);
+
+struct keymap {
+ int meta;
+ int key;
+ struct kmap map;
+ interactivefn *fn;
+
+ TAILQ_ENTRY(keymap) keymaps;
+};
+
+struct thiskey {
+ short meta;
+ int key;
+ uint32_t cp;
+};
+
+enum {
+ LK_ADVANCED_MAP,
+ LK_MATCHED,
+ LK_UNBOUND,
+};
+
+int kbd(const char *);
+const char *unkbd(int);
+int kmap_define_key(struct kmap *, const char *, interactivefn *);
+int lookup_key(struct kmap **, struct thiskey *, struct buffer *);
+
+#endif
blob - d4a96b003f8eed78fc8f300429f82afc9989d4fa
blob + e1f0b69dcb0b3345983d76a019acb7c99499cf60
--- parse.y
+++ parse.y
%{
+#include "keymap.h"
#include "telescope.h"
#include <phos/phos.h>
blob - 131d2ab70be1e6397c32ef510771d647f2e5176f
blob + aea0e51b91c2807797a0f38b129b5bd226c7a173
--- telescope.h
+++ telescope.h
char host[254];
char port[16];
char req[1027];
-};
-
-struct kmap {
- TAILQ_HEAD(map, keymap) m;
- void (*unhandled_input)(void);
-};
-extern struct kmap global_map, minibuffer_map;
-
-typedef void(interactivefn)(struct buffer *);
-
-struct keymap {
- int meta;
- int key;
- struct kmap map;
- interactivefn *fn;
-
- TAILQ_ENTRY(keymap) keymaps;
-};
-
-struct thiskey {
- short meta;
- int key;
- uint32_t cp;
};
struct cmd {
void hist_push(struct histhead*, struct hist*);
struct hist *hist_pop(struct histhead *);
-/* keymap.c */
-enum {
- LK_ADVANCED_MAP,
- LK_MATCHED,
- LK_UNBOUND,
-};
-
-int kbd(const char*);
-const char *unkbd(int);
-int kmap_define_key(struct kmap*, const char*, void(*)(struct buffer*));
-
/* mime.c */
int setup_parser_for(struct tab*);
blob - 82e8630ac9081bd7ae4242127e007b2b5ba664b5
blob + bdcb4079be72b7857407318281256c69b7c064db
--- ui.h
+++ ui.h
#ifndef UI_H
#define UI_H
+#include "keymap.h"
#include "telescope.h"
extern int body_lines;