Skip to content

Wonky text length/glyph width calculation in the statusline #1925

@second2050

Description

@second2050

Contour Terminal version

0.6.3 (git hash: 603c589)

Installer source

Other (please specify below)

Operating System

NixOS 26.05 (nixos-unstable)

Architecture

AArch64 / ARM64

Shell

None

GPU & Renderer

GPU: Apple M2
Driver: Mesa 26.0.3
Renderer: OpenGL

Other Software

No response

Steps to reproduce

  1. config option profile.{$name}.status_line.indicator.right to a string that does not contain a character like (nf-ple-forwardslash_separator).
    example: "{VTType} "
  2. launch contour
  3. observe the spacing between the "VT525" and the window border.
  4. close contour
  5. change said option to something that includes said character
    example: "{Title:Right=  }{HistoryLineCount:Faint,Color=#c0c0c0,Right=  }{VTType} "
  6. launch contour and observe the spacing again

Expected Behavior

the spacing should stay the same.

Actual Behavior

for every instance of the -character (nf-ple-forwardslash_separator) the spacing increases.

Configuration excerpt

profiles:
    shell:
        status_line:
            display: indicator
            position: Bottom
            sync_to_window_title: false
            indicator:
                left: " {InputMode:Bold,Color=#2fd0ef}{Tabs:ActiveColor=#2fd0ef,Left=  }{SearchPrompt:Left=  }{TraceMode:Bold,Color=#2fd0ef,Left=  }{ProtectedMode:Bold,Left=  }"
                middle: ""
                right: "{Title:Right=  }{HistoryLineCount:Faint,Color=#c0c0c0,Right=  }{VTType} "

Additional notes

Screenshots of the issue

  1. "{VTType} "
    Image
  2. "{HistoryLineCount:Faint,Color=#c0c0c0,Right=  }{VTType} "
    Image
  3. "{Title:Right=  }{HistoryLineCount:Faint,Color=#c0c0c0,Right=  }{VTType} "
    Image

Package install

Contour is installed via my NixOS configuration by overriding the package from nixpkgs, and replacing the source of contour and libunicode.

(contour.overrideAttrs (prev: {
  version = "0.6.3-master-603c58";
  src = pkgs.fetchFromGitHub {
    owner = "contour-terminal";
    repo = "contour";
    rev = "603c5892e85ded8b18f554335a25a48bf9642cd7";
    hash = "sha256-xCKtxXGvOVF/8ilcbWeBgwh1rwSLkQWJ1DxTXtCOYg4=";
  };

  cmakeFlags = [ "-DCONTOUR_USE_CPM=OFF" ];

  buildInputs = builtins.filter (pkg: pkg.pname != "libunicode") prev.buildInputs ++ [
    (pkgs.libunicode.overrideAttrs {
      version = "0.8.0";

      src = pkgs.fetchFromGitHub {
        owner = "contour-terminal";
        repo = "libunicode";
        rev = "v0.8.0";
        hash = "sha256-lGq7O35gw4zd/TnMX6s/lmqCCWhe4z9MYMjmANdWSnQ=";
      };

      cmakeFlags = [
        "-DLIBUNICODE_UCD_DIR=${
          pkgs.fetchzip {
            url = "https://www.unicode.org/Public/17.0.0/ucd/UCD.zip";
            hash = "sha256-k2OFy8xPvn+Bboyr1EsmZNeVDOglvk2kSZ+H17YaX60=";
            stripRoot = false;
          }
        }"
      ];
    })
  ];
}))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions