Menu

#311 Preserve trailing spaces

Unknown
closed-fixed
nobody
None
v4.5
5
2018-01-10
2015-02-16
No

When a line in the file contains trailing spaces, joe should print them as spaces. After that point, it should remove the rest of the line with \e[K. This is so that copy-pasting the contents preserves the exact number of trailing spaces. For this, the whole screen drawing layer would need to distinguish between explicit spaces vs unused areas of the screen.

(Relevant: https://sourceforge.net/p/joe-editor/bugs/302/#c2d)

Discussion

  • Joe Allen

    Joe Allen - 2017-12-22

    This should now be fixed in Mercurial.

    If a line ends with spaces, they are emitted and then the rest of the line is cleared with ESC [ K. I put a \n in the screen buffer as a marker to indicated where the ESC [ K was emitted so there is no ambiguity between spaces and ends of lines.

    Also I improved eraeol() so thay it only emits if ESC [ K if necessary: I mean it remembers that ESC [ K had been emitted on a line, and so does not re-emit it on every character press. I was noticing the cursor jumping around from this.

    I also removed some code which was resetting the attributes and background color before any cursor motion. This reduces the output when highlighting and/or color schemes are enabled. This one probably needs testing- I don't remember all the cases that this code was originally intended to deal with.

    I've also enabled scrolling for high speed terminal emulators. Years ago I found that scrolling was slower than redrawing everything, but I think now there is so much output with color schemes and highlighting that it's better to use scrolling.

     
  • Egmont Koblinger

    Just for fun:

    I have just accidentally discovered a tiny issue in joe which was apparently (probably accidentally) fixed by this change.

    On the opening screen, every second joe did a

    write(1, "\33[24;59H\33[K\33[H\n", 15) = 15

    that is, moved the cursor to the end of the copyright message, cleared to EOL and then moved back the cursor. This generated some unnecessary network traffic, and unnecessarily woke up the graphical terminal emulator every second. joe then stopped doing this once you pressed a key and hence the copyright message was gone.

    With latest Mercurial version this no longer seems to happen.

     
  • Joe Allen

    Joe Allen - 2018-01-10
    • status: open --> closed-fixed
    • Applies To: --> v4.5
     

Log in to post a comment.