Resolves: rhbz#915448 UTF-8 handling patch for emacs+ispell-mode
This commit is contained in:
parent
263ec973f1
commit
26dd6f9c3d
55
hunspell.rhbz915448.patch
Normal file
55
hunspell.rhbz915448.patch
Normal file
@ -0,0 +1,55 @@
|
||||
--- src/tools/hunspell.cxx~0 2011-01-21 19:01:29.000000000 +0200
|
||||
+++ src/tools/hunspell.cxx 2013-02-07 10:11:54.443610900 +0200
|
||||
@@ -710,13 +748,22 @@ if (pos >= 0) {
|
||||
fflush(stdout);
|
||||
} else {
|
||||
char ** wlst = NULL;
|
||||
- int ns = pMS[d]->suggest(&wlst, token);
|
||||
+ int byte_offset = parser->get_tokenpos() + pos;
|
||||
+ int char_offset = 0;
|
||||
+ if (strcmp(io_enc, "UTF-8") == 0) {
|
||||
+ for (int i = 0; i < byte_offset; i++) {
|
||||
+ if ((buf[i] & 0xc0) != 0x80)
|
||||
+ char_offset++;
|
||||
+ }
|
||||
+ } else {
|
||||
+ char_offset = byte_offset;
|
||||
+ }
|
||||
+ int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
|
||||
if (ns == 0) {
|
||||
- fprintf(stdout,"# %s %d", token,
|
||||
- parser->get_tokenpos() + pos);
|
||||
+ fprintf(stdout,"# %s %d", token, char_offset);
|
||||
} else {
|
||||
fprintf(stdout,"& %s %d %d: ", token, ns,
|
||||
- parser->get_tokenpos() + pos);
|
||||
+ char_offset);
|
||||
fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], io_enc));
|
||||
}
|
||||
for (int j = 1; j < ns; j++) {
|
||||
@@ -745,13 +792,23 @@ if (pos >= 0) {
|
||||
if (root) free(root);
|
||||
} else {
|
||||
char ** wlst = NULL;
|
||||
+ int byte_offset = parser->get_tokenpos() + pos;
|
||||
+ int char_offset = 0;
|
||||
+ if (strcmp(io_enc, "UTF-8") == 0) {
|
||||
+ for (int i = 0; i < byte_offset; i++) {
|
||||
+ if ((buf[i] & 0xc0) != 0x80)
|
||||
+ char_offset++;
|
||||
+ }
|
||||
+ } else {
|
||||
+ char_offset = byte_offset;
|
||||
+ }
|
||||
int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d]));
|
||||
if (ns == 0) {
|
||||
fprintf(stdout,"# %s %d", chenc(token, io_enc, ui_enc),
|
||||
- parser->get_tokenpos() + pos);
|
||||
+ char_offset);
|
||||
} else {
|
||||
fprintf(stdout,"& %s %d %d: ", chenc(token, io_enc, ui_enc), ns,
|
||||
- parser->get_tokenpos() + pos);
|
||||
+ char_offset);
|
||||
fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], ui_enc));
|
||||
}
|
||||
for (int j = 1; j < ns; j++) {
|
@ -3,7 +3,7 @@
|
||||
Name: hunspell
|
||||
Summary: A spell checker and morphological analyzer library
|
||||
Version: 1.3.3
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Source: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz
|
||||
Group: System Environment/Libraries
|
||||
URL: http://hunspell.sourceforge.net/
|
||||
@ -17,6 +17,7 @@ BuildRequires: valgrind
|
||||
BuildRequires: words
|
||||
%endif
|
||||
Requires: hunspell-en-US
|
||||
Patch1: hunspell.rhbz915448.patch
|
||||
|
||||
%description
|
||||
Hunspell is a spell checker and morphological analyzer library and program
|
||||
@ -34,6 +35,7 @@ Includes and definitions for developing with hunspell
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p0 -b .rhbz915448
|
||||
|
||||
%build
|
||||
configureflags="--disable-rpath --disable-static --with-ui --with-readline"
|
||||
@ -122,6 +124,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man5/hunspell.5.gz
|
||||
|
||||
%changelog
|
||||
* Thu Oct 16 2014 maciek <maciek@corsair.lan> - 1.3.3-4
|
||||
- Resolves: rhbz#915448, UTF-8 handling patch from
|
||||
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7781#31
|
||||
|
||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user