Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
api:term:zh [2023/10/15 09:25]
hfsr [Term API] translate
api:term:zh [2023/10/20 06:44]
hfsr
Line 29: Line 29:
 从终端读取一些文本,即让用户能够输入一些文本。例如,此函数被shell和Lua解释器用来读取用户输入。此函数会使当前行从光标位置算起的剩余部分变为可编辑区域。在此区域中可以输入、删除文字,还可以使用左右方向键和home/​end键移动光标。 从终端读取一些文本,即让用户能够输入一些文本。例如,此函数被shell和Lua解释器用来读取用户输入。此函数会使当前行从光标位置算起的剩余部分变为可编辑区域。在此区域中可以输入、删除文字,还可以使用左右方向键和home/​end键移动光标。
   ​   ​
-***自OpenOS 1.6起**此处指定的参数列表已被废弃The first parameter is an `optionsargument. The indexed array values are treated as `history`, named keys take the place of legacy arguments. For compatibility, ​OpenOS 1.6 will respect the previous usage, i.e. parameter list. +  ​***自OpenOS 1.6起** 此处指定的参数列表已被视为过时第一个参数为`option`(选项)参数。其索引值被作为`histroy`(历史)对待,命名键取代了旧的参数。出于兼容性考虑,OpenOS 1.6仍然支持以前的用法,即参数列表。 
-  *The new `ops` parameter supports a new key, `nowrap`. The default behavior of term.read ​wrap the cursor and input vertically. Legacy behavior scrolled the input horizontally,​ i.e. `term.read({nowrap=true})`+  *新的 ​`ops` 参数支持新键:`nowrap`。`term.read`的默认行为(`nowrap`为`false`)垂直绑定了光标和输入。先前的行为模式下会水平滚动输入,即现在的 ​`term.read({nowrap=true})`
  
   The optional `history` table can be used to provide predefined text that can be cycled through via the up and down arrow keys. It must be a sequence (i.e. the keys must be a gap-less integral interval starting at 1). This is used for the command history in shell and Lua interpreter,​ for example. If text is entered and confirmed with enter, it will be added to the end of this table.  ​   The optional `history` table can be used to provide predefined text that can be cycled through via the up and down arrow keys. It must be a sequence (i.e. the keys must be a gap-less integral interval starting at 1). This is used for the command history in shell and Lua interpreter,​ for example. If text is entered and confirmed with enter, it will be added to the end of this table.  ​