GithubHelp home page GithubHelp logo

Comments (9)

o-sdn-o avatar o-sdn-o commented on July 29, 2024

Introduce new concept for terminal text layout

During resize, text lines that have the wrap attribute enabled are wrapped over the underlying ones.

rods

terminal_rods_titan2

It is curious whether this approach is compatible with terminal reality.

from vtm.

Nanoc-ice avatar Nanoc-ice commented on July 29, 2024

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

As you change the size of the screen would vim be the first to wrap, hence leaving nothing to wrap by the terminal?

Almost all full-screen terminal applications do their own wrapping by inserting \n or \e[y;xH at the end. These applications keep track of the terminal size changes and redraw the entire screen when resizing.

For example vim
image

When emitting long lines, terminal applications can rely on the terminal, but there is no single approach to wrap lines in terminals:

  • Terminals can calculate the length of a string in cells using a different algorithm than the application, and as a result, they do wrapping in a different place where the application suggests
  • There is no standard approach to dissecting ligatures and wide characters (Emoji, CJK) at the edge of the screen, although most wraps these characters entirely on a new line, the application cannot know about it in advance

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

For example vim adds > + \e[2;1H if a wide character is encountered at the end

image

image

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

VTM built-in terminal reserves additional screen lines under the long lines when outputting a file with long lines directly

image

ezgif-4-971ac8d88100

lines can overlap on downsize If the screen size was wide when outputting (maybe I need to insert some markers to highlight when it happens, this only happens on downsizing )
rods_overlap

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

The most important advantage of such a text layout in the terminal is the correct support for characters larger than one cell in height

tall_chars_wrapping

Ultimately, this is required to support the following functionality

advanced-terminal-i23

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

It is important to note that the process of overlaying lines is reversible, i.e. when overlaid, the lines themselves are not mangled, they are only drawn overlaid.

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

You can control whether the line is wrapped or not using private VT-commands

  • CSI 12 : 0 p (default) to enable wrapping (\e[12:0p)
  • CSI 12 : 1 p to enable wrapping (\e[12:1p)
  • CSI 12 : 2 p (default) to disable wrapping (\e[12:2p)

wrapping

from vtm.

o-sdn-o avatar o-sdn-o commented on July 29, 2024

Apparently, the rods concept is quite compatible with the terminal reality.
This can be tested with v0.2.9 release.

from vtm.

Related Issues (20)

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.