curses.c (tin-2.6.0.tar.xz) | : | curses.c (tin-2.6.1.tar.xz) | ||
---|---|---|---|---|
/* | /* | |||
* Project : tin - a Usenet reader | * Project : tin - a Usenet reader | |||
* Module : curses.c | * Module : curses.c | |||
* Author : D. Taylor & I. Lea | * Author : D. Taylor & I. Lea | |||
* Created : 1986-01-01 | * Created : 1986-01-01 | |||
* Updated : 2021-02-23 | * Updated : 2021-09-20 | |||
* Notes : This is a screen management library borrowed with permission | * Notes : This is a screen management library borrowed with permission | |||
* from the Elm mail system. This library was hacked to provide | * from the Elm mail system. This library was hacked to provide | |||
* what tin needs. | * what tin needs. | |||
* Copyright : Copyright (c) 1986-99 Dave Taylor & Iain Lea | * Copyright : Copyright (c) 1986-99 Dave Taylor & Iain Lea | |||
* The Elm Mail System - @Revision: 2.1 $ $State: Exp @ | * The Elm Mail System - @Revision: 2.1 $ $State: Exp @ | |||
*/ | */ | |||
#ifndef TIN_H | #ifndef TIN_H | |||
# include "tin.h" | # include "tin.h" | |||
#endif /* !TIN_H */ | #endif /* !TIN_H */ | |||
skipping to change at line 719 | skipping to change at line 719 | |||
{ | { | |||
char output[LEN]; | char output[LEN]; | |||
my_strncpy(output, &(screen[row].col[col]), (size_t) size); | my_strncpy(output, &(screen[row].col[col]), (size_t) size); | |||
# if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE) | # if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE) | |||
/* | /* | |||
* In a multibyte locale we get byte offsets instead of character | * In a multibyte locale we get byte offsets instead of character | |||
* offsets; calculate now the correct starting column | * offsets; calculate now the correct starting column | |||
*/ | */ | |||
if (col > 0) { | if (col > 0 && col < LEN) { | |||
char tmp[LEN]; | char tmp[LEN]; | |||
wchar_t *wtmp; | wchar_t *wtmp; | |||
my_strncpy(tmp, &(screen[row].col[0]), sizeof(tmp) - 1); | my_strncpy(tmp, &(screen[row].col[0]), sizeof(tmp) - 1); | |||
tmp[col] = '\0'; | tmp[col] = '\0'; | |||
if ((wtmp = char2wchar_t(tmp)) != NULL) { | if ((wtmp = char2wchar_t(tmp)) != NULL) { | |||
col = wcswidth(wtmp, wcslen(wtmp) + 1); | col = wcswidth(wtmp, wcslen(wtmp) + 1); | |||
free(wtmp); | free(wtmp); | |||
} | } | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |