To: "Krishna, Hari" <[email protected]>
Cc: [email protected]
In-Reply-To: <DE48F7C3B4FED011849E00805FC185C801253818@skate>
Subject: patch 5.4o.7 (was: another syntax bug ?)
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Hari Krishna wrote:

> A small insignificant bug, but thought will notify you. If you select
> part of the text and press ^C, the selection is removed, but at the same
> time some of the syntax highlighting goes off most notably for comments.
> It is restored if the screen is redrawn.

I see.  Because CTRL-C has been hit, "got_int" will be set.  Recently I have
added a check for got-int in regexp execution, so that it can be interrupted.
But this now makes all regexp work fail.  Thus syntax highlighting doesn't
work when the screen is updated while "got_int" is still set.


Patch 5.4o.7
Problem:    When hitting CTRL-C in Visual mode, the syntax highlighting was
           removed. (Hari Krishna)
Solution:   Reset got-int while redrawing the screen and restore it after
           that.
Files:      src/screen.c


*** ../vim-5.4o/src/screen.c    Sun Jul 11 20:10:35 1999
--- src/screen.c        Wed Jul 14 22:21:32 1999
***************
*** 1113,1118 ****
--- 1113,1121 ----
 #ifdef LINEBREAK
     int                   need_showbreak = FALSE;
 #endif
+ #if defined(SYNTAX_HL) || defined(EXTRA_SEARCH)
+     int                   save_got_int;
+ #endif

     if (startrow > endrow)            /* past the end already! */
       return startrow;
***************
*** 1134,1139 ****
--- 1137,1147 ----
 #else
     extra_check = 0;
 #endif
+ #if defined(SYNTAX_HL) || defined(EXTRA_SEARCH)
+     /* reset got_int, otherwise regexp won't work */
+     save_got_int = got_int;
+     got_int = 0;
+ #endif
 #ifdef SYNTAX_HL
     if (syntax_present(wp->w_buffer))
     {
***************
*** 1834,1839 ****
--- 1842,1853 ----
           break;
       }
     }
+
+ #if defined(SYNTAX_HL) || defined(EXTRA_SEARCH)
+     /* restore got_int, unless CTRL-C was hit while redrawing */
+     if (!got_int)
+       got_int = save_got_int;
+ #endif

     return (row);
 }

--
hundred-and-one symptoms of being an internet addict:
110. You actually volunteer to become your employer's webmaster.

--/-/---- Bram Moolenaar ---- [email protected] ---- [email protected] ---\-\--
 \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /