Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Print character only if printable #49

Merged
merged 3 commits into from
Jul 27, 2015
Merged

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Jul 27, 2015

Fix #16 and #17.

When a character is not printable, the readline did still print it. In some cases, it could create weird bug (see 1 or 2). Since we have the Hoa\Ustring::isCharPrintable, we can check whether a character is printable or not. Consequently, here is the new logic:

  • We read a character,
  • The buffer receives this character,
  • If there is no mapping for this character and if it is not printable, then we do not print it. We do nothing with it.

So, if we would like to support a control character that is not printable, we must associate a mapping to this character (like we do for Ctrl-A for instance).

We return earlier to avoid a deep control flow graph. It simplify the next
commit.
When a character is not printable, the readline did still print it. In
some cases, it could create weird bug (see [1] or [2]). Since we have the
`Hoa\Ustring::isCharPrintable`, we can check whether a character is
printable or not. Consequently, here is the new logic:

  * We read a character,
  * The buffer receives this character,
  * If there is no mapping for this character and if it is not
    printable, then we do not print it. We do nothing with it.

So, if we would like to support a control character that is not
printable, we must associate a mapping to this character (like we do for
`Ctrl-A` for instance).

[1]: hoaproject#16
[2]: hoaproject#17
Previous commit avoids to print a non-printable character. This one just
add a “bell”/“bip” when the user did press such a character. This is a
sonor indication that something wrong happened.
@Hywan
Copy link
Member Author

Hywan commented Jul 27, 2015

Previous commit avoids to print a non-printable character. This one just add a “bell”/“bip” when the user did press such a character. This is a sonor indication that something wrong happened.

@Hywan
Copy link
Member Author

Hywan commented Jul 27, 2015

Asking a review from @hoaproject/hoackers :-).

@vonglasow
Copy link
Member

👍

@Bhoat Bhoat merged commit 5a83b5e into hoaproject:master Jul 27, 2015
@Hywan Hywan removed the in progress label Jul 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants