Skip to content

mcedit: Wrong cursor position with 8-bit locale after nonprintable Unicode character #4880

Description

@egmontkob

Is there an existing issue for this?

  • I have searched the existing issues

Midnight Commander version and build configuration

4.8.33, current git

Operating system

Linux

Is this issue reproducible using the latest version of Midnight Commander?

  • I confirm the issue is still reproducible with the latest version of Midnight Commander

How to reproduce

Create a file that contains some non-printable Unicode character (e.g. U+FEFF or U+10FFFF) encoded in UTF-8, perhaps followed by a few ASCII letters.

Start mcedit with an 8-bit locale (and the same 8-bit charset in the terminal). Open the file with UTF-8 as the file's encoding (this is the default, verify with Alt-E).

The said Unicode character is displayed as a single dot. Press the right arrow to jump over this character. The cursor moves by 3 or 4 columns, corresponding to the number of bytes in the UTF-8 sequence.

Insert new letters, or just observe the shown character code in the header: the cursor is consistently shown at the wrong offset. While on the display (the terminal's contents) the said character occupies 1 column, the cursor jumps as if that character occupied 3-4 columns.

Expected behavior

.

Actual behavior

.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: mceditmcedit, the built-in text editorprio: mediumHas the potential to affect progress

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions