From 86496d0ce96f2e57f3f301c08488b6421321b3c9 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 1 May 2025 22:21:48 +0530 Subject: Add PermissionRequested event and accept/reject handling --- lua/null-browser/defaults/vi.lua | 9 ++++----- lua/null-browser/stdlib.lua | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'lua') diff --git a/lua/null-browser/defaults/vi.lua b/lua/null-browser/defaults/vi.lua index 1b72f60..cefbbd2 100644 --- a/lua/null-browser/defaults/vi.lua +++ b/lua/null-browser/defaults/vi.lua @@ -1,11 +1,11 @@ local M = {} + local config = { menu = require 'null-browser.extras.dmenu', history = require 'null-browser.extras.history', - preprocess_url = web.utils.string_trim, + transform_url_input = web.utils.string_trim, } - function M.setup(opts) config = web.utils.table_merge(config, opts) end @@ -26,17 +26,16 @@ function M.initialize() -- Open in new view web.keymap.set('n', 'o', function() - print(web.get('new_view_url'), web.get('user_agent')) config.menu.select(config.history.list(), { prompt = 'Open view:' }, function(err, result) if err or not result then return end - web.view.create(config.preprocess_url(result)) + web.view.create(config.transform_url_input(result)) end) end) -- Open in current view web.keymap.set('n', '', function() config.menu.select(config.history.list(), { prompt = 'Open:' }, function(err, result) if err or not result then return end - web.view.set_url(config.preprocess_url(result)) + web.view.set_url(config.transform_url_input(result)) end) end) -- Delete from history diff --git a/lua/null-browser/stdlib.lua b/lua/null-browser/stdlib.lua index f96dd48..737f747 100644 --- a/lua/null-browser/stdlib.lua +++ b/lua/null-browser/stdlib.lua @@ -7,6 +7,9 @@ local inspector_loaded, inspector = pcall(require, 'inspect') if inspector_loaded then web.inspect = inspector.inspect else + --- Returns human-readable string representation of Lua tables + --- + --- @link https://github.com/kikito/inspect.lua web.inspect = function(val) print('[warn] "inspect" module not loaded'); return val end -- cgit v1.3.1