Ticket #1411 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

mcedit input text issue

Reported by: angel_il Owned by: angel_il
Priority: major Milestone: 4.7.0-pre2
Component: mcedit Version: master
Keywords: Cc: dmartina@…
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

in insert mode? mcedit incorrect replace utf-8 text.
for reproduce:
input test like this 'йцукенг' in utf-8
move cursor at start of line
press key <Ins>
input new text.

Change History

comment:1 Changed 7 years ago by dmartina

  • Cc dmartina@… added

I noticed too:

  • In mcedit
  • In overwite mode (press Ins)
  • When trying to overwrite a multibyte UTF-8 (non ASCII) character, just the first byte is replaced.
  • The second, orphan, meaningless byte stays.

Something easy:

1 €uro

And try to overwrite the '€' with a plain 'e'.

comment:2 Changed 7 years ago by angel_il

  • Status changed from new to accepted
  • Owner set to angel_il

comment:3 Changed 7 years ago by angel_il

  • severity changed from no branch to on review

branch: 1411_insert_issue (parent: master)
changeset: ffdeb28b3bfbfa6242fd41a247f87133115c493a

comment:4 Changed 7 years ago by angel_il

  • Status changed from accepted to assigned

comment:5 Changed 7 years ago by iNode

Yes it's fix the problem but some related old code seems ugly, I propose to do small refactoring.
i.e. edit.c:edit_delete:

p = edit->buffers2[(edit->curs2 - 1) >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - ((edit->curs2 - 1) & M_EDIT_BUF_SIZE) - 1];

too long

    ... const int byte_delete
    /* if byte_delete = 1 then delete only one byte not multibyte char*/

should be gboolean.

edit.c:edit_get_utf

            if ( next_ch != str ) {
                width = next_ch - str;
            } else {
                width = 0;
            }

Any way next_ch - str equal width or 0, useless if.

Thanks.

comment:6 Changed 7 years ago by angel_il

but some related old code seems ugly, I propose to do small refactoring.

ok, but not in this ticket

comment:7 Changed 7 years ago by angel_il

rebased: 0a594b7cc028ca31a2f1dc4b3fa6395ead4b67c6 (forced update)

comment:8 Changed 7 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:9 Changed 7 years ago by andrew_b

  • Votes for changeset changed from slavazanko to slavazanko andrew_b
  • severity changed from on review to approved

comment:10 Changed 7 years ago by angel_il

  • Status changed from assigned to testing
  • Resolution set to fixed

comment:11 Changed 7 years ago by angel_il

  • Status changed from testing to closed
  • Votes for changeset changed from slavazanko andrew_b to commited-master

comment:12 Changed 7 years ago by angel_il

  • severity changed from approved to merged
Note: See TracTickets for help on using tickets.