aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c74
1 files changed, 53 insertions, 21 deletions
diff --git a/cmd.c b/cmd.c
index af1433d..1aac903 100644
--- a/cmd.c
+++ b/cmd.c
@@ -22,6 +22,7 @@
#include "compl.h"
#include "defaults.h"
+#include "mcache.h"
#include "minibuffer.h"
#include "session.h"
#include "telescope.h"
@@ -272,11 +273,19 @@ cmd_end_of_buffer(struct buffer *buffer)
cmd_move_end_of_line(buffer);
}
+static void
+kill_telescope_cb(int r, struct tab *tab)
+{
+ if (r) {
+ save_session();
+ event_loopbreak();
+ }
+}
+
void
cmd_kill_telescope(struct buffer *buffer)
{
- save_session();
- event_loopbreak();
+ yornp("really quit?", kill_telescope_cb, NULL);
}
void
@@ -292,7 +301,8 @@ cmd_push_button(struct buffer *buffer)
switch (vl->parent->type) {
case LINE_LINK:
- load_url_in_tab(current_tab, vl->parent->alt, NULL, 0);
+ load_url_in_tab(current_tab, vl->parent->alt, NULL,
+ LU_MODE_NOCACHE);
break;
case LINE_PRE_START:
l = TAILQ_NEXT(vl->parent, lines);
@@ -400,8 +410,6 @@ cmd_previous_page(struct buffer *buffer)
{
if (!load_previous_page(current_tab))
message("No previous page");
- else
- start_loading_anim(current_tab);
}
void
@@ -409,8 +417,6 @@ cmd_next_page(struct buffer *buffer)
{
if (!load_next_page(current_tab))
message("No next page");
- else
- start_loading_anim(current_tab);
}
void
@@ -451,7 +457,7 @@ cmd_tab_close(struct buffer *buffer)
if ((t = TAILQ_NEXT(tab, tabs)) != NULL ||
(t = TAILQ_PREV(tab, tabshead, tabs)) != NULL) {
switch_to_tab(t);
- free_tab(tab);
+ kill_tab(tab, 0);
} else
message("Can't close the only tab.");
@@ -466,11 +472,24 @@ cmd_tab_close_other(struct buffer *buffer)
if (t == current_tab)
continue;
- free_tab(t);
+ kill_tab(t, 0);
}
}
void
+cmd_tab_undo_close(struct buffer *buffer)
+{
+ struct tab *t;
+
+ if ((t = unkill_tab()) == NULL) {
+ message("No recently-closed tabs");
+ return;
+ }
+
+ switch_to_tab(t);
+}
+
+void
cmd_tab_new(struct buffer *buffer)
{
const char *url;
@@ -564,7 +583,8 @@ cmd_load_current_url(struct buffer *buffer)
void
cmd_reload_page(struct buffer *buffer)
{
- load_url_in_tab(current_tab, current_tab->hist_cur->h, NULL, 1);
+ load_url_in_tab(current_tab, current_tab->hist_cur->h, NULL,
+ LU_MODE_NOHIST|LU_MODE_NOCACHE);
}
void
@@ -582,13 +602,13 @@ cmd_bookmark_page(struct buffer *buffer)
void
cmd_list_bookmarks(struct buffer *buffer)
{
- load_url_in_tab(current_tab, "about:bookmarks", NULL, 0);
+ load_url_in_tab(current_tab, "about:bookmarks", NULL, LU_MODE_NONE);
}
void
cmd_toggle_help(struct buffer *buffer)
{
- ui_toggle_side_window();
+ ui_toggle_side_window(SIDE_WINDOW_LEFT);
}
void
@@ -837,18 +857,10 @@ cmd_next_completion(struct buffer *buffer)
void
cmd_insert_current_candidate(struct buffer *buffer)
{
- struct vline *vl;
-
if (in_minibuffer != MB_COMPREAD)
return;
- buffer = &ministate.compl.buffer;
- if ((vl = buffer->current_line) == NULL)
- return;
-
- minibuffer_taint_hist();
- strlcpy(ministate.buf, vl->parent->line, sizeof(ministate.buf));
- ministate.buffer.cpoff = utf8_cplen(ministate.buf);
+ minibuffer_insert_current_candidate();
}
void
@@ -955,3 +967,23 @@ cmd_mini_scroll_down(struct buffer *buffer)
cmd_scroll_down(buffer);
buffer->current_line->parent->type = LINE_COMPL_CURRENT;
}
+
+void
+cmd_toggle_downloads(struct buffer *buffer)
+{
+ ui_toggle_side_window(SIDE_WINDOW_BOTTOM);
+}
+
+void
+cmd_cache_info(struct buffer *buffer)
+{
+ size_t npages, tot;
+ char fmt[FMT_SCALED_STRSIZE];
+
+ mcache_info(&npages, &tot);
+
+ if (fmt_scaled(tot, fmt) == 0)
+ message("pages: %zu, total: %s", npages, fmt);
+ else
+ message("pages: %zu, total: %zu", npages, tot);
+}