Skip to content

Commit

Permalink
Ignore nulls from terminal CTRL-space in LineEdit
Browse files Browse the repository at this point in the history
By default some terminals (eg, xterm) generate '\0' when CTRL-space is
pressed.  However, '\0' is used internally by the key map system to
represent a wildcard (see normalize_key()), so cannot be handled without
a larger overhaul.  Instead, just ignore it to avoid user confusion with
lines containing an invisible, unparsable character.

Fixes JuliaLang#7001
  • Loading branch information
c42f committed Apr 23, 2017
1 parent 02d7b14 commit 73afd87
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ function match_input(k::Dict, s, term=terminal(s), cs=Char[], keymap = k)
# return an empty keymap function
eof(term) && return keymap_fcn(nothing, "")
c = read(term, Char)
# Ignore any '\0' (eg, CTRL-space in xterm), as this is used as a
# placeholder for the wildcard (see normalize_key("*"))
c != '\0' || return keymap_fcn(nothing, "")
push!(cs, c)
key = haskey(k, c) ? c : '\0'
# if we don't match on the key, look for a default action then fallback on 'nothing' to ignore
Expand Down

0 comments on commit 73afd87

Please sign in to comment.