File src/video.c changed (mode: 100644) (index 2649a00..c80ac5f) |
3 |
3 |
* |
* |
4 |
4 |
* Copyright (C) 1999 Przemek Borys <pborys@dione.ids.pl> |
* Copyright (C) 1999 Przemek Borys <pborys@dione.ids.pl> |
5 |
5 |
* Copyright (C) 2005 Bas Zoetekouw <bas@debian.org> |
* Copyright (C) 2005 Bas Zoetekouw <bas@debian.org> |
|
6 |
|
* Copyright 2005 Nathanael Nerode <neroden@gcc.gnu.org> |
6 |
7 |
* |
* |
7 |
8 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
8 |
9 |
* it under the terms of version 2 of the GNU General Public License as |
* it under the terms of version 2 of the GNU General Public License as |
|
... |
... |
showscreen(char **message, char *type, long lines, long pos, long cursor, int co |
120 |
121 |
/* |
/* |
121 |
122 |
* prints a line, taking care for the horizontal scrolling. |
* prints a line, taking care for the horizontal scrolling. |
122 |
123 |
* if the string fits in the window, it is drawn. If not, |
* if the string fits in the window, it is drawn. If not, |
123 |
|
* it is either cut, or completely ommited. |
|
|
124 |
|
* it is either cut, or completely omitted. |
124 |
125 |
*/ |
*/ |
125 |
126 |
void |
void |
126 |
127 |
info_addstr(int y, int x, char *txt, int column, int txtlen) |
info_addstr(int y, int x, char *txt, int column, int txtlen) |
127 |
128 |
{ |
{ |
|
129 |
|
int maxy, maxx; |
|
130 |
|
getmaxyx(stdscr, maxy, maxx); |
|
131 |
|
/* Use maxx and mvaddnstr to force clipping. |
|
132 |
|
* Fairly blunt instrument, but the best I could come up with. |
|
133 |
|
* Breaks in the presence of tabs; I don't see how to handle them. */ |
128 |
134 |
if (x>column) |
if (x>column) |
129 |
|
mvaddstr(y,x-column,txt); |
|
|
135 |
|
mvaddnstr(y,x-column,txt, maxx-(x-column) ); |
130 |
136 |
else if (x+txtlen>column) |
else if (x+txtlen>column) |
131 |
|
mvaddstr(y,0,txt+(column-x)); |
|
|
137 |
|
mvaddnstr(y,0,txt+(column-x), maxx ); |
|
138 |
|
#ifdef __DEBUG__ |
|
139 |
|
refresh(); |
|
140 |
|
#endif /* __DEBUG__ */ |
132 |
141 |
} |
} |
133 |
142 |
|
|
134 |
143 |
void |
void |