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

Re: [PATCH] make adding new letters to arabic.c easier

Expand Messages
  • Bram Moolenaar
    ... The arabic shaping also works when displaying a message on the command ... I haven t tried it! -- Bad fashion can discourage normal people from interacting
    Message 1 of 46 , Jun 3, 2009
    • 0 Attachment
      Ali Gholami Rudi wrote:

      > Bram Moolenaar <Bram@...> wrote:
      > > Ali Gholami Rudi wrote:
      > > > It is probably possible to access the characters Vim prints on the
      > > > screen; I mean just after shaping (I have to look it up but of course
      > > > you know better). If so, it might be a good idea to use a sample
      > > > Arabic/Farsi text file. The output after shaping the letters can be
      > > > written to another file (as expected this file will contain Unicode
      > > > presentation forms of letters among other chars). It can be kept as
      > > > a reference to indicate the change in behaviour after changing
      > > > arabic.c. Does that look sane?
      > >
      > > Have a look at the files src/testdir/*.in. These are "what you type"
      > > scripts and the verified output can be the text after shaping. The
      > > trick will be to make some kind of table to avoid having to use all
      > > kinds of special characters that make the script unreadable (there are
      > > plenty of bad examples :-). Perhaps feedkeys() can be used.
      >
      > But I couldn't find a way to fetch what is actually printed on the
      > screen (like using mouse to copy what is shown on an x-terminal running
      > vim). The goal is to test the output of arabic_shape function and
      > AFAICT it is used when printing chars to the screen (both in screen.c
      > and ex_getln.c).
      >
      > I tried using ScreenLines and ScreenLinesUC in a C file but I couldn't
      > do it cleanly (I changed main.c to record these arrays) and the output
      > was not what I expected. So I think it is a better idea to call
      > arabic_shape() directly from a C program:
      >
      > 1. write a normal file containing some Arabic/Farsi text
      > 2. obtain the expected output by reading the file and calling
      > arabic_shape() on its chars and write it to another file (arabic.c
      > not changed yet)
      > 3. change arabic.c
      > 4. test to see if applying arabic_shape() on the test input yields the
      > expected output
      >
      > I don't expect such tests to be included in vim; they can be uploaded
      > somewhere to use it when changing arabic.c and considering the
      > frequency of changing arabic.c in the past, this approach doesn't seem
      > to be that bad.

      The arabic shaping also works when displaying a message on the command
      line. You could try using :redir to catch the output, something like:

      :redir >>test.out
      :call feedkeys("\<CR>")
      :call input(test_string)
      :redir END

      I haven't tried it!

      --
      Bad fashion can discourage normal people from interacting with the engineer
      and talking about the cute things their children do.
      (Scott Adams - The Dilbert principle)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Ameretat Reith
      On Wed, 08 Oct 2014 08:11:34 +0330 ... For ZWNJ, I did a tiny modification telling `arabic_shape` in one of it s invocations, to separate letters based on
      Message 46 of 46 , Oct 12, 2014
      • 0 Attachment
        On Wed, 08 Oct 2014 08:11:34 +0330
        Ali Gholami Rudi <ali.gholami.rudi@...> wrote:

        > I tested it and it is working wonderfully. The only issue is
        > ZWNJ (unicode 0x200c) and ZWJ (unicode 0x200d); I wonder if
        > the letters before and after these characters can be shaped
        > properly...

        For ZWNJ, I did a tiny modification telling `arabic_shape` in one of
        it's invocations, to separate letters based on previously entered ZWNJ
        character. ZWJ could be treated similarly but I doubt with current
        provided letters which are limited to Arabic and Farsi, there could be a
        use case for ZWJ.

        You can apply `zwnj.0.patch` on a recent vim tarball or `zwnj.1.patch`
        on top of your patch.

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      Your message has been successfully submitted and would be delivered to recipients shortly.