Giter Site home page Giter Site logo

ltui's People

Contributors

erjanmx avatar laelnasan avatar waruqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ltui's Issues

ltui/scrollbar not found

The new feature causes an error when installed with luarocks, ltui/scrollbar cannot be found. Also require("ltui") has no index scrollbar. I will not detail further here, it is really simple actually #25

xmake run test 失败

运行环境ubuntu18.04
系统默认lua是5.1的luarocks install ltui缺少curses.h没有用此方式安装
git clone了本项目而后
xmake q 下载安装了lua5.3.5 ncurses6.1,默认是放在了~/.xmake/下了
(~/.xmake/cache/packages/l/lua/5.3.5/source/lua-5.3.5/src/lua.h
~/.xmake/cache/packages/l/lua/5.3.5/source/lua-5.3.5/src/lua.hpp
~/.xmake/installed/linux/x86_64/release/l/lua/5.3.5/include/lua/lua.h)
而后,
xmake成功生成了./build/libltui.so
此时xmake run test dialog等等操作失败

/usr/bin/lua: error loading module 'ltui.lcurses' from file './build/libltui.so':
./build/libltui.so: undefined symbol: luaL_setfuncs
stack traceback:
[C]: ?
[C]: in function 'require'
./src/ltui/curses.lua:31: in main chunk
[C]: in function 'require'
./src/ltui/application.lua:30: in main chunk
[C]: in function 'require'
./src/ltui.lua:31: in main chunk
[C]: in function 'require'
tests/window.lua:27: in main chunk
[C]: ?
error: execv(/usr/bin/lua tests/window.lua) failed(1)!
这应该是运行的系统lua,和xmake生成使用的库不一致。

请问如何让xmake q安装需求库到全局?或者xmake静态链接?或者xmake run使用内部虚拟的路径?

然后又尝试,安装了libncurses5-dev
可以通过luarocks install ltui,安装ltui到全局,但是版本似乎低了,示例程序test也失败

error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.1/ltui.so'

Describe the bug

Tried you README.md example code:

luajit ./tests/dialog.lua

Error output

luajit: error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.1/ltui.so':
	/usr/local/lib/lua/5.1/ltui.so: undefined symbol: acs_map
stack traceback:
	[C]: at 0x555821e25fe0
	[C]: in function 'require'
	/usr/local/share/lua/5.1/ltui/curses.lua:31: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/ltui/application.lua:30: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.1/ltui.lua:31: in main chunk
	[C]: in function 'require'
	./tests/dialog.lua:27: in main chunk
	[C]: at 0x555821dd01d0

Related Environment

  • ltui installed with luarocks install ltui which yielded:
Installing https://luarocks.org/ltui-1.5-1.src.rock

gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/core/lcurses/lcurses.c -o src/core/lcurses/lcurses.o
gcc -shared -o ltui.so src/core/lcurses/lcurses.o
ltui 1.5-1 is now installed in /usr/local (license: Apache-2.0)

  • Ubuntu 18.04.4 LTS
  • LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/

输入框只能输入一次

描述问题

输入框只能输入一次,再次点击输入框不能修改内容,只能选项yes or no

期待的结果

输入错误后,能再次修改

相关环境

嵌入式linux下,使用ssh登陆启动
ubuntu也有一样的问题

Problems Running frontpage window example

Hello, I installed ltui,
And I run the example from the front page,

I get this message:
/usr/bin/lua: error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.3/ltui.so': /usr/local/lib/lua/5.3/ltui.so: undefined symbol: ESCDELAY stack traceback: [C]: in ? [C]: in function 'require' /usr/local/share/lua/5.3/ltui/curses.lua:31: in main chunk [C]: in function 'require' /usr/local/share/lua/5.3/ltui/application.lua:30: in main chunk [C]: in function 'require' /usr/local/share/lua/5.3/ltui.lua:31: in main chunk [C]: in function 'require' ./curses:5: in main chunk [C]: in ?

ltui version installed:
`# luarocks list ltui

Installed rocks:

ltui
1.2-1 (installed) - /usr/local/lib/luarocks/rocks`

Can you help me?
Thanks in Advance
Regards

Error in Windows 10

I try to install in Windows using luarocks and I recieve the following error:

C:\Windows\system32>luarocks install ltui
Installing https://luarocks.org/ltui-1.5-1.src.rock

mingw32-gcc -O2 -c -o src/core/lcurses/lcurses.o -IC:/tools/lua/include src/core/lcurses/lcurses.c
src/core/lcurses/lcurses.c:86:10: fatal error: curses.h: No such file or directory
 #include <curses.h>
          ^~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/core/lcurses/lcurses.o

I built lua in Windows with the following steps

Error building with xmake: undeclared function

Describe the bug

While building with xmake, there's an error in curses.c . error: implicit declaration of function ‘luaL_setfuncs’. This might be because the function luaL_setfuncs is not properly declared

Expected behavior

No errors while builing

Error output

error: src/core/curses/curses.c:838:5: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘lua_setfenv’? [-Werror=implicit-function-declaration]

Related Environment

Please provide the compilation or runtime environment information.

Additional context

Add any other context about the problem here.

Mouse support

Hi, I've been looking for a good framework for working with ncurses in lua and by far this one is what works best for me.
It would be nice, though if it would support the ncurses and pdcurses ability to use mouse events. Reading the lua code I
noticed that it might be in the plans since there is a event related to it.

