@Override public void apply(Readline.Interaction interaction) { List<int[]> history = interaction.history(); if (history.size() > 0) { int curr = interaction.getHistoryIndex(); int next = curr + 1; if (next < history.size()) { if (curr == -1) { int[] tmp = interaction.buffer().toArray(); interaction.data().put("abc", tmp); } int[] line = history.get(next); interaction.refresh(new LineBuffer().insert(line)); interaction.setHistoryIndex(next); } } interaction.resume(); } }
@Override public void apply(Readline.Interaction interaction) { List<int[]> history = interaction.history(); if (history.size() > 0) { int curr = interaction.getHistoryIndex(); int next = curr + 1; if (next < history.size()) { if (curr == -1) { int[] tmp = interaction.buffer().toArray(); interaction.data().put("abc", tmp); } int[] line = history.get(next); interaction.refresh(new LineBuffer().insert(line)); interaction.setHistoryIndex(next); } } interaction.resume(); } }
@Override public void apply(Readline.Interaction interaction) { int[] points = interaction.buffer().toArray(); // Reverse the buffer for (int i = 0; i < points.length / 2; i++) { int temp = points[i]; points[i] = points[points.length - 1 - i]; points[points.length - 1 - i] = temp; } // Refresh buffer interaction.refresh(new LineBuffer().insert(points)); // Resume readline interaction.resume(); } }
public Completion(Readline.Interaction interaction) { // int index = interaction.buffer().getCursor(); while (index > 0 && interaction.buffer().getAt(index - 1) != ' ') { index--; } // Compute line : need to test full line :-) // Compute prefix LineBuffer prefix = interaction.line().copy(); for (int i = index; i < interaction.buffer().getCursor();i++) { prefix.insert(interaction.buffer().getAt(i)); } this.interaction = interaction; this.prefix = prefix.toArray(); this.line = interaction.line().copy().insert(interaction.buffer().toArray()).toArray(); }
public Completion(Readline.Interaction interaction) { // int index = interaction.buffer().getCursor(); while (index > 0 && interaction.buffer().getAt(index - 1) != ' ') { index--; } // Compute line : need to test full line :-) // Compute prefix LineBuffer prefix = interaction.line().copy(); for (int i = index; i < interaction.buffer().getCursor();i++) { prefix.insert(interaction.buffer().getAt(i)); } this.interaction = interaction; this.prefix = prefix.toArray(); this.line = interaction.line().copy().insert(interaction.buffer().toArray()).toArray(); }
@Override public void apply(Readline.Interaction interaction) { int[] points = interaction.buffer().toArray(); // Reverse the buffer for (int i = 0; i < points.length / 2; i++) { int temp = points[i]; points[i] = points[points.length - 1 - i]; points[points.length - 1 - i] = temp; } // Refresh buffer interaction.refresh(new LineBuffer().insert(points)); // Resume readline interaction.resume(); } }
private void refresh(LineBuffer update, int width) { LineBuffer copy3 = new LineBuffer(); IntStream.Builder consumer = IntStream.builder(); copy3.insert(Helper.toCodePoints(currentPrompt)); copy3.insert(buffer().toArray()); copy3.setCursor(currentPrompt.length() + buffer().getCursor()); LineBuffer copy2 = new LineBuffer(); copy2.insert(Helper.toCodePoints(currentPrompt)); copy2.insert(update.toArray()); copy2.setCursor(currentPrompt.length() + update.getCursor()); copy3.update(copy2, data -> { for (int cp : data) { consumer.accept(cp); } }, width); conn.stdoutHandler().accept(consumer.build().toArray()); buffer.clear(); buffer.insert(update.toArray()); buffer.setCursor(update.getCursor()); }
private void refresh(LineBuffer update, int width) { LineBuffer copy3 = new LineBuffer(); IntStream.Builder consumer = IntStream.builder(); copy3.insert(Helper.toCodePoints(currentPrompt)); copy3.insert(buffer().toArray()); copy3.setCursor(currentPrompt.length() + buffer().getCursor()); LineBuffer copy2 = new LineBuffer(); copy2.insert(Helper.toCodePoints(currentPrompt)); copy2.insert(update.toArray()); copy2.setCursor(currentPrompt.length() + update.getCursor()); copy3.update(copy2, data -> { for (int cp : data) { consumer.accept(cp); } }, width); conn.stdoutHandler().accept(consumer.build().toArray()); buffer.clear(); buffer.insert(update.toArray()); buffer.setCursor(update.getCursor()); }
abc.insert(buffer.toArray()); abc.setCursor(currentPrompt.length() + buffer.getCursor());
abc.insert(buffer.toArray()); abc.setCursor(currentPrompt.length() + buffer.getCursor());
/** * Redraw the current line. */ public void redraw() { LineBuffer toto = new LineBuffer(); toto.insert(Helper.toCodePoints(currentPrompt)); toto.insert(buffer.toArray()); toto.setCursor(currentPrompt.length() + buffer.getCursor()); LineBuffer abc = new LineBuffer(); abc.update(toto, conn.stdoutHandler(), size.x()); }
/** * Redraw the current line. */ public void redraw() { LineBuffer toto = new LineBuffer(); toto.insert(Helper.toCodePoints(currentPrompt)); toto.insert(buffer.toArray()); toto.setCursor(currentPrompt.length() + buffer.getCursor()); LineBuffer abc = new LineBuffer(); abc.update(toto, conn.stdoutHandler(), size.x()); }
@Override public void apply(Interaction interaction) { interaction.line.insert(interaction.buffer.toArray()); LineStatus pb = new LineStatus(); for (int i = 0;i < interaction.line.getSize();i++) { String raw = interaction.line.toString(); if (interaction.line.getSize() > 0) { history.add(0, interaction.line.toArray());
@Override public void apply(Interaction interaction) { interaction.line.insert(interaction.buffer.toArray()); LineStatus pb = new LineStatus(); for (int i = 0;i < interaction.line.getSize();i++) { String raw = interaction.line.toString(); if (interaction.line.getSize() > 0) { history.add(0, interaction.line.toArray());
public LineStatus.Ext insertEscaped(int... codePoints) { LineStatus.Ext status = new LineStatus.Ext(); Helper.consumeTo(toArray(), status); status.buffer.clear(); for (int cp : codePoints) {
public LineStatus.Ext insertEscaped(int... codePoints) { LineStatus.Ext status = new LineStatus.Ext(); Helper.consumeTo(toArray(), status); status.buffer.clear(); for (int cp : codePoints) {