@rbxts/centurion-ui 1.0.0-dev-d309887 → 1.0.0-dev-9b382c9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,9 +162,10 @@ local function TerminalTextField(_param)
162
162
  if suggestion == nil then
163
163
  return nil
164
164
  end
165
+ local currentText = text()
166
+ local atNextPart = string.sub(currentText, -1) == " "
165
167
  if commandPath == nil then
166
168
  local suggestionTitle = suggestion.title
167
- local currentText = text()
168
169
  local textParts = terminalTextParts()
169
170
  if #textParts == 0 then
170
171
  return nil
@@ -174,7 +175,7 @@ local function TerminalTextField(_param)
174
175
  table.move(textParts, 1, #textParts, _length + 1, _array)
175
176
  local pathParts = _array
176
177
  local newText = currentText
177
- if string.sub(currentText, -1) == " " then
178
+ if atNextPart then
178
179
  newText ..= suggestionTitle
179
180
  table.insert(pathParts, suggestionTitle)
180
181
  elseif not (#textParts == 0) then
@@ -211,16 +212,35 @@ local function TerminalTextField(_param)
211
212
  textBox.CursorPosition = #newText + 1
212
213
  return nil
213
214
  end
214
- -- Argument suggestions
215
- if commandPath == nil or suggestion == nil or #suggestion.others == 0 then
216
- return nil
217
- end
218
- local argIndex = terminalArgIndex()
219
215
  local _commandArgs = client.registry:getCommand(commandPath)
220
216
  if _commandArgs ~= nil then
221
217
  _commandArgs = _commandArgs.options.arguments
222
218
  end
223
219
  local commandArgs = _commandArgs
220
+ local _condition_1 = suggestion.type == "command" and not atNextPart
221
+ if _condition_1 then
222
+ local _result = commandArgs
223
+ if _result ~= nil then
224
+ _result = #_result == 0
225
+ end
226
+ local _condition_2 = _result
227
+ if _condition_2 == nil then
228
+ _condition_2 = true
229
+ end
230
+ _condition_1 = not _condition_2
231
+ end
232
+ if _condition_1 then
233
+ suggestionText("")
234
+ local newText = `{currentText} `
235
+ text(newText)
236
+ textBox.CursorPosition = #newText + 1
237
+ return nil
238
+ end
239
+ -- Argument suggestions
240
+ if #suggestion.others == 0 then
241
+ return nil
242
+ end
243
+ local argIndex = terminalArgIndex()
224
244
  if argIndex == nil or commandArgs == nil then
225
245
  return nil
226
246
  end
@@ -232,11 +252,11 @@ local function TerminalTextField(_param)
232
252
  if _result ~= nil then
233
253
  _result = #_result
234
254
  end
235
- local _condition_1 = _result
236
- if _condition_1 == nil then
237
- _condition_1 = 0
255
+ local _condition_2 = _result
256
+ if _condition_2 == nil then
257
+ _condition_2 = 0
238
258
  end
239
- newText = string.sub(_newText, 0, _exp - _condition_1)
259
+ newText = string.sub(_newText, 0, _exp - _condition_2)
240
260
  newText ..= if #{ string.match(otherSuggestion, "%s") } == 0 then otherSuggestion else `"{otherSuggestion}"`
241
261
  if argIndex < #commandArgs - 1 then
242
262
  newText ..= " "
@@ -132,6 +132,7 @@ local function Terminal()
132
132
  missingArgs(missing)
133
133
  terminalTextValid(noArgs or #missing == 0 or (atNextPart and #missing == 1))
134
134
  else
135
+ currentCommandPath(nil)
135
136
  terminalTextValid(false)
136
137
  end
137
138
  local textPart = if not atNextPart then parts[#parts] else nil
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rbxts/centurion-ui",
3
3
  "description": "Terminal UI for the Centurion command framework",
4
- "version": "1.0.0-dev-d309887",
4
+ "version": "1.0.0-dev-9b382c9",
5
5
  "author": "paradoxuum",
6
6
  "license": "MIT",
7
7
  "main": "out/init.lua",
@@ -32,7 +32,7 @@
32
32
  "dev": "shx rm -rf out && rbxtsc -w"
33
33
  },
34
34
  "devDependencies": {
35
- "@rbxts/centurion": "^1.0.0-dev-d309887",
35
+ "@rbxts/centurion": "^1.0.0-dev-9b382c9",
36
36
  "@rbxts/compiler-types": "2.3.0-types.1",
37
37
  "@rbxts/types": "^1.0.794",
38
38
  "roblox-ts": "2.3.0-dev-26ec859",
@@ -47,7 +47,7 @@
47
47
  "@rbxts/vide": "^0.4.2"
48
48
  },
49
49
  "peerDependencies": {
50
- "@rbxts/centurion": "^1.0.0-dev-d309887"
50
+ "@rbxts/centurion": "*"
51
51
  },
52
52
  "stableVersion": "1.0.0"
53
53
  }