diff --git a/CHANGELOG.md b/CHANGELOG.md index c2aac2be..38771d10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - This removes a lot of duplicate code between `info()` and `prin()`. - Remove `printf` subshells and instead use `printf -v` to declare the variables. - Set fixed `$PATH` in the beginning of the script. +- Fixed artifacts when using line-breaks in TTYs. ## Info @@ -77,14 +78,14 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - Rewrote function from scratch. - The function is `40` lines smaller than before and works on all \[1\] versions of `df` we tested on \[2\]. - We only show the `root (/)` partition now. - - Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systens that used a different `df`. + - Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systems that used a different `df`. - We're using the same `df` flags across all Operating Systems now. - No more ugly case statements or per distro hardcoding of `df` flags. - Removed all percentage calculation since `df` already provides us with the percentage. - Warn the user if `df` isn't installed. - Fixed broken output if `df` wasn't installed but the function was enabled. -\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.) +\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.) \[2\] Tested on `GNU`, `Busybox`, `BSD`, `Solaris` and `macOS` `df` versions. @@ -107,11 +108,14 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques **Color Blocks**
- Use start++ instead of adding it manually after case. **[@konimex](https://github.com/konimex)** +- Fixed bug where color blocks wouldn't respect width in TTYs. +- Cursor positioning now takes `$block_height` into account. ## Images - [iTerm2] Fixed blank images. +- Fixed bug where image mode would attempt to run in a TTY. ## Ascii diff --git a/neofetch b/neofetch index 8e2bed83..2f7f8018 100755 --- a/neofetch +++ b/neofetch @@ -1738,7 +1738,6 @@ get_cols() { if [[ "$color_blocks" == "on" ]]; then # Convert the width to space chars. printf -v block_width "%${block_width}s" - block_width="${block_width// /█}" # Generate the string. for ((start; start<=end; start++)); do @@ -1759,9 +1758,12 @@ get_cols() { # Add newlines to the string. cols="${cols%%'nl'}" cols="${cols//nl/\\n\\033[${text_padding}C${zws}}" + + printf "%b\n" "\033[${text_padding}C${zws}${cols}" + info_height="$((info_height+=block_height+2))" fi - unset blocks blocks2 + unset -v blocks blocks2 cols } # IMAGES @@ -1769,10 +1771,18 @@ get_cols() { get_image_backend() { # This function determines which image backend to use # by checking for programs and etc. - get_image_program - # Fallback to ascii mode if imagemagick isn't installed. - type -p convert >/dev/null 2>&1 || image_backend="ascii" + # If the image source isn't 'ascii' or 'off' + if [[ ! "${image_source}" =~ ^(off|ascii)$ ]]; then + # If X isn't running force ascii mode here. + [[ -z "$DISPLAY" ]] && image_source="ascii" + + # Fallback to ascii mode if imagemagick isn't installed. + type -p convert >/dev/null 2>&1 || image_source="ascii" + fi + + # Get the image program. + get_image_program # If image source is ascii fallback to ascii if [[ "$image_source" == "ascii" ]]; then @@ -2359,7 +2369,8 @@ get_underline() { } get_line_break() { - line_break="​ " + # Print it directly. + printf "%s\n" "${zws} " # Calculate info height info_height="$((info_height+=1))" @@ -3130,8 +3141,8 @@ exit 1 } get_args() { - # Check the command-line flags early for '--config none/off' - [[ "$@" =~ --config\ ?(off|none) ]] || get_user_config 2>/dev/null + # Check the commandline flags early for '--config' + [[ "$@" =~ --config ]] || get_user_config 2>/dev/null while [[ "$1" ]]; do case "$1" in