Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text mode UI #5378

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open

Text mode UI #5378

wants to merge 67 commits into from

Conversation

qtxie
Copy link
Contributor

@qtxie qtxie commented Sep 6, 2023

A little text mode UI backend.

Features implemented:

  • Styles: base, panel, button, field, text, progress, rich-text, image and text-list.
  • Draw command: text. Both string! and rich-text! are supported.
  • Keyboard handling. Only key-down and key events. They are the same event as the terminals only send a single key event.
  • Mouse handling. Disable by default. Use system/view/platform/mouse-event?: yes to enable it.
  • Image!
  • Timer. Use /rate facets. The resolution of it is 30 ms.
  • Facets supported: /offset, /size, /text, /image, /color, /data, /enabled?, /visible?, /selected, /flags, /options, /pane, /rate, /para and /draw.
  • Limited ANSI escape codes support in /text facet. Only Colors / Graphics Mode codes.
  • Use 256 colors for text. It should works fine on most of the terminals. Use Truecolor (24-bit RGB) for image rendering if the terminal supports it. Otherwise use 256 colors.
  • Works on the big-3 platforms (Windows, macOS and Linux).

屏幕截图 2023-09-06 152448

Same image shows in TUI and GUI backend respectively.

image

red-tui22.mp4

Copy link
Member

@dockimbel dockimbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in %VID.red are not good, they affect all platforms with any View backend...

@qtxie
Copy link
Contributor Author

qtxie commented Sep 8, 2023

The changes in %VID.red are not good, they affect all platforms with any View backend...

Should the /tight flag be propagated to the child containers?

@dockimbel
Copy link
Member

I'm not sure what the best default would be: to propagate or not to child panels/groups. Though, layout does not pass the /tight flag to fetch-options... /tight is just a shortcut for origin 0x0 space 0x0, so I think it's fine to make it propagate to children by default and let user switch to manually setting origin/space if that behavior is not wanted.

Your change in VID forces the tight mode in all cases (layout/parent/styles/tight), which is a regression. You should be using a dynamic refinement for that (e.g. layout/parent/styles/:tight?) and passing that flag somewhere to fetch-options.

@hiiamboris
Copy link
Collaborator

If it propagates, let user be able to manually override this propagated value with custom origin & space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants