Skip to content

Text mode UI - #5378

Merged
dockimbel merged 99 commits into
masterfrom
TUI
Jun 11, 2024
Merged

dockimbel merged 99 commits into
masterfrom
TUI

Conversation

@qtxie

@qtxie qtxie commented Sep 6, 2023 •

Copy link
Copy Markdown
Contributor

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

@dockimbel dockimbel left a comment

Copy link
Copy Markdown
Member

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

qtxie commented Sep 8, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Collaborator

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

qtxie and others added 28 commits May 27, 2024 08:45
view/flags [base return base red] 'fullscreen
border-corners: 'rounded | none
border-color: tuple!

view [group-box font-color green " Folders " 26x20 with [options: [border-corners: round border-color: 255.0.0] ] group-box " Files " 40x20]
To reproduce, TAB on a single base face: `view [base]`.
@dockimbel
dockimbel merged commit 23b49b5 into master Jun 11, 2024
@dockimbel
dockimbel deleted the TUI branch June 11, 2024 14:22
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.

3 participants