I've been working the last few days in the support for mouse events in ltui, and must say it was really easy to get it working
compared to other solutions. If you would be so kind of reviewing my work, I would love to contribute to this great project.

Describe the solution you'd like

Mouse support for ltui

Describe alternatives you've considered

I've forked the code and made some small changes to it, and now it works! (at least with ncurses. couldn't get to run a
windows machine, yet)

PS: I tried to stick to the coding style as much as possible.

#15

Unexpected label behaviour

I added some labels into the window, but text is hidden or something.

local ltui        = require("ltui")
local application = ltui.application
local event       = ltui.event
local rect        = ltui.rect
local window      = ltui.window
local conf        = ltui.menuconf
local view        = ltui.view
local label       = ltui.label

local app         = application()

function app:init()
    application.init(self, "demo")
    local containers = { "container1", "container2", "container3", "container4" }
    local container_window = window:new("window.container", rect { 1, 1, 50, 10 }, "containers", false)
    for i = 1, 4, 1 do
        container_window:insert(label:new(containers[i], rect { 2, 1 + i, 15, 2 + i }, containers[i]):textattr_set("red"))
    end

    self:insert(container_window)
end

app:run()

Here's what it looks like:
image
What i'm doing wrong?

运行测试程序报错

描述问题

$ xmake run test dialog
/home/ubuntu/.xmake/packages/l/lua/5.4.1/531f88cff3a64da0aa3fb05ee281ab7d/bin/lua: error loading module 'ltui.lcurses' from file './build/libltui.so':
./build/libltui.so: undefined symbol: lua_checkstack
stack traceback:
[C]: in ?
[C]: in function 'require'
./src/ltui/curses.lua:27: in main chunk
[C]: in function 'require'
./src/ltui/application.lua:26: in main chunk
[C]: in function 'require'
./src/ltui.lua:26: in main chunk
[C]: in function 'require'
tests/dialog.lua:27: in main chunk
[C]: in ?
error: execv(/home/ubuntu/.xmake/packages/l/lua/5.4.1/531f88cff3a64da0aa3fb05ee281ab7d/bin/lua tests/dialog.lua) failed(1)

相关环境

Ubuntu 18.04.4 LTS x86_64

其他信息

ltui和lcurses之前未安装, xmake运行自动安装的

Add Doc Comments to Allow Docs Generation

Is your feature request related to a problem? Please describe.

Project could benefit from more thorough documentation. Demo examples are nice, but I think it could be better to show exactly what classes/API functions are available and how they are to be called, what the expected parameters are.

Describe the solution you'd like

Add LDoc or similar doc comments to generate docs.

Describe alternatives you've considered

Other alternative would be LuaDoc. These two are the most popular on LuaRocks.

Additional context

Generated docs would be comparable to Penlight's, T-Engine or similar.

circular behaviour of views in a panel

Hi, it is me again
I don't know if this feature is intended or not (that is why I couldn't decide between feature or bug) but whenever a selected view in a panel is removed, the next view is selected, in a circular list fashion. Imho a stack behavior would be more useful here, maintaining the order of, for example, multiple layers of dialogs.

My suggestion would be to add an optional flag in the panel:remove() function so that one willing to apply this behavior to a dialog (like in my case) would be able to do it by simply overwriting the dialog:quit() function as such:

-- remove view
function panel:remove(v, stackish)

(...)

    -- select next view
    if self:current() == v then
        if stackish then self:select_prev() else self:select_next(nil, true) end
    end

(...)

end

then one would be able to write its own dialog:quit() function like so

dialog.quit = function (self)
    local parent = self:parent()
    if parent then
        self:action_on(action.ac_on_exit)
        parent:remove(self, true)
    end
end

If you dont think it is worth the trouble, though, I am happy to continue hacking my way through this beautiful code

Error - unable to load ltui.lcurses - undefined symbol COLORS

I'm having trouble testing and using ltui. I hope the information below is enough to be helpful.

System:
Chromebook with Linux - Acer 514

uname -a output:
Linux local.______ 4.19.16-02893-g2cf2c17c8a43 #1 SMP PREEMPT Sat Jan 19 09:52:07 PST 2019 x86_64 GNU/Linux

I have compiled and installed:
lua 5.3.5
luarocks 3.0.4

Rocks installed:
lcurses
9.0.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.3
ltui
1.3-1 (installed) - /usr/local/lib/luarocks/rocks-5.3

Error output:
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio

local foo = require("ltui")
error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.3/ltui.so':
/usr/local/lib/lua/5.3/ltui.so: undefined symbol: COLORS
stack traceback:
[C]: in ?
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui/curses.lua:31: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui/application.lua:30: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui.lua:31: in main chunk
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?

ncurses version:
$ dpkg -l | grep curses

libncurses5:amd64 6.0+20161126-1+deb9u2 amd64 shared libraries for terminal handling
libncurses5-dev:amd64 6.0+20161126-1+deb9u2 amd64 developer's libraries for ncurses
libncursesw5:amd64 6.0+20161126-1+deb9u2 amd64 shared libraries for terminal handling (wide character support)
ncurses-base 6.0+20161126-1+deb9u2 all basic terminal type definitions
ncurses-bin 6.0+20161126-1+deb9u2 amd64 terminal-related programs and man pages
ncurses-term 6.0+20161126-1+deb9u2 all additional terminal type definitions

making TUI with C

I would like to develop ltui with C
instead of lua is it possible ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.