mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
webconfig: Use history -z
This did some weird stuff with \x1e. [ci skip]
This commit is contained in:
@@ -742,10 +742,9 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
return [binding.get_json_obj() for binding in bindings]
|
return [binding.get_json_obj() for binding in bindings]
|
||||||
|
|
||||||
def do_get_history(self):
|
def do_get_history(self):
|
||||||
# Use \x1e ("record separator") to distinguish between history items.
|
# Use NUL to distinguish between history items.
|
||||||
# The first backslash is so Python passes one backslash to fish.
|
out, err = run_fish_cmd('builtin history -z')
|
||||||
out, err = run_fish_cmd('for val in $history; echo -n $val \\x1e; end')
|
result = out.split('\0')
|
||||||
result = out.split(' \x1e')
|
|
||||||
if result:
|
if result:
|
||||||
result.pop() # trim off the trailing element
|
result.pop() # trim off the trailing element
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user