Skip to contentSkip to conversation

fix ncurses output

PATCH In review Bernhard Kauer 2 participants 4 messages Feb 25, 2008 – Jul 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix ncurses output

The ncurses console uses mvwaddchnstr() to print a line of output to a ncurses pad. Unfortunately this routine stops to print further chars if a zero-char is seen in the line. This has the effect that parts of a line are never redraw.

The following patch puts spaces instead of the zeros into the line-buffer. Please note that this change affects other consoles as well and is perhaps undesirable. Comments?

Bernhard Kauer

Index: console.h

console.h +2 -1
@@ -104,7 +104,8 @@
 typedef unsigned long console_ch_t;
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
-    cpu_to_le32wu((uint32_t *) dest, ch);
+  if (!(ch & 0xff))  ch = 0x20;
+  cpu_to_le32wu((uint32_t *) dest, ch);
 }
 
 typedef void (*vga_hw_update_ptr)(void *);
#1 lore raw
Quoted 4 lines · Bernhard Kauer

The ncurses console uses mvwaddchnstr() to print a line of output to a ncurses pad. Unfortunately this routine stops to print further chars if a zero-char is seen in the line. This has the effect that parts of a line are never redraw.

Do you have a simple testcase (program to run, code, ...). I have been unable to reproduce this problem here.

Quoted 3 lines

The following patch puts spaces instead of the zeros into the line-buffer. Please note that this change affects other consoles as well and is perhaps undesirable. Comments?

I am not sure replacing zeros into spaces is correct. Zeros are not supposed to be displayed, contrary to spaces.

Aurelien

Quoted 13 lines

Index: console.h

console.h +2 -1
@@ -104,7 +104,8 @@
 typedef unsigned long console_ch_t;
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
-    cpu_to_le32wu((uint32_t *) dest, ch);
+  if (!(ch & 0xff))  ch = 0x20;
+  cpu_to_le32wu((uint32_t *) dest, ch);
 }
 
 typedef void (*vga_hw_update_ptr)(void *);
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
Quoted 8 lines · Aurelien Jarno
Quoted 4 lines · Bernhard Kauer

The ncurses console uses mvwaddchnstr() to print a line of output to a ncurses pad. Unfortunately this routine stops to print further chars if a zero-char is seen in the line. This has the effect that parts of a line are never redraw.

Do you have a simple testcase (program to run, code, ...). I have been unable to reproduce this problem here.

I didnot have an easy testcase yet, but it will happen if someone clears the VGA screen with zeros and tries to display a char later on the line.

For the behaviour of the mvwaddchnstr() function see the ncurses source.

Bernhard

#3 lore raw
In reply to Bernhard Kauer

This bug is still present. Somebody willing to fix it?

Bernhard

Quoted 25 lines · Bernhard Kauer

The ncurses console uses mvwaddchnstr() to print a line of output to a ncurses pad. Unfortunately this routine stops to print further chars if a zero-char is seen in the line. This has the effect that parts of a line are never redraw.

The following patch puts spaces instead of the zeros into the line-buffer. Please note that this change affects other consoles as well and is perhaps undesirable. Comments?

Bernhard Kauer

Index: console.h

console.h +2 -1
@@ -104,7 +104,8 @@
 typedef unsigned long console_ch_t;
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
-    cpu_to_le32wu((uint32_t *) dest, ch);
+  if (!(ch & 0xff))  ch = 0x20;
+  cpu_to_le32wu((uint32_t *) dest, ch);
 }
 
 typedef void (*vga_hw_update_ptr)(void *);