Giter VIP home page Giter VIP logo

terminal.gui's People

Contributors

a-usr avatar aleks-ivanov avatar am11 avatar bdisp avatar bjorkstromm avatar daltskin avatar dependabot[bot] avatar distantcam avatar en3tho avatar fergusonr avatar g-freart avatar giladlevi avatar hermanschoenfeld avatar jmperricone avatar jocelynnatali avatar kderazorback avatar kzu avatar maciekwin3 avatar martin4ndersen avatar mgamerz avatar migueldeicaza avatar mrboring avatar pavkam avatar pmsanford avatar sangkilc avatar tig avatar ttommyth avatar tznind avatar vandycknick avatar worldbeater 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  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

terminal.gui's Issues

Control: ScrollView

Should be similar in spirit to the UIScrollView in that it can move the contents of the subviews

Work in Progress in ScrollView

Make Windows draggable with the mouse.

We are currently reporting the mouse movement events, but it looks like the terminal via curses
is not sending us the events we need when the mouse is clicked and then moved.

Control: Grid

Rows and columns, multi-row/column spanning for specific cells, etc.

Progress control improvements

It should render more detail depending on the height. 1 line, current design; 2 progress plus percentage; 3 framed; 4 frame with progress; 6 frame wothnprogress padded

Chord/Action support

We should have a system to define keyboard chords as well as a Command system, to not rely nor be limieted by the function keys.

This would allow things like "C-x C-s" to be defined easily.

Windows: System.Console driver

Currently the only backend in use for gui.cs is the ncurses backend. There is a partial implementation of a System.Console based driver but it is not complete.

Currently we use mainloop.cs to monitor input on standard input and wake up the mainloop to read the input. We need a variant that works for Windows, likely using Console.ReadKey and using some AutoResetEvent to wake up the thread.

Generally, we can either make mainloop.cs fully cross platform, or we could surface Windows/Unix codepaths, and let the consumer (in this case, gui.cs) deal with it.

In addition to that, the backend itself needs to be completed.

Debug aid

Would be good to have a way of toggling a way to draw a box around boundaries on views.

Redraw problems

  • Control-L does not redraw everything when there are many toplevels running

  • Redraw (Control-L) handler needs to do a painter's paint job, currently
    only Application.Top gets the SetNeedsDisplay(), but this needs to apply
    on Control-L to the entire stack.

    Repro: activate dialog box, press esc, and this clears the dialog contents.

Control: Attributed Label

To make it simpler to add a splash of color to the UI.

Some thoughts:

  • Attributed strings should allow overlapping attributes
  • Attributed strings should have an HTML-like input system for ease of creation.

Tags:

  • <b> - bold
  • <u> - underline
  • <r> - reverse

Colors:

  • <red>, <green>, <yellow> etc

Control: File selector

+-------------------------------------------------------+
| Directory: [/usr/local/bin/       ] [-]               |
|                                                       |
| File:      [_________________________________]        |
|                                                       |
|  +-------------------------------------------------+  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  |                                                 |  |
|  +-------------------------------------------------+  |
|                                                       |
|                                      [Cancel] [Open]  |
|                                                       |
+-------------------------------------------------------+

Not working on Windows?

Trying to compile this on Windows it wants "Unix" something?

Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'Unix' does not exist in the namespace 'Mono' (are you missing an assembly reference?) Terminal.Gui V:\Downloads\gui.cs-master\gui.cs-master\Terminal.Gui\MonoCurses\mainloop.cs 28 Active
Error CS0246 The type or namespace name 'Pollfd' could not be found (are you missing a using directive or an assembly reference?) Terminal.Gui V:\Downloads\gui.cs-master\gui.cs-master\Terminal.Gui\MonoCurses\mainloop.cs 86 Active
Error CS0246 The type or namespace name 'PollEvents' could not be found (are you missing a using directive or an assembly reference?) Terminal.Gui V:\Downloads\gui.cs-master\gui.cs-master\Terminal.Gui\MonoCurses\mainloop.cs 217 Active
Error CS0006 Metadata file 'V:\Downloads\gui.cs-master\gui.cs-master\Terminal.Gui\bin\Debug\Terminal.Gui.dll' could not be found Terminal V:\Downloads\gui.cs-master\gui.cs-master\CSC 1 Active

