Skip to content

Commit

Permalink
Up to 1.0.7
Browse files Browse the repository at this point in the history
* Fix csv-parser bug (issue #5)
* New option to control font weight
  • Loading branch information
little-brother committed Jan 26, 2024
1 parent 4ef6f04 commit 739aad2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#define MAX_FILTER_LENGTH 2000
#define DELIMITERS TEXT(",;|\t:")
#define APP_NAME TEXT("csvtab")
#define APP_VERSION TEXT("1.0.6")
#define APP_VERSION TEXT("1.0.7")

#define CP_UTF16LE 1200
#define CP_UTF16BE 1201
Expand Down Expand Up @@ -1001,7 +1001,7 @@ LRESULT CALLBACK cbNewMain(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
vLen -= l + r;
}

TCHAR* value = calloc(vLen + 1, sizeof(TCHAR));
TCHAR* value = calloc((vLen > 0 ? vLen : 0) + 1, sizeof(TCHAR));
if (vLen > 0) {
_tcsncpy(value, data + start + qPos + 1, vLen);

Expand Down Expand Up @@ -1428,7 +1428,8 @@ LRESULT CALLBACK cbNewMain(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
*pFontSize += wParam;
DeleteFont(GetProp(hWnd, TEXT("FONT")));

HFONT hFont = CreateFont (*pFontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, (TCHAR*)GetProp(hWnd, TEXT("FONTFAMILY")));
int weight = getStoredValue(TEXT("font-weight"), 0);
HFONT hFont = CreateFont (*pFontSize, 0, 0, 0, weight < 0 || weight > 9 ? FW_DONTCARE : weight * 100, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, (TCHAR*)GetProp(hWnd, TEXT("FONTFAMILY")));
HWND hGridWnd = GetDlgItem(hWnd, IDC_GRID);
SendMessage(hGridWnd, WM_SETFONT, (LPARAM)hFont, TRUE);

Expand Down

0 comments on commit 739aad2

Please sign in to comment.