modes.lua

changeset 1
4d7540af8518
parent 0
98e4b0c9fcac
child 2
1e9553b2f9a2
--- a/modes.lua	Wed Sep 01 03:53:30 2010 +0100
+++ b/modes.lua	Wed Sep 01 03:59:23 2010 +0100
@@ -60,7 +60,7 @@
 }) do window.methods[name] = func end
 
 -- Setup normal mode
-new_mode("normal", {
+new_mode("key", {
     enter = function (w)
         local i, p = w.ibar.input, w.ibar.prompt
         i:hide()
@@ -69,16 +69,48 @@
 })
 
 -- Setup insert mode
-new_mode("insert", {
+new_mode("normal", {
     enter = function (w)
         local i, p = w.ibar.input, w.ibar.prompt
-        i:hide()
+        i:hide();
         i.text = ""
-        p.text = "-- INSERT --"
-        p:show()
+        p:hide();
+        p.text = ""
     end,
 })
 
+new_mode("url-entry", {
+	enter = function (w)
+		local i, p = w.ibar.input, w.ibar.prompt;
+		p.text = "Open:";
+		p:show();
+		i.text = (w:get_current() or {}).uri or "";
+		i:show();
+		i:focus();
+		i:select_region(0);
+	end;
+	activate = function (w, url)
+		w:navigate(url);
+		w:set_mode();
+	end;
+});
+
+new_mode("web-search", {
+	enter = function (w)
+		local i, p = w.ibar.input, w.ibar.prompt;
+		p.text = "Open:";
+		p:show();
+		i.text = (w:get_current() or {}).uri or "";
+		i:show();
+		i:focus();
+		i:set_position(-1);
+	end;
+	activate = function (w, url)
+		w:navigate(url);
+		w:set_mode();
+	end;
+});
+
 -- Setup command mode
 new_mode("command", {
     enter = function (w)

mercurial