From 6d092cffa5ff6444a3ad3e61a0e4101896d4c244 Mon Sep 17 00:00:00 2001 From: Rui Guo Date: Mon, 22 Jun 2009 16:37:08 +0800 Subject: [PATCH] Add a demo function. Illustrates creating window immediately to the right of the current one. --- src/scripts/movewindow.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/scripts/movewindow.lua b/src/scripts/movewindow.lua index 4ef8083..d084f4f 100644 --- a/src/scripts/movewindow.lua +++ b/src/scripts/movewindow.lua @@ -9,3 +9,24 @@ function toright() local w = screen.display().fore w.number = w.number + 1 end + +function newonright() + local w = screen.display().fore + local wl = screen.windows() + local n = w.number + while true do + local wn = wl[w.number + 1] + if wn == nil then + break + else + w = wn + end + end + while w.number > n do + local wn = wl[w.number - 1] + w.number = w.number + 1 + w = wn + end + + screen.command("screen") +end -- 2.11.4.GIT