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

hex colors, ANSI on Windows, coloring docs, remove unsafe #786

Merged
merged 6 commits into from
Feb 11, 2018
Merged

Commits on Feb 10, 2018

  1. termcolor: permit hex colors

    This commit adds support for specifying Ansi256 or RGB colors using
    hexadecimal notation.
    BurntSushi committed Feb 10, 2018
    Configuration menu
    Copy the full SHA
    fc4aac8 View commit details
    Browse the repository at this point in the history
  2. wincolor: add support for enabling VT100

    This commit adds a new method to the Console type which permits toggling
    the VIRTUAL_TERMINAL_PROCESSING mode on a console. Specifically, this
    enables the use of ANSI escape sequences for color in Windows terminals.
    BurntSushi committed Feb 10, 2018
    Configuration menu
    Copy the full SHA
    a9086cc View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2018

  1. termcolor: support ANSI in Windows terminals

    This commit uses the new virtual terminal processing feature in Windows 10
    to enable the use of ANSI escape codes to color ripgrep's output. This
    technique is preferred over the console APIs because it seems like where
    the future is heading, but also because it avoids needing to use an
    intermediate buffer to deal with the Windows console in a multithreaded
    environment.
    BurntSushi committed Feb 11, 2018
    Configuration menu
    Copy the full SHA
    aa83831 View commit details
    Browse the repository at this point in the history
  2. doc: add color FAQ entries

    This commit adds FAQ entries about how to configure ripgrep's coloring,
    and how to get true color support in Windows consoles.
    BurntSushi committed Feb 11, 2018
    Configuration menu
    Copy the full SHA
    e9ad0e3 View commit details
    Browse the repository at this point in the history
  3. globset: remove use of unsafe

    This commit removes, in retrospect, a silly use of `unsafe`. In particular,
    to extract a file name extension (distinct from how `std` implements it),
    we were transmuting an OsStr to its underlying WTF-8 byte representation
    and then searching that. This required `unsafe` and relied on an
    undocumented std API, so it was a bad choice to make, but everything gets
    sacrificed at the Alter of Performance.
    
    The thing I didn't seem to realize at the time was that:
    
      1. On Unix, you can already get the raw byte representation in a manner
         that has zero cost.
      2. On Windows, paths are already being encoded and copied every which
         way. So doing a UTF-8 check and, in rare cases (for invalid UTF-8),
         an extra copy, doesn't seem like that much more of an added expense.
    
    Thus, rewrite the extension extraction using safe APIs. On Unix, this
    should have identical performance characteristics as the previous
    implementation. On Windows, we do pay a higher cost in the UTF-8
    check, but Windows is already paying a similar cost a few times over
    anyway.
    BurntSushi committed Feb 11, 2018
    Configuration menu
    Copy the full SHA
    8be6a60 View commit details
    Browse the repository at this point in the history
  4. ci: remove cargo clean

    We aren't using Travis' Cargo cache any more (because it actually seems
    to slow down builds), so there's no reason to clean out old build
    outputs.
    
    Also, even if we were using the Cargo cache, our approach to finding the
    correct Cargo OUT_DIR has become more robust, so we still wouldn't need
    to remove the old build outputs.
    BurntSushi committed Feb 11, 2018
    Configuration menu
    Copy the full SHA
    ad01384 View commit details
    Browse the repository at this point in the history