Fri 17 Feb 2017 07:41:42 AM UTC, comment #1:
I've found another issue (neither of the two given here, but it falls under the category of double-width characters' sometimes not being shown).
Using an 80x24 terminal, run
nano --ignore chinese.html
Then do the following.
1. Press ^W to get the "Search" prompt.
2. Press Meta-B to toggle backwards searches.
3. Search for "<br>".
4. Press Meta-W to search for "<br>" a second time. Note that this second match is bracketed on either side by two-column characters,
5. Press Meta-$ to toggle softwrap mode. Note that the "<br>" is now on the right edge of the screen, the two-column character to its left is still there, and the two-column character to its right is on the next line (or would be if it wasn't displayed as blanks).
You can verify that the two-column character on the right isn't gone, only misdisplayed, by pressing Space. Since the cursor should still be on the first character of "<br>", that will shift it forward, and the character will reappear.
This problem is caused by an oversight with regards to display_string() and softwrap mode, triggered by having a two-column character start exactly at the beginning of a row of a softwrapped line other than the first. The code to add a "$" to the end or beginning of overlong lines is only supposed to be used when we're not in softwrap mode, and properly makes sure of that. The first place where this is referenced is at the very beginning of display_string(): winio.c, starting at line 1814:
/* If this is data, make room for the "$" at the end of the line. */
if (isdata && !ISSET(SOFTWRAP) && strlenpt(buf) > start_col + span)
span--;
However, there's a second instance later that assumes we're adding a "$" to the beginning of the line, that wasn't updated for softwrap mode: winio.c, starting at line 1835:
if (buf != '\0' && buf != '\t' &&
(column < start_col || (isdata && column > 0))) {
/* We don't display the complete first character as it starts to
* the left of the screen. */
The next if/else block after this, which handles two-column characters, assumes that we've added a "$" as the first column of the overlong line (even in softwrap mode). Thus, it tries to display a space over half the character since it can't display half a character, and ends up displaying two spaces insstead of the full character at the beginning of the line.
The attached patch fixes this by checking for softwrap mode in the second case, and makes the missing character in the test case appear properly.
(file #39770)
|