Skip to content

Commit

Permalink
FEAT: improves a bit ASK stability for user code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dockimbel committed Jun 13, 2015
1 parent 1bc6d2b commit 406b783
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
5 changes: 1 addition & 4 deletions environment/console/POSIX.reds
Expand Up @@ -445,10 +445,7 @@ init: func [
][
relative-y: 0
utf-char: as-c-string allocate 10

copy-cell as red-value! line as red-value! input-line
copy-cell as red-value! hist-blk as red-value! history


so: declare sigaction! ;-- install resizing signal trap
mask: (as-integer so) + 4
sigemptyset mask
Expand Down
24 changes: 19 additions & 5 deletions environment/console/input.red
Expand Up @@ -175,6 +175,7 @@ default-input-completer: func [
columns: -1
rows: -1
output?: yes
init?: no

string/rs-make-at as cell! saved-line 1

Expand Down Expand Up @@ -510,14 +511,27 @@ default-input-completer: func [
]
line/head: 0
]

setup: func [
line [red-string!]
hist [red-block!]
][
copy-cell as red-value! line as red-value! input-line
copy-cell as red-value! hist as red-value! history

unless init? [
init line hist
init?: yes
]
]
]
]

set-buffer-history: routine [line [string!] hist [block!]][
terminal/init line hist
_set-buffer-history: routine [line [string!] hist [block!]][
terminal/setup line hist
]

read-input: routine [prompt [string!]][
_read-input: routine [prompt [string!]][
terminal/edit prompt
terminal/restore
print-line ""
Expand All @@ -528,8 +542,8 @@ ask: function [
return: [string!]
][
buffer: make string! 1
set-buffer-history buffer head system/console/history
read-input question
_set-buffer-history buffer head system/console/history
_read-input question
buffer
]

Expand Down
3 changes: 0 additions & 3 deletions environment/console/win32.reds
Expand Up @@ -260,9 +260,6 @@ init: func [
/local
mode [integer!]
][
copy-cell as red-value! line as red-value! input-line
copy-cell as red-value! hist-blk as red-value! history

GetConsoleMode stdin :saved-con
mode: saved-con and (not ENABLE_PROCESSED_INPUT) ;-- turn off PROCESSED_INPUT, so we can handle control-c
mode: mode or ENABLE_QUICK_EDIT_MODE ;-- use the mouse to select and edit text
Expand Down

0 comments on commit 406b783

Please sign in to comment.