From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by sourceware.org (Postfix) with ESMTPS id 2AD603858D20 for ; Fri, 29 Mar 2024 03:48:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AD603858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSW.ab.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=SystematicSW.ab.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2AD603858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=216.40.44.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711684110; cv=none; b=Q+3B2nxRhKpl0J1DgdA5MQEwlxygjPztDDjpI7VRRC6EDhc38jXw/nhhu1qRJuV346SavLQs4XPUl/+QY5Xw0PeSpEJNa7Uf4VstZNzI+Tp2Y6Az+J2sGSGeel7wbyxSCNsGSqW6XIrBVnI2oxNQYoasrzATh0AuWBMJgoqU4vU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711684110; c=relaxed/simple; bh=EVw27myT0YYJ+dU/bdLC+yK8MsvbsxBeNgZnsXYM0Vs=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=fKpgYVzZrkkg9Bx0rhtMcrbEnU5y5F/UGyutmc72UC5CTfsPJ8/DihvBBHxOeC0h7ltTpNEL6nA8ZRe6HVWEw5UdRUiBQ7skfF1AmJ0phbMiYvABR4NgvV8nDWcfTieFO7sFDVpjnny/WN4CjNsdi9v21cM88OxwHGQSta3Bjb4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from omf11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3FD0BC10F5 for ; Fri, 29 Mar 2024 03:48:27 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: Brian.Inglis@SystematicSW.ab.ca) by omf11.hostedemail.com (Postfix) with ESMTPA id BEDBC20029 for ; Fri, 29 Mar 2024 03:48:25 +0000 (UTC) Message-ID: <3486a2c4-ddd0-46f7-aaa5-1fec67e2f76b@SystematicSW.ab.ca> Date: Thu, 28 Mar 2024 21:48:24 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: cygwin-apps@cygwin.com Subject: Re: [PATCH setup] Fix Chinese Help Message fall in dead loop . Content-Language: en-CA To: cygwin-apps@cygwin.com References: From: Brian Inglis Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEDBC20029 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Rspamd-Server: rspamout02 X-Stat-Signature: zoz1j1rpn7qw93dqd1c4ua5se13o6rnu X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX18nqlcTjBx+MRjkAl0ib5EJ+OBVEjrKboA= X-HE-Tag: 1711684105-12831 X-HE-Meta: U2FsdGVkX1/px+m0FKtk8A25E7JHCygZrqBq3xhgHvTIK/lOXxZep+10a0nyYT+dHwEWWoeG2KwakGHMNDA+enG4ew1jLYqYoNwArESDrVpA+/SwPEs3eWFuKH6UL/6xtqPVlPS/4YZcpvrP5NKO1LAXbRBoHGJjCynUCeHwn+GvG4mG+Y6D8rnxAmFQodLJHzLkYw0+6lrTnlgaR514uY4sJRmbwuhYCmRWXnYmH8C3zOpbHMnVrjlwcPDvV6O9fiCIyM0ee9jlfGSlhBW8ZgSGuECyohJ5gziSCJh5MbDLT3fY40W1A8F5fZzszcjrCMeZcbJtNk0eowmXRQ39211Xh4CjU1uu X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-03-28 19:40, 赵伟 via Cygwin-apps wrote: > --- > libgetopt++/include/getopt++/DefaultFormatter.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h > index ee2397f5..43c253a5 100644 > --- a/libgetopt++/include/getopt++/DefaultFormatter.h > +++ b/libgetopt++/include/getopt++/DefaultFormatter.h > @@ -64,6 +64,7 @@ class DefaultFormatter { > { > // TODO: consider using a line breaking strategy here. > int pos = helpmsg.substr(0,h_len).find_last_of(" "); > + if(!pos)break; /*In Chinese Helpmsg,may has no space,so pos ==0,and code will fall in dead loop here*/ > theStream << helpmsg.substr(0,pos) > << std::endl << std::string (o_len, ' '); > helpmsg.erase (0,pos+1); It seems that the best approach for Chinese translations would be to: - add spaces at sentence or word breaks in translations before 35 or 45 bytes, if that is the length unit, worth of characters are output in each column; or - add a language dependent line breaking strategy, to honour characters not to be placed at the beginning or ends of lines or split; or - split between characters, as with long strings in other languages. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry