Loading ...
Sorry, an error occurred while loading the content.

802Re: clipboard for win9x

Expand Messages
  • Bram Moolenaar
    Mar 6, 2003
    • 0 Attachment
      Glenn Maynard wrote:

      > On Sun, Feb 23, 2003 at 06:23:22PM +0900, MURAOKA Taro wrote:
      > > SetClipboardData(CF_UNICODETEXT, hMemW);
      > > hMemW = 0;
      > > }
      > > - else
      > > # endif
      > > {
      > > SetClipboardData(CF_TEXT, hMem);
      > > hMem = 0;
      > > --- 1231,1238 ----
      > > SetClipboardData(CF_UNICODETEXT, hMemW);
      > > hMemW = 0;
      > > }
      > > # endif
      > > + if (hMem)
      > > {
      > > SetClipboardData(CF_TEXT, hMem);
      > > hMem = 0;
      >
      > This will set *both* Unicode and ANSI text on systems with CF_UNICODETEXT.
      > This is bad, because we often set CF_TEXT incorrectly, by putting data in
      > it that isn't in the ANSI codepage.
      >
      > For example, if encoding=utf-8, and we copy "รบ", UTF-8 will be put
      > in CF_TEXT, and we get garbage when we paste. This problem happens
      > even on Unicode systems, since many apps don't use the Unicode
      > clipboard directly.

      You mean that when CF_TEXT is set it will be used and the text from
      CF_UNICODETEXT will not be used? That is indeed not good at all.

      > The attached patch fixes this. After converting the selection to WCHAR,
      > we then convert it to the ANSI codepage. This has an added bonus: if
      > the conversion was clean, Unicode isn't needed and we can save some
      > memory (a lot of memory in some cases).
      >
      > It also removes the str_len/metadata.txtlen alias (so they don't
      > accidentally get out of sync and cause bugs).

      The idea looks good to me, but this really needs to be tested to make
      sure it works. Especially on Windows 95.

      > One thing I'm concerned about is that I havn't yet reproduced the
      > reported OE problem, and this may obscure it--it might hide it for the
      > person having it, but it probably won't actually fix the problem. I
      > havn't been able to reproduce that report; have you (Bram)?

      OE problem? Wasn't that the problem that was identified as a problem
      with OE itself?

      --
      Hacker: Someone skilled in computer programming (good guy).
      Cracker: A hacker that uses his skills to crack software (bad guy).

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
    • Show all 20 messages in this topic