nafees10 / qui Goto Github PK
View Code? Open in Web Editor NEWA Text User Interface library for the D Language
License: MIT License
A Text User Interface library for the D Language
License: MIT License
A container that can place widgets freely, and allow manual sizing.
Escape key should only cycle active widgets, however, in the demo build, keeping escape key pressed, a non-visible character is inserted in the memo.
Might take me some time to get to fixing it as I'm busy with QScript.
LogWidget output gets stuck after a number of lines are added. Occurs in the demo program.
Hey. I've been playing a little bit with qui
, and noticed a bug concerning layouts.
When the screen with is 101 pixel, and you have two widgets in a horizontal layout, both widgets get the width 50. Which means there is one pixel spare.
This can have nasty effects. E.g. if you hide one of the widgets, making the other widget taking 100% of the width, and then show the hidden widget again. Characters that were drawn in the 100% mode in column 101 will not be erased.
The problem is in the recalculateWidgetsSize(QLayout.Type T)
method of the QLayout
class and the ratioToRaw
function. It just rounds down the float value (selectedRatio / ratioTotal * total
). A typical solution to this problem is to round some of the values up. Usually the values with the highest remainder. So to round one of the two widgets up to size 51, and the other one down to size 50. E.g. see here: round_preserve_sum.
Only rows that are displaying text are affected.
modifying the content of MemoWidget, i.e MemoWidget.lines
, doesnt always work, for example:
import utils.misc : fileToArray; // from utils packages
MemoWidget memo = new MemoWidget;
...
memo.lines.loadArray(fileToArray("some file with long lines"));
This messes up the horizontal scrolling, and some lines arent even visible, while some are half visible, with some characters not shown. However, if you "manually" type in all that into it, it works.
I'll be working on fixing this issue, so in the meanwhile, try to avoid using this widget.
adding a widget (or more), before calling QTerminal.run
will cause a segmentation fault.
I've figured out that it is caused in the file widgets.d
wherever a line like: following appears
if (&widgetTheme && widgetTheme.hasColors(name,[]))
assuming that the segfault really does occur at that line, the theme-ing is probably also broken
The cursor appears 1 cell right than it should for each of a character like this.
Need to use some function that counts "visible" length of strings rather than the number of characters in them.
Additionally, if this is fixed, maybe tab character will no longer have to be converted to space.
Add support for multiple layers, to create widgets like popups.
sbj
Affects v0.6.2
ScrollContainer will not fill space that is left unoccupied by its child widget. This can cause glitching in that area during resizes.
After the elements in LogWidget's list exceed the max capacity, the display gets "weird". This is probably because of an issue in LogList.
TODO: Instead of using LogList, which wastes memory as well, the LinkedList could be used, and might be a possible fix to this bug.
Resizing in alacritty and kitty can permanently break qui, requiring a restart of the program.
running the same program after setting TERM=xterm
(not TERM=xterm-alacritty
or TERM=xterm-kitty
) fixes this for some reason, even the the terminal is same (alacritty or kitty). So far this has only happened when width is changed, changes in height dont seem to be causing this issue. Demo program to test this bug:
import qui.qui;
import qui.widgets;
import std.conv : to;
void main (){
QTerminal term = new QTerminal(QLayout.Type.Horizontal);
foreach (i; 0 .. 5){
QLayout vl = new QLayout(QLayout.Type.Vertical);
foreach (j; 0 .. 5){
SplitterWidget split = new SplitterWidget();
split.color = (i + j) % 2 ? Color.red : Color.green;
vl.addWidget(split);
}
term.addWidget(vl);
}
term.run();
.destroy(term);
}
Using this code:
module app;
import qui.qui;
import qui.widgets;
void main(){
QTerminal term = new QTerminal("Term");
EditLineWidget input = new EditLineWidget("Input: ");
TextLabelWidget label = new TextLabelWidget("someText");
term.addWidget(label);
term.addWidget(input);
term.run;
}
The display is "bugged" (look into screenshots).
Although the pattern formed is good-looking, it's a bug and needs to go.
I have rewritten EditLineWidget
, but the result is same. This might be an indication that the bug is not in the widgets but probably in Matrix
class.
termbox-d has several bugs that prevent qui from compiling, if it is added as a dependency. Even if not added as dependency, for example, if you run dub build qui
, it will most likely not compile. That can be fixed by:
~/.dub/packages/
~/.dub/packages
termbox.a
file in qui directory to ~/.dub/packages/termbox-VERSION/termbox/
There are several other issues with termbox-d too:
dub build qui --config=demo
will work, but a dependent pacakge will fail to build as termbox.a
fails to link. Not sure if this is caused by termbox-d or qui.build-termbox.sh
is GNU/Linux only? Not sureSo now qui will have to move back to terminal.d
and fix the bug in timedCheckForInput
, or figure out a way to make it work with termbox-d
.
When I type special characters (such as á é ñ) in any input widget, they don't appear with the correct encoding. I am using linux, and utf-8 encoding on my terminals (gnome-terminal, guake).
Add a simple multi line text editor widget.
A terminal has 2 widgets, a MemoWidget, and TextLabelWidget. The max height (or width in case of Horizontal) is above zero.
The expected behavior is:
The MemoWidget should occupy all the space that is made available because of the max-height limit on the TextLabelWidget.
Current behavior:
The space made available by TextLabelWidget is not used, and is left empty at the bottom (or right, in case of Horizontal) of the terminal.
Since it's a TUI, mouse shouldn't be necessary in it, but it is. If there is a memo or any keyboard-input-receiving widget, then it can only receive input after it has been clicked with mouse. A key like Tab should have the functionality to switch between active widgets.
Add a menu bar widget with drop down menus.
Add support for modifier keys in KeyboardEvent
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.