[BACK]Return to line.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Diff for /src/usr.bin/less/line.c between version 1.23 and 1.24

version 1.23, 2019/02/24 04:54:36 version 1.24, 2019/02/26 11:01:54
Line 230 
Line 230 
          */           */
         while (shifted <= shift && from < curr) {          while (shifted <= shift && from < curr) {
                 c = linebuf[from];                  c = linebuf[from];
                 if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) {                  if (ctldisp == OPT_ONPLUS && c == ESC) {
                         /* Keep cumulative effect.  */                          /* Keep cumulative effect.  */
                         linebuf[to] = c;                          linebuf[to] = c;
                         attr[to++] = attr[from++];                          attr[to++] = attr[from++];
Line 463 
Line 463 
 static int  static int
 in_ansi_esc_seq(void)  in_ansi_esc_seq(void)
 {  {
         char *p;          int i;
   
         /*          /*
          * Search backwards for either an ESC (which means we ARE in a seq);           * Search backwards for either an ESC (which means we ARE in a seq);
          * or an end char (which means we're NOT in a seq).           * or an end char (which means we're NOT in a seq).
          */           */
         for (p = &linebuf[curr]; p > linebuf; ) {          for (i = curr - 1; i >= 0; i--) {
                 LWCHAR ch = step_char(&p, -1, linebuf);                  if (linebuf[i] == ESC)
                 if (IS_CSI_START(ch))  
                         return (1);                          return (1);
                 if (!is_ansi_middle(ch))                  if (!is_ansi_middle(linebuf[i]))
                         return (0);                          return (0);
         }          }
         return (0);          return (0);
Line 533 
Line 532 
         if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq()) {          if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq()) {
                 if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {                  if (!is_ansi_end(ch) && !is_ansi_middle(ch)) {
                         /* Remove whole unrecognized sequence.  */                          /* Remove whole unrecognized sequence.  */
                         char *p = &linebuf[curr];  
                         LWCHAR bch;  
                         do {                          do {
                                 bch = step_char(&p, -1, linebuf);                                  curr--;
                         } while (p > linebuf && !IS_CSI_START(bch));                          } while (curr > 0 && linebuf[curr] != ESC);
                         curr = p - linebuf;  
                         return (0);                          return (0);
                 }                  }
                 a = AT_ANSI;    /* Will force re-AT_'ing around it.  */                  a = AT_ANSI;    /* Will force re-AT_'ing around it.  */
                 w = 0;                  w = 0;
         } else if (ctldisp == OPT_ONPLUS && IS_CSI_START(ch)) {          } else if (ctldisp == OPT_ONPLUS && ch == ESC) {
                 a = AT_ANSI;    /* Will force re-AT_'ing around it.  */                  a = AT_ANSI;    /* Will force re-AT_'ing around it.  */
                 w = 0;                  w = 0;
         } else {          } else {
Line 851 
Line 847 
         } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch)) {          } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch)) {
 do_control_char:  do_control_char:
                 if (ctldisp == OPT_ON ||                  if (ctldisp == OPT_ON ||
                     (ctldisp == OPT_ONPLUS && IS_CSI_START(ch))) {                      (ctldisp == OPT_ONPLUS && ch == ESC)) {
                         /*                          /*
                          * Output as a normal character.                           * Output as a normal character.
                          */                           */

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24