Are they bugs of xnedit?
Modernized fork of NEdit, with unicode support and AA text rendering
Brought to you by:
pyrphoros
1) While I edit some files containing long lines (BTW, I set line wrap to off), if I drag the right border of xnedit window from left to right, sometimes the characters close to this border are not refreshed correctly, as shown in the attached snapshot. This is also possibly caused by the operation system, but I am not sure.
2) When I tried to edit a large file (376269036 bytes, 7235944 lines), xnedit could load the file, but when I tried to delete a few lines, then xnedit crashed with error "Segmentation fault (core dumped)". I am not sure if this was due to the file is too large for xnedit, or it's a bug.
Additional info:
I can reproduce the first one with xnedit-1.5.3.
If I use xnedit-1.5.3 then xnedit doesn't crash when editing the same large file, so the second one is a bug in the latest version.
Can you always reproduce the crash?
Yes. I can always reproduce the crash with two text files. Please try with the following steps:
1) Copy the following line
19892 5620 5600000 19940000 5620000 19892000
7091513 times to create a file named "aa.xps" (368758676 bytes).
2) Type "xnedit aa.xps", and after xnedit load the file, select the first 30 lines with Shift+ Down arrow" and hit the delete key.
The crash should be fixed now.
The rendering bug still remains. I was not able to reproduce it yet, these types of bugs can also depend on the window manager/desktop environment, so I will have to try it on different platforms.
Thank you for the fix!
Regarding the rendering issue, I strongly suggest you disregard my report (and close the ticket), as I’m using X2Go—a remote desktop tool for Linux that’s not widely used. If you’re unable to reproduce the issue, it’s most likely not related to an xnedit bug.
I found if I increase a bit the range between leftclip and rightclip in function
static void redisplayLine(textDisp *textD, int visLineNum, int leftClip,
int rightClip, int leftCharIndex, int rightCharIndex)"
...
leftClip = max(textD->left, leftClip)-5;
rightClip = min(rightClip, textD->left + textD->width)+5;
...
Then the first issue I reported would be solved. I don't understand the code so I am not sure if 5 is the optimal value.
Not a right solution - above modification causes another issue.
It seems if I change:
to
redisplayLine(textD, line, 0, INT_MAX, 0, INT_MAX);
in functionTextDRedisplayRect(...), everything works fine.
This works as a workaround, however it forces a full repaint of the whole line which has some impacts on performance.
When I have time, I will try to reproduce this issue with X2Go.
OK. Thank you so much.
A better one I've found is:
redisplayLine(textD, line, left-10, left+width, 0, INT_MAX);
It's not necessary to try X2go since I'll use something else in the future.
The best solution is redisplayLine(textD, line, left-5, left+width, 0, INT_MAX), where "5" comes from "textNmarginWidth" defined in text.c as below:
it seems when redisplay a line, the margin is not taken into account. If I what I think is correct, then this is a bug anyway.
I've added your suggested code change.
Thanks for the fix.