Details
-
Bug
-
Resolution: Done
-
Minor
-
1.2.3.Final
-
None
Description
when I try to print some UTF-8 characters in the shell the end of the line is cropped. E.g.
shell.print("\u2501 Hello World");
results in
━ Hello Wor
Looks like the org.jboss.forge.shell.buffers.JLineScreenBuffer is calculating the BufferSize wrong:
public synchronized void write(String s) { if (bufferSize + s.length() >= maxBufferSize) { flushBuffer(); write(s); } buffer.put(s.getBytes()); bufferSize += s.length(); _flush(); }
s.length() is returning the size of the used Characters, not the Size of the used Bytes. Could be replaced by s.getBytes("UTF-8").length or e.g. this calculation method