WEdit::num_widget_lines and WEdit::num_widget_columns are removed.
[midnight-commander.git] / src / editor / editdraw.c
blobfc848098d47774e999df458db0a017c826699240
1 /* editor text drawing.
3 Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006,
4 2007 Free Software Foundation, Inc.
6 Authors: 1996, 1997 Paul Sheer
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA.
24 /** \file
25 * \brief Source: editor text drawing
26 * \author Paul Sheer
27 * \date 1996, 1997
30 #include <config.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <stdarg.h>
34 #include <sys/types.h>
35 #include <unistd.h>
36 #include <string.h>
37 #include <ctype.h>
38 #include <errno.h>
39 #include <sys/stat.h>
41 #include "lib/global.h"
42 #include "lib/tty/tty.h" /* tty_printf() */
43 #include "lib/tty/key.h" /* is_idle() */
44 #include "lib/skin.h"
45 #include "lib/strutil.h" /* utf string functions */
46 #include "lib/util.h" /* is_printable() */
47 #include "lib/widget.h" /* buttonbar_redraw() */
48 #include "lib/charsets.h"
50 #include "src/main.h" /* source_codepage */
51 #include "src/setup.h" /* edit_tab_spacing */
53 #include "edit-impl.h"
54 #include "edit-widget.h"
56 /*** global variables ****************************************************************************/
58 /* Toggles statusbar draw style */
59 int simple_statusbar = 0;
61 int visible_tabs = 1, visible_tws = 1;
63 /*** file scope macro definitions ****************************************************************/
65 #define MAX_LINE_LEN 1024
67 /* Text styles */
68 #define MOD_ABNORMAL (1 << 8)
69 #define MOD_BOLD (1 << 9)
70 #define MOD_MARKED (1 << 10)
71 #define MOD_CURSOR (1 << 11)
72 #define MOD_WHITESPACE (1 << 12)
74 #define FONT_OFFSET_X 0
75 #define FONT_OFFSET_Y 0
76 #define FIXED_FONT 1
77 #define FONT_PIX_PER_LINE 1
78 #define FONT_MEAN_WIDTH 1
80 #define edit_move(x,y) widget_move(edit, y, x);
82 #define key_pending(x) (!is_idle())
85 /*** file scope type declarations ****************************************************************/
87 struct line_s
89 unsigned int ch;
90 unsigned int style;
93 /*** file scope variables ************************************************************************/
95 /*** file scope functions ************************************************************************/
96 /* --------------------------------------------------------------------------------------------- */
98 static inline void
99 status_string (WEdit * edit, char *s, int w)
101 char byte_str[16];
102 unsigned char cur_byte = 0;
103 unsigned int cur_utf = 0;
104 int cw = 1;
107 * If we are at the end of file, print <EOF>,
108 * otherwise print the current character as is (if printable),
109 * as decimal and as hex.
111 if (edit->curs1 < edit->last_byte)
113 if (!edit->utf8)
115 cur_byte = edit_get_byte (edit, edit->curs1);
117 g_snprintf (byte_str, sizeof (byte_str), "%4d 0x%03X",
118 (int) cur_byte, (unsigned) cur_byte);
120 else
122 cur_utf = edit_get_utf (edit, edit->curs1, &cw);
123 if (cw > 0)
125 g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
126 (unsigned) cur_utf, (unsigned) cur_utf);
128 else
130 cur_utf = edit_get_byte (edit, edit->curs1);
131 g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
132 (int) cur_utf, (unsigned) cur_utf);
137 else
139 strcpy (byte_str, "<EOF> ");
142 /* The field lengths just prevent the status line from shortening too much */
143 if (simple_statusbar)
144 g_snprintf (s, w,
145 "%c%c%c%c %3ld %5ld/%ld %6ld/%ld %s %s",
146 edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
147 edit->modified ? 'M' : '-',
148 edit->macro_i < 0 ? '-' : 'R',
149 edit->overwrite == 0 ? '-' : 'O',
150 edit->curs_col + edit->over_col,
151 edit->curs_line + 1,
152 edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
153 #ifdef HAVE_CHARSET
154 source_codepage >= 0 ? get_codepage_id (source_codepage) : ""
155 #else
157 #endif
159 else
160 g_snprintf (s, w,
161 "[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb) %s %s",
162 edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
163 edit->modified ? 'M' : '-',
164 edit->macro_i < 0 ? '-' : 'R',
165 edit->overwrite == 0 ? '-' : 'O',
166 edit->curs_col + edit->over_col,
167 edit->start_line + 1,
168 edit->curs_row,
169 edit->curs_line + 1,
170 edit->total_lines + 1, edit->curs1, edit->last_byte, byte_str,
171 #ifdef HAVE_CHARSET
172 source_codepage >= 0 ? get_codepage_id (source_codepage) : ""
173 #else
175 #endif
179 /* --------------------------------------------------------------------------------------------- */
181 static inline void
182 printwstr (const char *s, int len)
184 if (len > 0)
185 tty_printf ("%-*.*s", len, len, s);
188 /* --------------------------------------------------------------------------------------------- */
190 static inline void
191 print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
192 long end_col, struct line_s line[], char *status, int bookmarked)
194 struct line_s *p;
196 int x = start_col_real;
197 int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
198 int y = row + EDIT_TEXT_VERTICAL_OFFSET;
199 int cols_to_skip = abs (x);
200 int i;
202 tty_setcolor (EDITOR_NORMAL_COLOR);
203 if (bookmarked != 0)
204 tty_setcolor (bookmarked);
206 if (!show_right_margin)
208 tty_draw_hline (edit->widget.y + y, edit->widget.x + x1, ' ', end_col + 1 - start_col);
210 else if (edit->start_col < option_word_wrap_line_length)
212 tty_draw_hline (edit->widget.y + y,
213 edit->widget.x + x1, ' ', option_word_wrap_line_length - edit->start_col);
215 tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
216 tty_draw_hline (edit->widget.y + y,
217 edit->widget.x + x1 + option_word_wrap_line_length + edit->start_col,
218 ' ', end_col + 1 - start_col);
221 if (option_line_state)
223 for (i = 0; i < LINE_STATE_WIDTH; i++)
224 if (status[i] == '\0')
225 status[i] = ' ';
227 tty_setcolor (LINE_STATE_COLOR);
228 edit_move (x1 + FONT_OFFSET_X - option_line_state_width, y + FONT_OFFSET_Y);
229 tty_print_string (status);
232 edit_move (x1 + FONT_OFFSET_X, y + FONT_OFFSET_Y);
233 p = line;
234 i = 1;
235 while (p->ch)
237 int style;
238 unsigned int textchar;
239 int color;
241 if (cols_to_skip)
243 p++;
244 cols_to_skip--;
245 continue;
248 style = p->style & 0xFF00;
249 textchar = p->ch;
250 color = p->style >> 16;
252 if (style & MOD_ABNORMAL)
254 /* Non-printable - use black background */
255 color = 0;
258 if (style & MOD_WHITESPACE)
260 if (style & MOD_MARKED)
262 textchar = ' ';
263 tty_setcolor (EDITOR_MARKED_COLOR);
265 else
267 #if 0
268 if (color != EDITOR_NORMAL_COLOR)
270 textchar = ' ';
271 tty_lowlevel_setcolor (color);
273 else
274 #endif
275 tty_setcolor (EDITOR_WHITESPACE_COLOR);
278 else
280 if (style & MOD_BOLD)
282 tty_setcolor (EDITOR_BOLD_COLOR);
284 else if (style & MOD_MARKED)
286 tty_setcolor (EDITOR_MARKED_COLOR);
288 else
290 tty_lowlevel_setcolor (color);
293 if (show_right_margin)
295 if (i > option_word_wrap_line_length + edit->start_col)
296 tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
297 i++;
299 tty_print_anychar (textchar);
300 p++;
304 /* --------------------------------------------------------------------------------------------- */
305 /** b is a pointer to the beginning of the line */
307 static void
308 edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_col)
310 struct line_s line[MAX_LINE_LEN];
311 struct line_s *p = line;
313 long m1 = 0, m2 = 0, q, c1, c2;
314 int col, start_col_real;
315 unsigned int c;
316 int color;
317 int abn_style;
318 int i;
319 int utf8lag = 0;
320 unsigned int cur_line = 0;
321 int book_mark = 0;
322 char line_stat[LINE_STATE_WIDTH + 1];
324 if (row > edit->widget.lines - EDIT_TEXT_VERTICAL_OFFSET)
325 return;
327 if (book_mark_query_color (edit, edit->start_line + row, BOOK_MARK_COLOR))
328 book_mark = BOOK_MARK_COLOR;
329 else if (book_mark_query_color (edit, edit->start_line + row, BOOK_MARK_FOUND_COLOR))
330 book_mark = BOOK_MARK_FOUND_COLOR;
332 if (book_mark)
333 abn_style = book_mark << 16;
334 else
335 abn_style = MOD_ABNORMAL;
337 end_col -= EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
339 edit_get_syntax_color (edit, b - 1, &color);
340 q = edit_move_forward3 (edit, b, start_col - edit->start_col, 0);
341 start_col_real = (col = (int) edit_move_forward3 (edit, b, 0, q)) + edit->start_col;
342 if (option_line_state)
344 cur_line = edit->start_line + row;
345 if (cur_line <= (unsigned int) edit->total_lines)
347 g_snprintf (line_stat, LINE_STATE_WIDTH + 1, "%7i ", cur_line + 1);
349 else
351 memset (line_stat, ' ', LINE_STATE_WIDTH);
352 line_stat[LINE_STATE_WIDTH] = '\0';
354 if (book_mark_query_color (edit, cur_line, BOOK_MARK_COLOR))
356 g_snprintf (line_stat, 2, "*");
360 if (col + 16 > -edit->start_col)
362 eval_marks (edit, &m1, &m2);
364 if (row <= edit->total_lines - edit->start_line)
366 long tws = 0;
367 if (tty_use_colors () && visible_tws)
369 tws = edit_eol (edit, b);
370 while (tws > b && ((c = edit_get_byte (edit, tws - 1)) == ' ' || c == '\t'))
371 tws--;
374 while (col <= end_col - edit->start_col)
376 int cw = 1;
378 p->ch = 0;
379 p->style = 0;
380 if (q == edit->curs1)
381 p->style |= MOD_CURSOR;
382 if (q >= m1 && q < m2)
384 if (edit->column_highlight)
386 int x;
387 x = edit_move_forward3 (edit, b, 0, q);
388 c1 = min (edit->column1, edit->column2);
389 c2 = max (edit->column1, edit->column2);
390 if (x >= c1 && x < c2)
391 p->style |= MOD_MARKED;
393 else
394 p->style |= MOD_MARKED;
396 if (q == edit->bracket)
397 p->style |= MOD_BOLD;
398 if (q >= edit->found_start && q < edit->found_start + edit->found_len)
399 p->style |= MOD_BOLD;
401 if (!edit->utf8)
403 c = edit_get_byte (edit, q);
405 else
407 c = edit_get_utf (edit, q, &cw);
409 /* we don't use bg for mc - fg contains both */
410 if (book_mark)
412 p->style |= book_mark << 16;
414 else
416 edit_get_syntax_color (edit, q, &color);
417 p->style |= color << 16;
419 switch (c)
421 case '\n':
422 col = (end_col + utf8lag) - edit->start_col + 1; /* quit */
423 break;
424 case '\t':
425 i = TAB_SIZE - ((int) col % TAB_SIZE);
426 col += i;
427 if (tty_use_colors () &&
428 ((visible_tabs || (visible_tws && q >= tws)) && enable_show_tabs_tws))
430 if (p->style & MOD_MARKED)
431 c = p->style;
432 else if (book_mark)
433 c |= book_mark << 16;
434 else
435 c = p->style | MOD_WHITESPACE;
436 if (i > 2)
438 p->ch = '<';
439 p->style = c;
440 p++;
441 while (--i > 1)
443 p->ch = '-';
444 p->style = c;
445 p++;
447 p->ch = '>';
448 p->style = c;
449 p++;
451 else if (i > 1)
453 p->ch = '<';
454 p->style = c;
455 p++;
456 p->ch = '>';
457 p->style = c;
458 p++;
460 else
462 p->ch = '>';
463 p->style = c;
464 p++;
467 else if (tty_use_colors () && visible_tws && q >= tws && enable_show_tabs_tws)
469 p->ch = '.';
470 p->style |= MOD_WHITESPACE;
471 c = p->style & ~MOD_CURSOR;
472 p++;
473 while (--i)
475 p->ch = ' ';
476 p->style = c;
477 p++;
480 else
482 p->ch |= ' ';
483 c = p->style & ~MOD_CURSOR;
484 p++;
485 while (--i)
487 p->ch = ' ';
488 p->style = c;
489 p++;
492 break;
493 case ' ':
494 if (tty_use_colors () && visible_tws && q >= tws && enable_show_tabs_tws)
496 p->ch = '.';
497 p->style |= MOD_WHITESPACE;
498 p++;
499 col++;
500 break;
502 /* fallthrough */
503 default:
504 #ifdef HAVE_CHARSET
505 if (utf8_display)
507 if (!edit->utf8)
509 c = convert_from_8bit_to_utf_c ((unsigned char) c, edit->converter);
512 else if (edit->utf8)
513 c = convert_from_utf_to_current_c (c, edit->converter);
514 else
515 #endif
516 c = convert_to_display_c (c);
518 /* Caret notation for control characters */
519 if (c < 32)
521 p->ch = '^';
522 p->style = abn_style;
523 p++;
524 p->ch = c + 0x40;
525 p->style = abn_style;
526 p++;
527 col += 2;
528 break;
530 if (c == 127)
532 p->ch = '^';
533 p->style = abn_style;
534 p++;
535 p->ch = '?';
536 p->style = abn_style;
537 p++;
538 col += 2;
539 break;
541 if (!edit->utf8)
543 if ((utf8_display && g_unichar_isprint (c)) ||
544 (!utf8_display && is_printable (c)))
546 p->ch = c;
547 p++;
549 else
551 p->ch = '.';
552 p->style = abn_style;
553 p++;
556 else
558 if (g_unichar_isprint (c))
560 p->ch = c;
561 p++;
563 else
565 p->ch = '.';
566 p->style = abn_style;
567 p++;
570 col++;
571 break;
572 } /* case */
574 q++;
575 if (cw > 1)
577 q += cw - 1;
582 else
584 start_col_real = start_col = 0;
587 p->ch = '\0';
589 print_to_widget (edit, row, start_col, start_col_real, end_col, line, line_stat, book_mark);
592 /* --------------------------------------------------------------------------------------------- */
594 static inline void
595 edit_draw_this_char (WEdit * edit, long curs, long row)
597 int b = edit_bol (edit, curs);
598 edit_draw_this_line (edit, b, row, 0, edit->widget.cols - 1);
601 /* --------------------------------------------------------------------------------------------- */
602 /** cursor must be in screen for other than REDRAW_PAGE passed in force */
604 static inline void
605 render_edit_text (WEdit * edit, long start_row, long start_column, long end_row, long end_column)
607 long row = 0, curs_row;
608 static long prev_curs_row = 0;
609 static long prev_curs = 0;
611 int force = edit->force;
612 long b;
615 * If the position of the page has not moved then we can draw the cursor
616 * character only. This will prevent line flicker when using arrow keys.
618 if ((!(force & REDRAW_CHAR_ONLY)) || (force & REDRAW_PAGE))
620 if (!(force & REDRAW_IN_BOUNDS))
621 { /* !REDRAW_IN_BOUNDS means to ignore bounds and redraw whole rows */
622 start_row = 0;
623 end_row = edit->widget.lines - 1;
624 start_column = 0;
625 end_column = edit->widget.cols - 1;
627 if (force & REDRAW_PAGE)
629 row = start_row;
630 b = edit_move_forward (edit, edit->start_display, start_row, 0);
631 while (row <= end_row)
633 if (key_pending (edit))
634 return;
635 edit_draw_this_line (edit, b, row, start_column, end_column);
636 b = edit_move_forward (edit, b, 1, 0);
637 row++;
640 else
642 curs_row = edit->curs_row;
644 if (force & REDRAW_BEFORE_CURSOR)
646 if (start_row < curs_row)
648 long upto = curs_row - 1 <= end_row ? curs_row - 1 : end_row;
649 row = start_row;
650 b = edit->start_display;
651 while (row <= upto)
653 if (key_pending (edit))
654 return;
655 edit_draw_this_line (edit, b, row, start_column, end_column);
656 b = edit_move_forward (edit, b, 1, 0);
660 /* if (force & REDRAW_LINE) ---> default */
661 b = edit_bol (edit, edit->curs1);
662 if (curs_row >= start_row && curs_row <= end_row)
664 if (key_pending (edit))
665 return;
666 edit_draw_this_line (edit, b, curs_row, start_column, end_column);
668 if (force & REDRAW_AFTER_CURSOR)
670 if (end_row > curs_row)
672 row = curs_row + 1 < start_row ? start_row : curs_row + 1;
673 b = edit_move_forward (edit, b, 1, 0);
674 while (row <= end_row)
676 if (key_pending (edit))
677 return;
678 edit_draw_this_line (edit, b, row, start_column, end_column);
679 b = edit_move_forward (edit, b, 1, 0);
680 row++;
684 if (force & REDRAW_LINE_ABOVE && curs_row >= 1)
686 row = curs_row - 1;
687 b = edit_move_backward (edit, edit_bol (edit, edit->curs1), 1);
688 if (row >= start_row && row <= end_row)
690 if (key_pending (edit))
691 return;
692 edit_draw_this_line (edit, b, row, start_column, end_column);
695 if (force & REDRAW_LINE_BELOW && row < edit->widget.lines - 1)
697 row = curs_row + 1;
698 b = edit_bol (edit, edit->curs1);
699 b = edit_move_forward (edit, b, 1, 0);
700 if (row >= start_row && row <= end_row)
702 if (key_pending (edit))
703 return;
704 edit_draw_this_line (edit, b, row, start_column, end_column);
709 else
711 if (prev_curs_row < edit->curs_row)
712 { /* with the new text highlighting, we must draw from the top down */
713 edit_draw_this_char (edit, prev_curs, prev_curs_row);
714 edit_draw_this_char (edit, edit->curs1, edit->curs_row);
716 else
718 edit_draw_this_char (edit, edit->curs1, edit->curs_row);
719 edit_draw_this_char (edit, prev_curs, prev_curs_row);
723 edit->force = 0;
725 prev_curs_row = edit->curs_row;
726 prev_curs = edit->curs1;
729 /* --------------------------------------------------------------------------------------------- */
731 static inline void
732 edit_render (WEdit * edit, int page, int row_start, int col_start, int row_end, int col_end)
734 if (page) /* if it was an expose event, 'page' would be set */
735 edit->force |= REDRAW_PAGE | REDRAW_IN_BOUNDS;
737 if (edit->force & REDRAW_COMPLETELY)
738 buttonbar_redraw (find_buttonbar (edit->widget.owner));
739 render_edit_text (edit, row_start, col_start, row_end, col_end);
741 * edit->force != 0 means a key was pending and the redraw
742 * was halted, so next time we must redraw everything in case stuff
743 * was left undrawn from a previous key press.
745 if (edit->force)
746 edit->force |= REDRAW_PAGE;
749 /* --------------------------------------------------------------------------------------------- */
750 /*** public functions ****************************************************************************/
751 /* --------------------------------------------------------------------------------------------- */
753 /** Draw the status line at the top of the widget. The size of the filename
754 * field varies depending on the width of the screen and the length of
755 * the filename. */
756 void
757 edit_status (WEdit * edit)
759 const int w = edit->widget.cols;
760 const size_t status_size = w + 1;
761 char *const status = g_malloc (status_size);
762 int status_len;
763 const char *fname = "";
764 int fname_len;
765 const int gap = 3; /* between the filename and the status */
766 const int right_gap = 5; /* at the right end of the screen */
767 const int preferred_fname_len = 16;
769 status_string (edit, status, status_size);
770 status_len = (int) str_term_width1 (status);
772 if (edit->filename)
773 fname = edit->filename;
774 fname_len = str_term_width1 (fname);
775 if (fname_len < preferred_fname_len)
776 fname_len = preferred_fname_len;
778 if (fname_len + gap + status_len + right_gap >= w)
780 if (preferred_fname_len + gap + status_len + right_gap >= w)
781 fname_len = preferred_fname_len;
782 else
783 fname_len = w - (gap + status_len + right_gap);
784 fname = str_trunc (fname, fname_len);
787 widget_move (edit, 0, 0);
788 tty_setcolor (STATUSBAR_COLOR);
789 printwstr (fname, fname_len + gap);
790 printwstr (status, w - (fname_len + gap));
792 if (simple_statusbar && edit->widget.cols > 30)
794 size_t percent;
795 if (edit->total_lines + 1 != 0)
796 percent = (edit->curs_line + 1) * 100 / (edit->total_lines + 1);
797 else
798 percent = 100;
799 widget_move (edit, 0, edit->widget.cols - 5);
800 tty_printf (" %3d%%", percent);
803 g_free (status);
806 /* --------------------------------------------------------------------------------------------- */
807 /** this scrolls the text so that cursor is on the screen */
808 void
809 edit_scroll_screen_over_cursor (WEdit * edit)
811 int p;
812 int outby;
813 int b_extreme, t_extreme, l_extreme, r_extreme;
815 if (edit->widget.lines <= 0 || edit->widget.cols <= 0)
816 return;
818 edit->widget.cols -= EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
819 edit->widget.lines -= EDIT_TEXT_VERTICAL_OFFSET - 1;
821 r_extreme = EDIT_RIGHT_EXTREME;
822 l_extreme = EDIT_LEFT_EXTREME;
823 b_extreme = EDIT_BOTTOM_EXTREME;
824 t_extreme = EDIT_TOP_EXTREME;
825 if (edit->found_len)
827 b_extreme = max (edit->widget.lines / 4, b_extreme);
828 t_extreme = max (edit->widget.lines / 4, t_extreme);
830 if (b_extreme + t_extreme + 1 > edit->widget.lines)
832 int n;
833 n = b_extreme + t_extreme;
834 b_extreme = (b_extreme * (edit->widget.lines - 1)) / n;
835 t_extreme = (t_extreme * (edit->widget.lines - 1)) / n;
837 if (l_extreme + r_extreme + 1 > edit->widget.cols)
839 int n;
840 n = l_extreme + t_extreme;
841 l_extreme = (l_extreme * (edit->widget.cols - 1)) / n;
842 r_extreme = (r_extreme * (edit->widget.cols - 1)) / n;
844 p = edit_get_col (edit) + edit->over_col;
845 edit_update_curs_row (edit);
846 outby = p + edit->start_col - edit->widget.cols + 1 + (r_extreme + edit->found_len);
847 if (outby > 0)
848 edit_scroll_right (edit, outby);
849 outby = l_extreme - p - edit->start_col;
850 if (outby > 0)
851 edit_scroll_left (edit, outby);
852 p = edit->curs_row;
853 outby = p - edit->widget.lines + 1 + b_extreme;
854 if (outby > 0)
855 edit_scroll_downward (edit, outby);
856 outby = t_extreme - p;
857 if (outby > 0)
858 edit_scroll_upward (edit, outby);
859 edit_update_curs_row (edit);
861 edit->widget.lines += EDIT_TEXT_VERTICAL_OFFSET - 1;
862 edit->widget.cols += EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
865 /* --------------------------------------------------------------------------------------------- */
867 void
868 edit_render_keypress (WEdit * edit)
870 edit_render (edit, 0, 0, 0, 0, 0);
873 /* --------------------------------------------------------------------------------------------- */