mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Compare commits
2 Commits
a67c887554
...
e68547a413
Author | SHA1 | Date | |
---|---|---|---|
|
e68547a413 | ||
|
c379459982 |
@ -219,6 +219,24 @@ func TestCodeHighlight_compressed(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for:
|
||||
// https://github.com/walles/moar/issues/236#issuecomment-2282677792
|
||||
//
|
||||
// Sample file sysctl.h from:
|
||||
// https://github.com/fastfetch-cli/fastfetch/blob/f9597eba39d6afd278eeca2f2972f73a7e54f111/src/common/sysctl.h
|
||||
func TestCodeHighlightingIncludes(t *testing.T) {
|
||||
reader, err := NewReaderFromFilename("../sample-files/sysctl.h", *styles.Get("native"), formatters.TTY16m, nil)
|
||||
assert.NilError(t, err)
|
||||
assert.NilError(t, reader._wait())
|
||||
|
||||
screen := startPaging(t, reader)
|
||||
firstIncludeLine := screen.GetRow(2)
|
||||
secondIncludeLine := screen.GetRow(3)
|
||||
|
||||
// Both should start with "#include" colored the same way
|
||||
assertCellsEqual(t, firstIncludeLine[0], secondIncludeLine[0])
|
||||
}
|
||||
|
||||
func TestUnicodePrivateUse(t *testing.T) {
|
||||
// This character lives in a Private Use Area:
|
||||
// https://codepoints.net/U+f244
|
||||
|
@ -119,10 +119,10 @@ func styleUI(chromaStyle *chroma.Style, chromaFormatter *chroma.Formatter, statu
|
||||
|
||||
chromaLineNumbers := twinStyleFromChroma(chromaStyle, chromaFormatter, chroma.LineNumbers, true)
|
||||
if chromaLineNumbers != nil {
|
||||
// If somebody can provide an example where not-dimmed line numbers
|
||||
// looks good I'll change this, but until then they will be dimmed no
|
||||
// matter what the theme authors think.
|
||||
lineNumbersStyle = chromaLineNumbers.WithAttr(twin.AttrDim)
|
||||
// NOTE: We used to dim line numbers here, but Johan found them too hard
|
||||
// to read. If line numbers should look some other way for some Chroma
|
||||
// style, go fix that in Chroma!
|
||||
lineNumbersStyle = *chromaLineNumbers
|
||||
}
|
||||
|
||||
if standoutStyle != nil {
|
||||
|
12
sample-files/sysctl.h
Normal file
12
sample-files/sysctl.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "util/FFcheckmacros.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
const char* ffSysctlGetString(const char* propName, FFstrbuf* result);
|
||||
FF_C_NODISCARD int ffSysctlGetInt(const char* propName, int defaultValue);
|
||||
FF_C_NODISCARD int64_t ffSysctlGetInt64(const char* propName, int64_t defaultValue);
|
||||
FF_C_NODISCARD void* ffSysctlGetData(int* request, u_int requestLength, size_t* resultLength);
|
Loading…
Reference in New Issue
Block a user