mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 10:08:47 +00:00
Now that a UTF-8-capable puts function exists, use it for printing strings in
choice/more modes - lines with UTF-8 now display properly in find-window results.
This commit is contained in:
parent
3ec8efc803
commit
a03ae97fbf
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-choose.c,v 1.14 2009-05-04 17:58:27 nicm Exp $ */
|
/* $OpenBSD: window-choose.c,v 1.2 2009/06/24 23:00:31 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -285,10 +285,12 @@ window_choose_write_line(
|
|||||||
struct window_choose_mode_item *item;
|
struct window_choose_mode_item *item;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
|
int utf8flag;
|
||||||
|
|
||||||
if (data->callback == NULL)
|
if (data->callback == NULL)
|
||||||
fatalx("called before callback assigned");
|
fatalx("called before callback assigned");
|
||||||
|
|
||||||
|
utf8flag = options_get_number(&wp->window->options, "utf8");
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
if (data->selected == data->top + py) {
|
if (data->selected == data->top + py) {
|
||||||
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
||||||
@ -299,12 +301,11 @@ window_choose_write_line(
|
|||||||
screen_write_cursormove(ctx, 0, py);
|
screen_write_cursormove(ctx, 0, py);
|
||||||
if (data->top + py < ARRAY_LENGTH(&data->list)) {
|
if (data->top + py < ARRAY_LENGTH(&data->list)) {
|
||||||
item = &ARRAY_ITEM(&data->list, data->top + py);
|
item = &ARRAY_ITEM(&data->list, data->top + py);
|
||||||
screen_write_puts(
|
screen_write_nputs(
|
||||||
ctx, &gc, "%.*s", (int) screen_size_x(s), item->name);
|
ctx, screen_size_x(s) - 1, &gc, utf8flag, "%s", item->name);
|
||||||
}
|
}
|
||||||
while (s->cx < screen_size_x(s))
|
while (s->cx < screen_size_x(s))
|
||||||
screen_write_putc(ctx, &gc, ' ');
|
screen_write_putc(ctx, &gc, ' ');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-more.c,v 1.29 2009-02-13 21:39:45 nicm Exp $ */
|
/* $OpenBSD: window-more.c,v 1.2 2009/06/24 23:00:31 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -175,7 +175,9 @@ window_more_write_line(
|
|||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
char *msg, hdr[32];
|
char *msg, hdr[32];
|
||||||
size_t size;
|
size_t size;
|
||||||
|
int utf8flag;
|
||||||
|
|
||||||
|
utf8flag = options_get_number(&wp->window->options, "utf8");
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
|
|
||||||
if (py == 0) {
|
if (py == 0) {
|
||||||
@ -193,8 +195,8 @@ window_more_write_line(
|
|||||||
screen_write_cursormove(ctx, 0, py);
|
screen_write_cursormove(ctx, 0, py);
|
||||||
if (data->top + py < ARRAY_LENGTH(&data->list)) {
|
if (data->top + py < ARRAY_LENGTH(&data->list)) {
|
||||||
msg = ARRAY_ITEM(&data->list, data->top + py);
|
msg = ARRAY_ITEM(&data->list, data->top + py);
|
||||||
screen_write_puts(
|
screen_write_nputs(
|
||||||
ctx, &gc, "%.*s", (int) (screen_size_x(s) - size), msg);
|
ctx, screen_size_x(s) - 1 - size, &gc, utf8flag, "%s", msg);
|
||||||
}
|
}
|
||||||
while (s->cx < screen_size_x(s) - size)
|
while (s->cx < screen_size_x(s) - size)
|
||||||
screen_write_putc(ctx, &gc, ' ');
|
screen_write_putc(ctx, &gc, ' ');
|
||||||
|
Loading…
Reference in New Issue
Block a user