[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5868] fix cursor positioning for tabs entered in echo area
From: |
Gavin D. Smith |
Subject: |
[5868] fix cursor positioning for tabs entered in echo area |
Date: |
Thu, 09 Oct 2014 15:07:51 +0000 |
Revision: 5868
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5868
Author: gavin
Date: 2014-10-09 15:07:50 +0000 (Thu, 09 Oct 2014)
Log Message:
-----------
fix cursor positioning for tabs entered in echo area
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/echo-area.c
trunk/info/window.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-10-09 13:07:23 UTC (rev 5867)
+++ trunk/ChangeLog 2014-10-09 15:07:50 UTC (rev 5868)
@@ -7,6 +7,14 @@
elsewhere.
* info/t/no-index.sh, info/t/index-completing.sh: New tests.
+ * info/echo-area.c (info_read_and_dispatch_in_echo_area):
+ Recalculate line map after each user command.
+ (input_line, input_line_prompt): Comments added.
+ [FD_SET && hpux, FD_SET && !hpux] (fd_set_cast): Remove unused
+ macro.
+ * info/window.c (window_point_to_column): Return left-most
+ column for multi-column characters.
+
2014-10-08 Gavin Smith <address@hidden>
* info/indices.c (info_index_search): Don't duplicate a string
Modified: trunk/info/echo-area.c
===================================================================
--- trunk/info/echo-area.c 2014-10-09 13:07:23 UTC (rev 5867)
+++ trunk/info/echo-area.c 2014-10-09 15:07:50 UTC (rev 5868)
@@ -25,14 +25,6 @@
#include "info-utils.h"
#include "echo-area.h"
-#if defined (FD_SET)
-# if defined (hpux)
-# define fd_set_cast(x) (int *)(x)
-# else
-# define fd_set_cast(x) (fd_set *)(x)
-# endif /* !hpux */
-#endif /* FD_SET */
-
/* Non-zero means that C-g was used to quit reading input. */
int info_aborted_echo_area = 0;
@@ -47,11 +39,15 @@
int echo_area_last_command_was_kill = 0;
/* Variables which hold on to the current state of the input line. */
-static char input_line[1 + EA_MAX_INPUT];
+static char input_line[1 + EA_MAX_INPUT]; /* Contents of echo area, including
+ any prompt. */
+static int input_line_point; /* Offset into input_line of point */
+static int input_line_beg; /* End of prompt, and start of user input. */
+static int input_line_end; /* End of user input. */
+
+/* Current prompt. FIXME: This variable is not actually used for anything. */
static const char *input_line_prompt;
-static int input_line_point;
-static int input_line_beg;
-static int input_line_end;
+
static NODE input_line_node = {
NULL, NULL, NULL, input_line,
EA_MAX_INPUT, 0, N_IsInternal
@@ -180,6 +176,12 @@
if (!info_any_buffered_input_p ())
display_update_display ();
+ /* Mark the line map as invalid. This causes window_compute_line_map to
+ recalculate it when it is called via display_cursor_at_point below.
+ Otherwise adding or removing multi-column characters (like tabs) lead
+ to incorrect cursor positioning. */
+ the_echo_area->line_map.used = 0;
+
display_cursor_at_point (active_window);
info_initialize_numeric_arg ();
Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-10-09 13:07:23 UTC (rev 5867)
+++ trunk/info/window.c 2014-10-09 15:07:50 UTC (rev 5868)
@@ -1456,8 +1456,8 @@
/* Translate the value of POINT into a column number. If NP is given
store there the value of point corresponding to the beginning of a
- multibyte character in this column.
- */
+ multibyte character in this column. If the character at POINT spans
+ multiple columns (e.g. a tab), return the leftmost column it occupies. */
int
window_point_to_column (WINDOW *win, long point, long *np)
{
@@ -1467,10 +1467,10 @@
if (!win->line_map.map || point < win->line_map.map[0])
return 0;
for (i = 0; i < win->line_map.used; i++)
- if (win->line_map.map[i] > point)
+ if (win->line_map.map[i] >= point)
break;
if (np)
- *np = win->line_map.map[i-1];
- return i - 1;
+ *np = win->line_map.map[i];
+ return i;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5868] fix cursor positioning for tabs entered in echo area,
Gavin D. Smith <=