260 protected void backspace() { |
260 protected void backspace() { |
261 bell(); |
261 bell(); |
262 } |
262 } |
263 |
263 |
264 protected void carriageReturn() { |
264 protected void carriageReturn() { |
265 setPromtActive(false); |
265 if (config.isPrintPromptOnInput()) { |
266 // Append newline first if not there yet |
266 setPromtActive(false); |
267 if (!bufferIsEmpty() && !bufferEndsWithNewLine()) { |
267 // Append newline first if not there yet |
268 newLine(); |
268 if (!bufferIsEmpty() && !bufferEndsWithNewLine()) { |
269 reducePrompt(-1); |
269 newLine(); |
270 } |
270 reducePrompt(-1); |
271 if (config.isPrintPromptOnInput()) { |
271 } |
272 print(getCurrentPromptContent()); |
272 print(getCurrentPromptContent()); |
273 newLine(); |
273 newLine(); |
274 } |
274 if (promptRows > 1) { |
275 if (promptRows > 1) { |
275 reducePrompt(-1); |
276 reducePrompt(-1); |
276 } |
277 } |
277 } else { |
|
278 if (!bufferIsEmpty() && !bufferEndsWithNewLine()) { |
|
279 newLine(); |
|
280 if (promptRows > 1) { |
|
281 reducePrompt(-1); |
|
282 } |
|
283 } |
|
284 } |
278 String lineBuffer = getInput(); |
285 String lineBuffer = getInput(); |
279 lineBuffer = lineBuffer.trim(); |
286 lineBuffer = lineBuffer.trim(); |
280 if (!"".equals(lineBuffer)) { |
287 if (!"".equals(lineBuffer)) { |
281 cmdHistory.add(lineBuffer); |
288 cmdHistory.add(lineBuffer); |
282 cmdHistoryIndex = cmdHistory.size(); |
289 cmdHistoryIndex = cmdHistory.size(); |
455 scrollToEnd(); |
462 scrollToEnd(); |
456 ps.setInnerHTML(cleanPs); |
463 ps.setInnerHTML(cleanPs); |
457 setInput(inputText); |
464 setInput(inputText); |
458 } |
465 } |
459 |
466 |
460 public void focusInput(){ |
467 public void focusInput() { |
461 setPromtActive(true); |
468 if (isFocused()) |
462 scrollToEnd(); |
469 setPromtActive(true); |
463 ps.setInnerHTML(cleanPs); |
470 scrollToEnd(); |
464 } |
471 ps.setInnerHTML(cleanPs); |
|
472 } |
465 |
473 |
466 public void scrollToEnd() { |
474 public void scrollToEnd() { |
467 term.setScrollTop(BIG_NUMBER); |
475 term.setScrollTop(BIG_NUMBER); |
468 } |
476 } |
469 |
477 |