コード例 #1
0
 @Override
 protected void init() {
   FunctionResult result = new FunctionResult();
   TerminfoFunctions.initTerminal(output.ordinal(), capabilities, result);
   if (result.isFailed()) {
     throw new NativeException(
         String.format("Could not open terminal for %s: %s", this, result.getMessage()));
   }
 }
コード例 #2
0
 public Terminal reset() {
   FunctionResult result = new FunctionResult();
   TerminfoFunctions.reset(result);
   if (result.isFailed()) {
     throw new NativeException(
         String.format("Could not reset terminal for %s: %s", this, result.getMessage()));
   }
   return this;
 }
コード例 #3
0
 public Terminal clearToEndOfLine() throws NativeException {
   FunctionResult result = new FunctionResult();
   TerminfoFunctions.clearToEndOfLine(result);
   if (result.isFailed()) {
     throw new NativeException(
         String.format("Could not clear to end of line for %s: %s", this, result.getMessage()));
   }
   return this;
 }
コード例 #4
0
 public Terminal cursorRight(int count) {
   FunctionResult result = new FunctionResult();
   TerminfoFunctions.right(count, result);
   if (result.isFailed()) {
     throw new NativeException(
         String.format("Could not move cursor right for %s: %s", this, result.getMessage()));
   }
   return this;
 }
コード例 #5
0
 public Terminal cursorStartOfLine() throws NativeException {
   FunctionResult result = new FunctionResult();
   TerminfoFunctions.startLine(result);
   if (result.isFailed()) {
     throw new NativeException(
         String.format(
             "Could not move cursor to start of line for %s: %s", this, result.getMessage()));
   }
   return this;
 }
コード例 #6
0
  public Terminal bold() {
    if (!capabilities.textAttributes) {
      return this;
    }

    FunctionResult result = new FunctionResult();
    TerminfoFunctions.bold(result);
    if (result.isFailed()) {
      throw new NativeException(
          String.format("Could not switch to bold mode for %s: %s", this, result.getMessage()));
    }
    return this;
  }
コード例 #7
0
  public Terminal foreground(Color color) {
    if (!capabilities.colors) {
      return this;
    }

    FunctionResult result = new FunctionResult();
    TerminfoFunctions.foreground(color.ordinal(), result);
    if (result.isFailed()) {
      throw new NativeException(
          String.format("Could not switch foreground color for %s: %s", this, result.getMessage()));
    }
    foreground = color;
    return this;
  }