From: Benjamin Poirier <bpoirier@suse.de>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Randy Dunlap <rdunlap@xenotime.net>,
Borislav Petkov <bp@alien8.de>,
"Yann E. MORIN" <yann.morin.1998@free.fr>,
Jean Sacren <sakiwit@gmail.com>,
Arnaud Lacombe <lacombar@gmail.com>,
Lucas De Marchi <lucas.demarchi@profusion.mobi>,
Davidlohr Bueso <dave@gnu.org>, Wang YanQing <udknight@gmail.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Cheng Renquan <crquan@gmail.com>
Subject: [PATCH v2 5/6] menuconfig: Do not open code textbox scroll up/down
Date: Thu, 23 Aug 2012 14:55:07 -0400 [thread overview]
Message-ID: <1345748108-12206-6-git-send-email-bpoirier@suse.de> (raw)
In-Reply-To: <1345748108-12206-1-git-send-email-bpoirier@suse.de>
We don't need to explicitely use ncurses' scroll(). ncurses performs
vertical-motion optimization at wrefresh() time.
Using strace I confirmed that with the following patch curses still sends only
the new line of text to the terminal when scrolling up/down one line at a
time.
Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
---
scripts/kconfig/lxdialog/textbox.c | 55 +++++++----------------------------
1 files changed, 11 insertions(+), 44 deletions(-)
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index 506a095..3b3c5c4 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -166,40 +166,12 @@ do_resize:
case 'K': /* Previous line */
case 'k':
case KEY_UP:
- if (!begin_reached) {
- int passed_end = 0;
-
- back_lines(page_length + 1);
-
- /* We don't call print_page() here but use
- * scrolling to ensure faster screen update.
- * However, 'end_reached' and 'page_length'
- * should still be updated, and 'page' should
- * point to start of next page. This is done
- * by calling get_line() in the following
- * 'for' loop. */
- scrollok(box, TRUE);
- wscrl(box, -1); /* Scroll box region down one line */
- scrollok(box, FALSE);
- page_length = 0;
- for (i = 0; i < boxh; i++) {
- if (!i) {
- /* print first line of page */
- print_line(box, 0, boxw);
- wnoutrefresh(box);
- } else
- /* Called to update 'end_reached' and 'page' */
- get_line();
- if (!passed_end)
- page_length++;
- if (end_reached && !passed_end)
- passed_end = 1;
- }
+ if (begin_reached)
+ break;
- print_position(dialog);
- wmove(dialog, cur_y, cur_x); /* Restore cursor position */
- wrefresh(dialog);
- }
+ back_lines(page_length + 1);
+ refresh_text_box(dialog, box, boxh, boxw, cur_y,
+ cur_x);
break;
case 'B': /* Previous page */
case 'b':
@@ -214,17 +186,12 @@ do_resize:
case 'J': /* Next line */
case 'j':
case KEY_DOWN:
- if (!end_reached) {
- begin_reached = 0;
- scrollok(box, TRUE);
- scroll(box); /* Scroll box region up one line */
- scrollok(box, FALSE);
- print_line(box, boxh - 1, boxw);
- wnoutrefresh(box);
- print_position(dialog);
- wmove(dialog, cur_y, cur_x); /* Restore cursor position */
- wrefresh(dialog);
- }
+ if (end_reached)
+ break;
+
+ back_lines(page_length - 1);
+ refresh_text_box(dialog, box, boxh, boxw, cur_y,
+ cur_x);
break;
case KEY_NPAGE: /* Next page */
case ' ':
--
1.7.7
next prev parent reply other threads:[~2012-08-23 18:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 18:55 [PATCH v2 0/6] menuconfig: jump to search results Benjamin Poirier
2012-08-23 18:55 ` [PATCH v2 1/6] menuconfig: Remove superfluous conditionnal Benjamin Poirier
2012-08-23 18:55 ` [PATCH v2 2/6] menuconfig: Extend dialog_textbox so that it can exit on arbitrary keypresses Benjamin Poirier
2012-08-23 18:55 ` [PATCH v2 3/6] menuconfig: Extend dialog_textbox so that it can return to a scrolled position Benjamin Poirier
2012-08-23 18:55 ` [PATCH v2 4/6] menuconfig: Add jump keys to search results Benjamin Poirier
2012-08-27 12:37 ` Dirk Gouders
2012-08-23 18:55 ` Benjamin Poirier [this message]
2012-08-23 18:55 ` [PATCH v2 6/6] menuconfig: Assign jump keys per-page instead of globally Benjamin Poirier
2012-08-24 15:49 ` [PATCH v2 0/6] menuconfig: jump to search results Borislav Petkov
2012-08-24 17:24 ` Benjamin Poirier
2012-09-27 16:14 ` Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345748108-12206-6-git-send-email-bpoirier@suse.de \
--to=bpoirier@suse.de \
--cc=bp@alien8.de \
--cc=crquan@gmail.com \
--cc=dave@gnu.org \
--cc=lacombar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@profusion.mobi \
--cc=mmarek@suse.cz \
--cc=paul.gortmaker@windriver.com \
--cc=rdunlap@xenotime.net \
--cc=sakiwit@gmail.com \
--cc=udknight@gmail.com \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).