[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6405] active xref highlighting
From: |
Gavin D. Smith |
Subject: |
[6405] active xref highlighting |
Date: |
Sat, 11 Jul 2015 00:14:45 +0000 |
Revision: 6405
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6405
Author: gavin
Date: 2015-07-11 00:14:44 +0000 (Sat, 11 Jul 2015)
Log Message:
-----------
active xref highlighting
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/display.c
trunk/info/session.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-07-10 23:36:18 UTC (rev 6404)
+++ trunk/ChangeLog 2015-07-11 00:14:44 UTC (rev 6405)
@@ -1,5 +1,13 @@
2015-07-10 Gavin Smith <address@hidden>
+ * info/display.c (display_update_window_1) <xref-rendition=1>:
+ Highlight the reference that we expect will be followed if the
+ user presses return.
+ * info/session.c (read_and_dispatch) <xref-rendition=On>: Call
+ display_update_one_window after each user command.
+
+2015-07-10 Gavin Smith <address@hidden>
+
* info/variables.c (info_variables): New user variable
'xref-rendition'.
* info/display.c (xref_rendition_p): New variable.
Modified: trunk/info/display.c
===================================================================
--- trunk/info/display.c 2015-07-10 23:36:18 UTC (rev 6404)
+++ trunk/info/display.c 2015-07-11 00:14:44 UTC (rev 6405)
@@ -63,7 +63,7 @@
/* Non-zero if we didn't completely redisplay a window. */
int display_was_interrupted_p = 0;
-/* Update the windows on the display. */
+/* Check each window on the screen, and update it if it needs updating. */
void
display_update_display (void)
{
@@ -75,13 +75,12 @@
signal_block_winch ();
display_was_interrupted_p = 0;
- /* For every window in the list, check contents against the display. */
for (win = windows; win; win = win->next)
{
/* Only re-display visible windows which need updating. */
- if (((win->flags & W_WindowVisible) == 0) ||
- ((win->flags & W_UpdateWindow) == 0) ||
- (win->height == 0))
+ if ((win->flags & W_WindowVisible) == 0
+ || (win->flags & W_UpdateWindow) == 0
+ || win->height == 0)
continue;
display_update_one_window (win);
@@ -315,6 +314,10 @@
a new line, and haven't seen a non-whitespace character yet. */
int ref_leading_whitespace = 0;
+ int cur_line = win->pagetop;
+ int point_in_line = 0; /* Point is on the line being update. */
+ int ref_highlighted = 0;
+
if (highlight_searches_p)
matches = win->matches;
@@ -326,7 +329,7 @@
if (matches)
{
match_index = 0;
- decide_if_in_match (win->line_starts[win->pagetop], &in_match,
+ decide_if_in_match (win->line_starts[cur_line], &in_match,
matches, win->match_count, &match_index);
}
@@ -335,7 +338,7 @@
if (refs)
{
ref_index = 0;
- decide_if_in_reference (win->line_starts[win->pagetop], &in_ref,
+ decide_if_in_reference (win->line_starts[cur_line], &in_ref,
refs, &ref_index);
}
@@ -348,15 +351,27 @@
terminal_goto_xy (0, win->first_row);
}
+ if (win->point >= win->line_starts[cur_line]
+ && win->point < win->line_starts[cur_line + 1])
+ point_in_line = 1;
+ else
+ point_in_line = 0;
+
if (in_ref)
{
terminal_begin_underline ();
ref_seen_in_line = 1;
terminal_goto_xy (0, win->first_row);
+ if (point_in_line)
+ {
+ point_in_line = 0;
+ terminal_begin_standout ();
+ ref_highlighted = 1;
+ }
}
- for (mbi_init (iter, start,
- win->node->contents + win->node->nodelen - start);
+ for (mbi_init (iter, start, win->node->contents + win->node->nodelen -
+ start);
mbi_avail (iter);
mbi_advance (iter))
{
@@ -384,6 +399,8 @@
{
ref_leading_whitespace = 0;
terminal_begin_underline ();
+ if (ref_highlighted)
+ terminal_begin_standout ();
}
if (matches && match_index != win->match_count)
@@ -393,7 +410,7 @@
&in_match, matches, win->match_count,
&match_index);
- if (was_in_match && !in_match)
+ if (was_in_match && !in_match && !ref_highlighted)
{
terminal_end_standout ();
}
@@ -426,6 +443,11 @@
{
ref_leading_whitespace = 0;
terminal_end_underline ();
+ if (ref_highlighted && !in_match)
+ {
+ ref_highlighted = 0;
+ terminal_end_standout ();
+ }
}
else if (!was_in_ref && in_ref)
{
@@ -443,6 +465,19 @@
}
}
terminal_begin_underline ();
+
+ /* Highlight the first reference in the line after the
+ cursor. This is a stronger condition than the code
+ in info_follow_reference_this_line, which can follow
+ a reference before the cursor if none appears after it.
+ Additionally, we fail to highlight a reference if it is
+ split across lines and the cursor isn't on the first line. */
+ if (point_in_line && win->point < refs[ref_index]->end)
+ {
+ point_in_line = 0;
+ terminal_begin_standout ();
+ ref_highlighted = 1;
+ }
}
}
@@ -501,18 +536,29 @@
if (refs)
{
- if (in_ref)
- terminal_end_underline ();
-
/* Check if the next line starts in a match. */
decide_if_in_reference
(mbi_cur_ptr (iter) - win->node->contents,
&in_ref, refs, &ref_index);
+ /* TODO: Something here? */
}
}
fflush (stdout);
}
+ if (refs)
+ {
+ if (in_ref)
+ {
+ /* Don't underline or highlight leading
+ whitespace when a cross-reference is split
+ across lines. */
+ terminal_end_underline ();
+ if (ref_highlighted && !in_match)
+ terminal_end_standout ();
+ }
+ }
+
/* Set for next line. */
match_seen_in_line = in_match;
ref_seen_in_line = in_ref;
@@ -520,6 +566,13 @@
terminal_end_underline ();
++pl_num;
+ cur_line++;
+ if (win->point >= win->line_starts[cur_line]
+ && win->point < win->line_starts[cur_line + 1])
+ point_in_line = 1;
+ else
+ point_in_line = 0;
+
pl_chars = 0;
text_buffer_reset (&tb_printed_line);
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2015-07-10 23:36:18 UTC (rev 6404)
+++ trunk/info/session.c 2015-07-11 00:14:44 UTC (rev 6405)
@@ -27,6 +27,7 @@
#include "search.h"
#include "footnotes.h"
#include "man.h"
+#include "variables.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@@ -236,6 +237,11 @@
if (!info_any_buffered_input_p ())
display_update_display ();
+ /* Some redisplay might be necessary if the cursor has moved and
+ a different reference (or no reference) has to be highlighted. */
+ if (xref_rendition_p)
+ display_update_one_window (active_window);
+
display_cursor_at_point (active_window);
cmd = read_key_sequence (info_keymap, 1, 1, 0, &count);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6405] active xref highlighting,
Gavin D. Smith <=