Control: HotLabel

A hotlabel, is just a label but it has the following properties:

  • It uses hot-strings so that the hot-letter can be used as a hotkey
  • Is linked to another View that can be focused
  • Responds to the hotkey and when pressed, focuses the provided view.

Should this just be folded into the regular Label?

Must measure output size with Rune.ColumnWidth

Many characters that take up two slots are not properly rendered as we render those two, but do not fully fill the requested region. Need to use Rune.ColumnWidth to compute the current position.

Bug in FindDeepestView

The issue is that we are not finding a valid view, due to our offset code.

Repro: run the sample, and try clicking on the radio at the end of the word "Personal", it only works if you click on the first few characters.

.NET Standard 2, NuGet Package

Need to make a .NET Standard 2 library out of a this, and a NuGet package.

Desired:

[x] Link the mono-curses files directly, to reduce dependencies
[x] Link Mainloop directly, same reason

Challenges:

  • Moving to .NET Standard means the main application will end up pulling some 99 assemblies, unless we switch it to .NET Core. Either option is slower.

  • There is a bug in P/Invoke against poll that renders the results of poll unusable.

User configurable Color Themes

Should include other color themes, currently we have the Norton-esque theme, we could include a TurboVision-esque theme. The support is already in place, it is a matter of allocating new colors in each driver.

Ponder: ListView, should it support multiple columns, and if so, what?

We could likely have a simple listview that relies on text being returned, and a more complicated one, that allows users to provide a full view to be rendered in place - to allow colors and other features.

Implemented as ListView, some features missing:

  • Mouse support
  • Ponder: Should it show scrollbars?
  • Should it support multiple-columns?

ScrollViews and focus

Scrollviews should take the focus for any focusable controls and show allow for the key navigation keystrokes to control where the focus goes.

Additionally, we probably should make "PositionCursor" return the Point where the cursor would be in a View, instead of manually positioning it. The caller would place the cursor in the right place.

This would allow us to figure out where the cursor should go in a scrollview and scroll to the right location on those scenarios.

Finish integration of Flex Layout System

Currently at best, we have LayoutSubviews, but there is no support for anchoring, springs or any other layout system.

Should consider what options we have.

Perhaps Views could have a LayoutManager in charge of laying things out. Would be desirable to have a layout manager that can work by default with Add, and the question is whether attributes of how a view should be laid out should live in the view itself, or should be an attached property when they are added to the parent.

It seems that with layout managers, we could have general purpose pones like Grid, or Flex, and convenience View subclasses like HBox/VBox to finetune the layout.

Truecolors (direct RGB colors) support

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
printf "\x1b[${bg};2;${red};${green};${blue}m\n"

The 256-color palette is configured at start and is a 666-cube of colors,
each of them defined as a 24-bit (888 rgb) color.

This means that current support can only display 256 different colors in the
terminal while "true color" means that you can display 16 million different
colors at the same time.

Truecolor escape codes do not use a color palette. They just specify the
color itself.

This is a good test case:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

Keep in mind that it is possible to use both ';' and ':' as Control Sequence
Introducer delimiters.

According to Wikipedia[1], this behavior is only supported by xterm and konsole.

[1] https://en.wikipedia.org/wiki/ANSI_color

Since
ncurses-6.0-20180121,
terminfo began to support the 24-bit True Color capability under the name of
"RGB". You need to use the "setaf" and "setab" commands to set the foreground
and background respectively.

True Color Detection

