ncls: use NCSCALE_HIRES with NCBLIT_PIXEL by default

This commit is contained in:
nick black 2021-06-29 04:47:40 -04:00
parent 89b95c2612
commit a21113a66a
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,7 @@ ncls - List paths with rendering of multimedia
**-a**|**--align** ***type***: Align images on **left**, **center**, or **right**.
**-b**|**--blitter** ***blitter***: Blitter, one of **ascii**, **half**,
**quad**, **sex**, **braille**, or **pixel**. The default is ***pixel***.
**quad**, **sex**, **braille**, or **pixel**. The default is **pixel**.
If the chosen blitter is unavailable, **ncls** will degrade (see
**notcurses_visual(3)**).
@ -42,6 +42,9 @@ If the chosen blitter is unavailable, **ncls** will degrade (see
paths: Run on the specified paths. If none are supplied, run on the current
directory.
If no scaling is specified, **hires** will be used with the **pixel** blitter,
and **scalehi** will be used otherwise.
# NOTES
Optimal display requires a terminal advertising the **rgb** terminfo(5)

View File

@ -185,6 +185,7 @@ int main(int argc, char* const * argv){
bool recursedirs = false;
bool longlisting = false;
bool dereflinks = false;
bool specified_scaling = false;
ncpp::NCAlign alignment = ncpp::NCAlign::Right;
ncblitter_e blitter = NCBLIT_PIXEL;
ncscale_e scale = NCSCALE_SCALE_HIRES;
@ -227,6 +228,7 @@ int main(int argc, char* const * argv){
<< optarg << ")" << std::endl;
usage(std::cerr, argv[0], EXIT_FAILURE);
}
specified_scaling = true;
break;
case 'd':
directories = true;
@ -266,6 +268,11 @@ int main(int argc, char* const * argv){
blitter,
scale,
};
if(blitter == NCBLIT_PIXEL && !specified_scaling){
if(ctx.nc.check_pixel_support() > 0){
ctx.scaling = NCSCALE_NONE_HIRES;
}
}
ctx.nc.cursor_disable();
keep_working = true;
for(auto s = 0u ; s < procs ; ++s){