upgrade to 466 version
[platform/upstream/less.git] / input.c
diff --git a/input.c b/input.c
index b211323..db6c1ff 100755 (executable)
--- a/input.c
+++ b/input.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2012  Mark Nudelman
+ * Copyright (C) 1984-2014  Mark Nudelman
  *
  * You may distribute under the terms of either the GNU General Public
  * License or the Less License, as specified in the README file.
@@ -60,6 +60,7 @@ get_forw_line:
        }
 #if HILITE_SEARCH
        if (hilite_search == OPT_ONPLUS || is_filtering() || status_col)
+       {
                /*
                 * If we are ignoring EOI (command F), only prepare
                 * one line ahead, to avoid getting stuck waiting for
@@ -69,6 +70,8 @@ get_forw_line:
                 */
                prep_hilite(curr_pos, curr_pos + 3*size_linebuf, 
                                ignore_eoi ? 1 : -1);
+               curr_pos = next_unfiltered(curr_pos);
+       }
 #endif
        if (ch_seek(curr_pos))
        {
@@ -439,19 +442,22 @@ set_attnpos(pos)
                {
                        c = ch_forw_get();
                        if (c == EOI)
-                               return;
-                       if (c != '\n' && c != '\r')
                                break;
+                       if (c == '\n' || c == '\r')
+                       {
+                               (void) ch_back_get();
+                               break;
+                       }
                        pos++;
                }
+               end_attnpos = pos;
+               for (;;)
+               {
+                       c = ch_back_get();
+                       if (c == EOI || c == '\n' || c == '\r')
+                               break;
+                       pos--;
+               }
        }
        start_attnpos = pos;
-       for (;;)
-       {
-               c = ch_forw_get();
-               pos++;
-               if (c == EOI || c == '\n' || c == '\r')
-                       break;
-       }
-       end_attnpos = pos;
 }