There will be no reliable way to detect the "RGB" flag until the new release of
terminfo/ncurses. S-Lang author added a check for $COLORTERM containing either
"truecolor" or "24bit" (case sensitive). In addition,
VTE,
Konsole and
iTerm2 set this variable to
"truecolor". It has been in VTE for a while and but is relatively new, being
still git-only in Konsole and iTerm2).

This is obviously not a reliable method, and is not forwarded via sudo, SSH etc.
However, whenever it errs, it errs on the safe side. It does not advertise
support when it is actually unsupported. App developers can freely choose to
check for this same variable, or introduce their own method (e.g. an option in
their config file). They should use whichever method best matches the overall
design of their app. Checking $COLORTERM is recommended though since it will
lead to a more seamless desktop experience where only one variable needs to be
set. This would be system-wide so that the user would not need to set it
separately for each app.

Querying The Terminal

A more reliable method in an interactive program which can read terminal
responses, and one that is transparent to things like sudo, SSH, etc.. is to
simply try setting a truecolor value and then query the terminal to ask what
color it currently has. If the response replies the same color that was set
then it indicates truecolor is supported.

$ (echo -e '\e[48:2:1:2:3m\eP$qm\e\\' ; xxd)

^[P1$r48:2:1:2:3m^[\
00000000: 1b50 3124 7234 383a 323a 313a 323a 336d  .P1$r48:2:1:2:3m

Here we ask to set the background color to RGB(1,2,3) - an unlikely default
choice - and request the value that we just set. The response comes back that
the request was understood (1), and that the color is indeed 48:2:1:2:3.
This tells us also that the terminal supports the colon delimiter. If instead,
the terminal did not support truecolor we might see a response like

^[P1$r40m^[\
00000000: 1b50 3124 7234 306d 1b5c 0a              .P1$r40m.\.

This terminal replied the color is 40 - it has not accepted our request to
set 48:2:1:2:3.

^[P0$r^[\
00000000: 1b50 3024 721b 5c0a                      .P0$r.\.

This terminal did not even understand the DECRQSS request - its response was
0$r. We do not learn if it managed to set the color, but since it doesn't
understand how to reply to our request it is unlikely to support truecolor
either.

Terminals + True Color

Now Supporting True Color

There are a bunch of libvte-based terminals for GTK2, so they are listed in the
another section.

Also, while this one is not a terminal, but a terminal replayer, it is
still worth mentioning:

Improper Support for True Color

Terminals that parse ANSI color sequences, but approximate them to 256 palette

Note about color differences:
a) RGB axes are not orthogonal, so you cannot use
sqrt(R^2+G^2+B^2) formula
b) for color differences there is more correct (but
much more complex)
CIEDE2000 formula
(which may easily blow up performance if used blindly) [2].

[2] neovim/neovim#793 (comment)

Terminal multiplexers

  • tmux - starting from version 2.2 (support since
    427b820...)
  • screen - has support in
    'master' branch, need to be enabled (see 'truecolor' option)
  • pymux - tmux clone in pure Python
    (to enable truecolor run pymux with --truecolor option)
  • dvtm - not yet supporting True Color
    martanne/dvtm#10

NOT Supporting True Color

Console Programs + True Color

Console Programs Supporting True Color

Console Programs Not Supporting True Color

See the repository https://github.com/termstandard/colors

Or the gist and discussion here: https://gist.github.com/XVilka/8346728

Colors management with Dialogs

Perhaps dialog containers need to set a general style for the child widgets,so that when we set a dialog, or error box, all the children added get the right set of default colors.

Widgets should not use Colors.Base or Colors.Dialog, they should likely use the colors defined in the toplevel container, so that the Dialog vs Toplevel colors are set there only.

Add resizing support to the core

Resizing of the toplevel windows, and message boxes should be relatively easy, but there is no support to relayout the views. As we do not currently have a layout system, beyond the absolute positioning system.

Update The https://github.com/migueldeicaza/gui.cs/tree/layout branch now contains a C# port of the Xamarin Flex engine that Stephane Delcroix did, while the port is complete, it is completely untested, that needs to be done.

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.