All of lore.kernel.org
 help / color / mirror / Atom feed
From: sam@ravnborg.org
To: linux-kernel@vger.kernel.org
Cc: Sam Ravnborg <sam@neptun.ravnborg.org>, Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 9/13] kconfig/lxdialog: clear long menu lines
Date: Sun, 01 Oct 2006 12:52:42 +0200	[thread overview]
Message-ID: <1159699967673-git-send-email-sam@ravnborg.org> (raw)
In-Reply-To: <11596999672988-git-send-email-sam@ravnborg.org>

From: Sam Ravnborg <sam@neptun.ravnborg.org>

Menulines that were wider than the available
line width is now properly null terminated.

While at it renamed the variable choice => line_y
so it better reflect the usage in do_print_item().

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/lxdialog/menubox.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index fcd95a9..0d83159 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -63,19 +63,19 @@ static int menu_width, item_x;
 /*
  * Print menu item
  */
-static void do_print_item(WINDOW * win, const char *item, int choice,
+static void do_print_item(WINDOW * win, const char *item, int line_y,
                           int selected, int hotkey)
 {
 	int j;
 	char *menu_item = malloc(menu_width + 1);
 
 	strncpy(menu_item, item, menu_width - item_x);
-	menu_item[menu_width] = 0;
+	menu_item[menu_width - item_x] = '\0';
 	j = first_alpha(menu_item, "YyNnMmHh");
 
 	/* Clear 'residue' of last item */
 	wattrset(win, dlg.menubox.atr);
-	wmove(win, choice, 0);
+	wmove(win, line_y, 0);
 #if OLD_NCURSES
 	{
 		int i;
@@ -86,14 +86,14 @@ #else
 	wclrtoeol(win);
 #endif
 	wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
-	mvwaddstr(win, choice, item_x, menu_item);
+	mvwaddstr(win, line_y, item_x, menu_item);
 	if (hotkey) {
 		wattrset(win, selected ? dlg.tag_key_selected.atr
 			 : dlg.tag_key.atr);
-		mvwaddch(win, choice, item_x + j, menu_item[j]);
+		mvwaddch(win, line_y, item_x + j, menu_item[j]);
 	}
 	if (selected) {
-		wmove(win, choice, item_x + 1);
+		wmove(win, line_y, item_x + 1);
 	}
 	free(menu_item);
 	wrefresh(win);
-- 
1.4.1


  reply	other threads:[~2006-10-01 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-01 10:52 [PATCH 1/13] kconfig/lxdialog: refactor color support sam
2006-10-01 10:52 ` [PATCH 2/13] kconfig/lxdialog: add support for color themes and add blackbg theme sam
2006-10-01 10:52   ` [PATCH 3/13] kconfig/lxdialog: add a new theme bluetitle which is now default sam
2006-10-01 10:52     ` [PATCH 4/13] kconfig/menuconfig: lxdialog is now built-in sam
2006-10-01 10:52       ` [PATCH 5/13] kconfig/lxdialog: let <ESC><ESC> behave as expected sam
2006-10-01 10:52         ` [PATCH 6/13] kconfig/lxdialog: support resize sam
2006-10-01 10:52           ` [PATCH 7/13] kconfig/lxdialog: fix make mrproper sam
2006-10-01 10:52             ` [PATCH 8/13] kbuild: do not build mconf & lxdialog unless needed sam
2006-10-01 10:52               ` sam [this message]
2006-10-01 10:52                 ` [PATCH 10/13] kconfig/menuconfig: do not let ncurses clutter screen on exit sam
2006-10-01 10:52                   ` [PATCH 11/13] kbuild: make modpost processing configurable sam
2006-10-01 10:52                     ` [PATCH 12/13] kconfig: fix saving alternate kconfig file in parent dir sam

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=1159699967673-git-send-email-sam@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@neptun.ravnborg.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.