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

Re: [60am,mb] visual selection is not drawn correctly

Expand Messages
  • Bram Moolenaar
    ... I think that s the best thing to do here. It s not possible to highlight half a character. It s not possible to delete or yank half a character either.
    Message 1 of 9 , Jul 4, 2001
    • 0 Attachment
      Yasuhiro Matsumoto wrote:

      > Hmm,
      > Is this not actual area but the area which may influence?
      > That is right if this is right.

      I think that's the best thing to do here. It's not possible to highlight half
      a character. It's not possible to delete or yank half a character either.

      > but do_put doesn't work correctly. X-(
      > if it need inserting visual selected area and
      > it located between two multibyte string,
      > pasted text need shifting left.
      >
      > this is a patch.
      >
      > please check this.

      I can see the problem with UTF-8 as well.

      I think there is some confusion of screen cells and bytes here. I'll look
      into it.

      --
      >From "know your smileys":
      @:-() Elvis Presley

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    • Bram Moolenaar
      ... On further investigation I discovered this was wrong for control characters as well. When pasting halfway a ^V (or , when display is uhex ), the
      Message 2 of 9 , Jul 4, 2001
      • 0 Attachment
        Yasuhiro Matsumoto wrote:

        > but do_put doesn't work correctly. X-(
        > if it need inserting visual selected area and
        > it located between two multibyte string,
        > pasted text need shifting left.
        >
        > this is a patch.
        >
        > please check this.

        On further investigation I discovered this was wrong for control characters as
        well. When pasting halfway a ^V (or <16>, when 'display' is "uhex"), the
        character would be deleted.

        The patch below fixes this by only deleting the character if it is a tab. I
        think a put operation is allowed to replace a tab by spaces, to make the text
        aligned. But deleting another character is not what a user expects. The
        result is that the text after the put block is misaligned. I don't see a
        simple way to avoid that.

        *** ../dist/vim60am/src/ops.c Wed Jun 27 13:41:37 2001
        --- ops.c Wed Jul 4 15:03:55 2001
        ***************
        *** 3023,3028 ****
        --- 3023,3040 ----
        bd.startspaces = incr - bd.endspaces;
        --bd.textcol;
        delcount = 1;
        + #ifdef FEAT_MBYTE
        + if (has_mbyte)
        + bd.textcol -= (*mb_head_off)(oldp, oldp + bd.textcol);
        + #endif
        + if (oldp[bd.textcol] != TAB)
        + {
        + /* Only a Tab can be split into spaces. Other
        + * characters will have to be moved to after the
        + * block, causing misalignment. */
        + delcount = 0;
        + bd.endspaces = 0;
        + }
        }

        yanklen = (int)STRLEN(y_array[i]);

        --
        >From "know your smileys":
        :.-( Crying

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      Your message has been successfully submitted and would be delivered to recipients shortly.