Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
gh-42: Better, more reliable fix for link hitboxes being misaligned o…
Browse files Browse the repository at this point in the history
…n wide-drawn characters.
  • Loading branch information
twpol authored and FauxFaux committed Mar 19, 2013
1 parent f8cae25 commit 4333fb0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 183 deletions.
3 changes: 2 additions & 1 deletion terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4811,7 +4811,8 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
termline *lp = lineptr(term->disptop + i);

for (j = 0; j < term->cols; j++) {
urlhack_putchar((char)(lp->chars[j].chr & CHAR_MASK), j < term->cols-1 && lp->chars[j+1].chr == UCSWIDE ? 1 : 0);
unsigned long tchar = lp->chars[j].chr;
urlhack_putchar(tchar & CHAR_MASK ? (char)(tchar & CHAR_MASK) : ' ');
}

unlineptr(lp);
Expand Down
4 changes: 1 addition & 3 deletions urlhack.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ void urlhack_cleanup()
sfree(window_text);
}

void urlhack_putchar(char ch, int wide)
void urlhack_putchar(char ch)
{
if (window_text_current_pos >= window_text_len) {
window_text = sresize(window_text, 2 * window_text_len, char);
memset(window_text + window_text_current_pos, '\0', window_text_len - window_text_current_pos);
window_text_len *= 2;
}
window_text[window_text_current_pos++] = ch;
if (wide)
window_text[window_text_current_pos++] = ch;
}

void urlhack_reset()
Expand Down
178 changes: 0 additions & 178 deletions urlhack.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion windows/urlhack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern int urlhack_mouse_old_x, urlhack_mouse_old_y, urlhack_current_region;

void urlhack_reset();
void urlhack_go_find_me_some_hyperlinks(int screen_width);
void urlhack_putchar(char ch, int width);
void urlhack_putchar(char ch);
text_region urlhack_get_link_region(int index);

int urlhack_is_in_link_region(int x, int y);
Expand Down

0 comments on commit 4333fb0

Please sign in to comment.