mirror of
https://github.com/NixOS/nix.git
synced 2025-12-07 17:41:00 +01:00
Move /src to /subprojects
This will facilitate breaking up Nix into multiple packages for each component with Meson.
This commit is contained in:
parent
4db9487823
commit
84e2963f8e
737 changed files with 504 additions and 505 deletions
40
subprojects/libutil/terminal.hh
Normal file
40
subprojects/libutil/terminal.hh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
namespace nix {
|
||||
/**
|
||||
* Determine whether ANSI escape sequences are appropriate for the
|
||||
* present output.
|
||||
*/
|
||||
bool isTTY();
|
||||
|
||||
/**
|
||||
* Truncate a string to 'width' printable characters. If 'filterAll'
|
||||
* is true, all ANSI escape sequences are filtered out. Otherwise,
|
||||
* some escape sequences (such as colour setting) are copied but not
|
||||
* included in the character count. Also, tabs are expanded to
|
||||
* spaces.
|
||||
*/
|
||||
std::string filterANSIEscapes(std::string_view s,
|
||||
bool filterAll = false,
|
||||
unsigned int width = std::numeric_limits<unsigned int>::max());
|
||||
|
||||
/**
|
||||
* Recalculate the window size, updating a global variable.
|
||||
*
|
||||
* Used in the `SIGWINCH` signal handler on Unix, for example.
|
||||
*/
|
||||
void updateWindowSize();
|
||||
|
||||
/**
|
||||
* @return the number of rows and columns of the terminal.
|
||||
*
|
||||
* The value is cached so this is quick. The cached result is computed
|
||||
* by `updateWindowSize()`.
|
||||
*/
|
||||
std::pair<unsigned short, unsigned short> getWindowSize();
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue