You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Indentation is messed up when using --pager flag
Setup
OS: WSL2 Ubuntu 24.04 - Windows 11
Shell: fish
Terminal Emulator: Windows Terminal
Terminal Multiplexer: tmux
Locale: UTF-8
To Reproduce
Steps to reproduce the behavior:
create a file that has lines that contain varying levels of indentation, e.g. a file that contains golang code. running glow ./filename.go --pager produces different indentation levels for lines that are supposed to be at the same indentation level.
Source Code
below is the content of the file I used:
package main
import (
"fmt""strconv"
)
funcmain() {
// Example with an integernum:=42str:=strconv.Itoa(num) // Convert integer to stringfmt.Println("The number as a string is: \n"+str+"\n")
// Example with a floatfloatNum:=3.14strFloat:=strconv.FormatFloat(floatNum, 'f', -1, 64) // Convert float to stringfmt.Println("The float as a string is: \n"+strFloat+"\n")
}
Expected behavior
Using the --pager flag should not produced inconsistent indentations, and it should just add a pager to the same content that one would have got if they didn't use the -pager flag.
Screenshots
Without --pager flag:
With --pager flag:
The text was updated successfully, but these errors were encountered:
So when I copied over your codeblock, noticed that it would shift the indentation, when there is a comment, and then a code line right underneath it,
Example: Assuming this file lol.go and running go run . --pager lol.go
package main
import (
"fmt"
"strconv"
)
func main2() {
// Example with an integer
num := 42
str := strconv.Itoa(num) // Convert integer to string
fmt.Println("The number as a string is: \n" + str + "\n")
// Example with a float
floatNum := 3.14
strFloat := strconv.FormatFloat(floatNum, 'f', -1, 64) // Convert float to strin
fmt.Println("The float as a string is: \n" + strFloat + "\n")
}
func main3() {
num := 42
str := strconv.Itoa(num)
fmt.Println("The number as a string is: \n" + str + "\n")
// comments
floatNum := 3.14
strFloat := strconv.FormatFloat(floatNum, 'f', -1, 64)
fmt.Println("The float as a string is: \n" + strFloat + "\n")
}
But then after making a small change to the pager itself being used, i.e. change from less -r to less -R, the formatting is fixed,
Describe the bug
Indentation is messed up when using
--pager
flagSetup
To Reproduce
Steps to reproduce the behavior:
create a file that has lines that contain varying levels of indentation, e.g. a file that contains golang code. running
glow ./filename.go --pager
produces different indentation levels for lines that are supposed to be at the same indentation level.Source Code
below is the content of the file I used:
Expected behavior
Using the
--pager
flag should not produced inconsistent indentations, and it should just add a pager to the same content that one would have got if they didn't use the-pager
flag.Screenshots
Without
--pager
flag:With
--pager
flag:The text was updated successfully, but these errors were encountered: