Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpc/stand/hpcboot/menu Do not replace the boot log ...



details:   https://anonhg.NetBSD.org/src/rev/f10f5cf6fc98
branches:  trunk
changeset: 556686:f10f5cf6fc98
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Dec 23 15:08:33 2003 +0000

description:
Do not replace the boot log text completely on every print - that
causes horrible flicker.  Instead append it and scroll to the caret.

diffstat:

 sys/arch/hpc/stand/hpcboot/menu/menu.cpp |  30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diffs (58 lines):

diff -r 00238ef5eaae -r f10f5cf6fc98 sys/arch/hpc/stand/hpcboot/menu/menu.cpp
--- a/sys/arch/hpc/stand/hpcboot/menu/menu.cpp  Tue Dec 23 15:02:40 2003 +0000
+++ b/sys/arch/hpc/stand/hpcboot/menu/menu.cpp  Tue Dec 23 15:08:33 2003 +0000
@@ -1,4 +1,4 @@
-/* -*-C++-*-   $NetBSD: menu.cpp,v 1.5 2002/03/25 17:23:19 uch Exp $   */
+/* -*-C++-*-   $NetBSD: menu.cpp,v 1.6 2003/12/23 15:08:33 uwe Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -340,25 +340,19 @@
        }
 
  display:
-       // count # of '\n'
+       // count number of '\n'
        for (cr = 0, p = buf; p = wcschr(p, TEXT('\n')); cr++, p++)
-               ;
-       // total length of new buffer('\n' -> "\r\n" + '\0')
-       int ln = wcslen(buf) + cr + 1;
+               continue;
 
-       // get old buffer.
-       int lo = Edit_GetTextLength(_edit);
-       size_t sz =(lo  + ln) * sizeof(TCHAR);
+       // total length of new buffer ('\n' -> "\r\n" + '\0')
+       size_t sz = (wcslen(buf) + cr + 1) * sizeof(TCHAR);
 
        p = reinterpret_cast <TCHAR *>(malloc(sz));
        if (p == NULL)
                return;
 
-       memset(p, 0, sz);
-       Edit_GetText(_edit, p, lo + 1);
-
-       // put new buffer to end of old buffer.
-       TCHAR *d = p + lo;
+       // convert newlines
+       TCHAR *d = p;
        while (*buf != TEXT('\0')) {
                TCHAR c = *buf++;
                if (c == TEXT('\n'))
@@ -366,10 +360,12 @@
                *d++ = c;
        }
        *d = TEXT('\0');
-    
-       // display total buffer.
-       Edit_SetText(_edit, p);
-//  Edit_Scroll(_edit, Edit_GetLineCount(_edit), 0);
+
+       // append the text and scroll
+       int end = Edit_GetTextLength(_edit);
+       Edit_SetSel(_edit, end, end);
+       Edit_ReplaceSel(_edit, p);
+       Edit_ScrollCaret(_edit);
        UpdateWindow(_edit);
 
        free(p);



Home | Main Index | Thread Index | Old Index