Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/linux_and_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@ jobs:
# would error out saying "ld: unknown option: --as-needed"
if [[ ${{ runner.os }} = macOS ]]; then
as_needed=
# GCC on macOS needs this flag to suppress false positive uninitialized warnings
maybe_uninit_flag='-Wno-error=maybe-uninitialized'
else
as_needed='-Wl,--as-needed'
maybe_uninit_flag=
fi

# musl-gcc and gcc/macOS do not seem to support linking with sanitizers
Expand All @@ -165,7 +162,7 @@ jobs:

${MAKE} --version 2>/dev/null || true

CFLAGS="-std=c99 -pedantic -Werror ${maybe_uninit_flag} ${sanitizer} -O1" LDFLAGS="${as_needed} ${sanitizer}" ${MAKE}
CFLAGS="-std=c99 -pedantic -Werror ${sanitizer} -O1" LDFLAGS="${as_needed} ${sanitizer}" ${MAKE}

- name: 'Install'
env:
Expand Down
20 changes: 11 additions & 9 deletions ttyplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,

// Handle drawing based on whether values are positive or negative
if (zero_pos > 0) { // We have negative values
int y1_start, y1_end, y2_start, y2_end;
int y1_start, y1_end;

// For value 1
if (v1 >= 0) {
Expand All @@ -335,8 +335,17 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,
y1_end = ph + 1 - l1;
}

// Draw the lines
if (y1_start < y1_end) {
mvvline_set(y1_start, x, c1, y1_end - y1_start);
} else if (y1_start > y1_end && l1 > 0) {
mvvline_set(y1_end, x, c1, y1_start - y1_end);
}

// For value 2
if (has_v2) {
int y2_start, y2_end;

if (v2 > 0) {
y2_start = ph + 1 - l2;
y2_end = ph + 1 - zero_pos;
Expand All @@ -347,15 +356,8 @@ static void draw_line(int x, int ph, int l1, int l2, cchar_t *c1, cchar_t *c2,
y2_start = ph + 1 - zero_pos;
y2_end = ph + 1 - zero_pos;
}
}

// Draw the lines
if (y1_start < y1_end) {
mvvline_set(y1_start, x, c1, y1_end - y1_start);
} else if (y1_start > y1_end && l1 > 0) {
mvvline_set(y1_end, x, c1, y1_start - y1_end);
}
if (has_v2) {
// Draw the lines
if (y2_start < y2_end) {
mvvline_set(y2_start, x, &c2r, y2_end - y2_start);
} else if (y2_start > y2_end) {
Expand Down