mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Be more conservative about flushing output queue
Don't flush on gui_mch_flush(); instead only flush when forced (happens e.g. if Vim is about to take a nap) or just before waiting for new input. This reduces screen flicker dramatically in certain cases.
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
unsigned specialColor;
|
||||
unsigned defaultBackgroundColor;
|
||||
unsigned defaultForegroundColor;
|
||||
NSDate *lastFlushDate;
|
||||
id dialogReturn;
|
||||
NSTimer *blinkTimer;
|
||||
int blinkState;
|
||||
|
||||
@@ -44,13 +44,6 @@
|
||||
#define WIN_VER 2 // "-O" vertically split windows
|
||||
#define WIN_TABS 3 // "-p" windows on tab pages
|
||||
|
||||
// This constant controls how often the command queue may be flushed. If it is
|
||||
// too small the app might feel unresponsive; if it is too large there might be
|
||||
// long periods without the screen updating (e.g. when sourcing a large session
|
||||
// file). (The unit is seconds.)
|
||||
static float MMFlushTimeoutInterval = 0.1f;
|
||||
static int MMFlushQueueLenHint = 80*40;
|
||||
|
||||
static unsigned MMServerMax = 1000;
|
||||
|
||||
// TODO: Move to separate file.
|
||||
@@ -487,14 +480,6 @@ static NSString *MMSymlinkWarningString =
|
||||
// NO.
|
||||
if (flushDisabled) return;
|
||||
|
||||
// NOTE! This method gets called a lot; if we were to flush every time it
|
||||
// got called MacVim would feel unresponsive. So there is a time out which
|
||||
// ensures that the queue isn't flushed too often.
|
||||
if (!force && lastFlushDate
|
||||
&& -[lastFlushDate timeIntervalSinceNow] < MMFlushTimeoutInterval
|
||||
&& [drawData length] < MMFlushQueueLenHint)
|
||||
return;
|
||||
|
||||
if ([drawData length] > 0) {
|
||||
// HACK! Detect changes to 'guifontwide'.
|
||||
if (gui.wide_font != (GuiFont)oldWideFont) {
|
||||
@@ -523,9 +508,6 @@ static NSString *MMSymlinkWarningString =
|
||||
}
|
||||
|
||||
[outputQueue removeAllObjects];
|
||||
|
||||
[lastFlushDate release];
|
||||
lastFlushDate = [[NSDate date] retain];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,12 +225,14 @@ gui_mch_update(void)
|
||||
void
|
||||
gui_mch_flush(void)
|
||||
{
|
||||
[[MMBackend sharedInstance] flushQueue:NO];
|
||||
// This function is called way too often to be useful as a hint for
|
||||
// flushing. If we were to flush every time it was called the screen would
|
||||
// flicker.
|
||||
}
|
||||
|
||||
|
||||
/* Force flush output to MacVim. Do not call this method unless absolutely
|
||||
* necessary (use gui_mch_flush() instead). */
|
||||
* necessary. */
|
||||
void
|
||||
gui_macvim_force_flush(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user