Compare commits

...

3 Commits

Author SHA1 Message Date
sammyette b70f02e43e
Merge a24bca3258 into 4c61c551aa 2024-05-15 12:00:32 -04:00
sammyette 4c61c551aa
fix: menu refreshes
now there's no flicker *and* its not bugged with
leaving the text on exit
2024-05-13 22:10:28 -04:00
sammyette a24bca3258
fix!: get/set env variables via env table
this removes the old "virtual global table" which allows
getting environment variables via just their names in lua.

this means:
an environment variable (like TERM) would need to be accessed
via the `env` table instead of just using TERM in lua.

`TERM` -> `env.TERM`
they can also be set via `env.VARIABLE = 'value'
2024-05-02 22:09:04 -04:00
4 changed files with 13 additions and 32 deletions

10
nature/env.lua 100644
View File

@ -0,0 +1,10 @@
env = {}
setmetatable(env, {
__index = function(_, k)
return os.getenv(k)
end,
__newindex = function(_, k, v)
os.setenv(k, tostring(v))
end
})

View File

@ -24,6 +24,7 @@ require 'nature.opts'
require 'nature.vim' require 'nature.vim'
require 'nature.runner' require 'nature.runner'
require 'nature.hummingbird' require 'nature.hummingbird'
require 'nature.env'
local shlvl = tonumber(os.getenv 'SHLVL') local shlvl = tonumber(os.getenv 'SHLVL')
if shlvl ~= nil then if shlvl ~= nil then
@ -32,36 +33,6 @@ else
os.setenv('SHLVL', '0') os.setenv('SHLVL', '0')
end end
do
local virt_G = { }
setmetatable(_G, {
__index = function (_, key)
local got_virt = virt_G[key]
if got_virt ~= nil then
return got_virt
end
if type(key) == 'string' then
virt_G[key] = os.getenv(key)
end
return virt_G[key]
end,
__newindex = function (_, key, value)
if type(value) == 'string' then
os.setenv(key, value)
virt_G[key] = value
else
if type(virt_G[key]) == 'string' then
os.setenv(key, '')
end
virt_G[key] = value
end
end,
})
end
do do
local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;' local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;'
.. hilbish.userDir.data .. '/hilbish/start/?.lua' .. hilbish.userDir.data .. '/hilbish/start/?.lua'

View File

@ -29,7 +29,7 @@ func (rl *Instance) updateTabFind(r []rune) {
rl.search = string(rl.tfLine) rl.search = string(rl.tfLine)
// We update and print // We update and print
rl.clearHelpers() //rl.clearHelpers()
rl.getTabCompletion() rl.getTabCompletion()
rl.renderHelpers() rl.renderHelpers()
} }

View File

@ -121,7 +121,7 @@ func (rl *Instance) clearHelpers() {
moveCursorForwards(rl.fullX) moveCursorForwards(rl.fullX)
// Clear everything below // Clear everything below
//print(seqClearScreenBelow) print(seqClearScreenBelow)
// Go back to current cursor position // Go back to current cursor position
moveCursorBackwards(GetTermWidth()) moveCursorBackwards(GetTermWidth())